sensemaking 0.9.1 → 0.9.2
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 +1 -1
- package/dist/cjs/cli/check.js +34 -3
- package/dist/cjs/cli/check.js.map +1 -1
- 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 +46 -12
- 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 +13 -2
- package/dist/cjs/cli/shared.d.ts +13 -2
- package/dist/cjs/cli/shared.js +139 -7
- 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 +113 -121
- package/dist/cjs/cli.js.map +1 -1
- package/dist/esm/cli/check.js +9 -3
- package/dist/esm/cli/check.js.map +1 -1
- 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 +23 -13
- 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 +13 -2
- package/dist/esm/cli/shared.js +74 -7
- 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 +82 -95
- package/dist/esm/cli.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -78,7 +78,7 @@ and vector similarity — fused into one list. `via` labels each row's evidence
|
|
|
78
78
|
`lines` points at the section that earned the row — a direct read range. Rows that only
|
|
79
79
|
vectors produced are the "these words aren't in the tree, this is what's near in meaning"
|
|
80
80
|
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
|
|
81
|
+
for one command, `--where` filters on frontmatter. `--format json` on any reporting command returns
|
|
82
82
|
structured output; `--version` and `--help` do what they say.
|
|
83
83
|
|
|
84
84
|
## Config
|
package/dist/cjs/cli/check.js
CHANGED
|
@@ -11,6 +11,7 @@ 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 _indexts = require("./index.js");
|
|
14
15
|
var _sharedts = require("./shared.js");
|
|
15
16
|
function _array_like_to_array(arr, len) {
|
|
16
17
|
if (len == null || len > arr.length) len = arr.length;
|
|
@@ -49,6 +50,19 @@ function _async_to_generator(fn) {
|
|
|
49
50
|
});
|
|
50
51
|
};
|
|
51
52
|
}
|
|
53
|
+
function _define_property(obj, key, value) {
|
|
54
|
+
if (key in obj) {
|
|
55
|
+
Object.defineProperty(obj, key, {
|
|
56
|
+
value: value,
|
|
57
|
+
enumerable: true,
|
|
58
|
+
configurable: true,
|
|
59
|
+
writable: true
|
|
60
|
+
});
|
|
61
|
+
} else {
|
|
62
|
+
obj[key] = value;
|
|
63
|
+
}
|
|
64
|
+
return obj;
|
|
65
|
+
}
|
|
52
66
|
function _iterable_to_array_limit(arr, i) {
|
|
53
67
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
54
68
|
if (_i == null) return;
|
|
@@ -76,6 +90,21 @@ function _iterable_to_array_limit(arr, i) {
|
|
|
76
90
|
function _non_iterable_rest() {
|
|
77
91
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
78
92
|
}
|
|
93
|
+
function _object_spread(target) {
|
|
94
|
+
for(var i = 1; i < arguments.length; i++){
|
|
95
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
96
|
+
var ownKeys = Object.keys(source);
|
|
97
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
98
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
99
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
100
|
+
}));
|
|
101
|
+
}
|
|
102
|
+
ownKeys.forEach(function(key) {
|
|
103
|
+
_define_property(target, key, source[key]);
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
return target;
|
|
107
|
+
}
|
|
79
108
|
function _sliced_to_array(arr, i) {
|
|
80
109
|
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
81
110
|
}
|
|
@@ -202,11 +231,13 @@ function _ts_generator(thisArg, body) {
|
|
|
202
231
|
// result being empty is good or bad is the reader's judgment -- there is no assertion path.
|
|
203
232
|
var check = function check(ctx) {
|
|
204
233
|
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;
|
|
234
|
+
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
235
|
return _ts_generator(this, function(_state) {
|
|
207
236
|
switch(_state.label){
|
|
208
237
|
case 0:
|
|
209
|
-
|
|
238
|
+
values = (0, _sharedts.parse)(ctx.argv, "usage: ".concat(ctx.name, " ").concat(_indexts.USAGE.check), _object_spread({}, _sharedts.FORMAT, _sharedts.CONFIG)).values;
|
|
239
|
+
format = (0, _sharedts.formatOf)(values);
|
|
240
|
+
cfg = ctx.resolveConfig(values.config);
|
|
210
241
|
_open = (0, _dbts.open)(cfg), db = _open.db, warnings = _open.warnings;
|
|
211
242
|
(0, _sharedts.printWarnings)(warnings);
|
|
212
243
|
rows = [];
|
|
@@ -354,7 +385,7 @@ var check = function check(ctx) {
|
|
|
354
385
|
2
|
|
355
386
|
];
|
|
356
387
|
}
|
|
357
|
-
(0, _outputts.printRows)(rows,
|
|
388
|
+
(0, _outputts.printRows)(rows, format);
|
|
358
389
|
if (failed > 0) process.exit(1);
|
|
359
390
|
return [
|
|
360
391
|
2
|
|
@@ -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 { 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) process.exit(1);\n};\nexport default check;\n"],"names":["check","ctx","cfg","values","format","open","db","warnings","rows","failed","name","entry","sql","count","err","params","statement","parse","argv","USAGE","FORMAT","CONFIG","formatOf","resolveConfig","config","printWarnings","Object","entries","queries","search","k","where","preset","include","semantic","length","push","query","status","message","match","prepare","all","close","console","log","printRows","process","exit"],"mappings":"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"}
|
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() {
|
|
@@ -42,6 +44,34 @@ function _async_to_generator(fn) {
|
|
|
42
44
|
});
|
|
43
45
|
};
|
|
44
46
|
}
|
|
47
|
+
function _define_property(obj, key, value) {
|
|
48
|
+
if (key in obj) {
|
|
49
|
+
Object.defineProperty(obj, key, {
|
|
50
|
+
value: value,
|
|
51
|
+
enumerable: true,
|
|
52
|
+
configurable: true,
|
|
53
|
+
writable: true
|
|
54
|
+
});
|
|
55
|
+
} else {
|
|
56
|
+
obj[key] = value;
|
|
57
|
+
}
|
|
58
|
+
return obj;
|
|
59
|
+
}
|
|
60
|
+
function _object_spread(target) {
|
|
61
|
+
for(var i = 1; i < arguments.length; i++){
|
|
62
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
63
|
+
var ownKeys = Object.keys(source);
|
|
64
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
65
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
66
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
ownKeys.forEach(function(key) {
|
|
70
|
+
_define_property(target, key, source[key]);
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
return target;
|
|
74
|
+
}
|
|
45
75
|
function _ts_generator(thisArg, body) {
|
|
46
76
|
var f, y, t, _ = {
|
|
47
77
|
label: 0,
|
|
@@ -141,13 +171,17 @@ function _ts_generator(thisArg, body) {
|
|
|
141
171
|
};
|
|
142
172
|
}
|
|
143
173
|
}
|
|
144
|
-
function named(ctx, queryName
|
|
174
|
+
function named(ctx, queryName) {
|
|
145
175
|
return _async_to_generator(function() {
|
|
146
|
-
var _parseK,
|
|
176
|
+
var _parseK, _values_where, _values_preset, _values_include, usage, _parse, values, params, format, configPath, cfg, entry, k, where, preset, include, semantic;
|
|
147
177
|
return _ts_generator(this, function(_state) {
|
|
148
178
|
switch(_state.label){
|
|
149
179
|
case 0:
|
|
150
|
-
|
|
180
|
+
usage = "usage: ".concat(ctx.name, " ").concat(queryName, ' [params...] [--format table|json] [--config path] [--where "<sql>"] [--k n] [--preset name] [--include glob ...] [--lexical]');
|
|
181
|
+
_parse = (0, _sharedts.parse)(ctx.argv, usage, _object_spread({}, _sharedts.SEARCH_FLAGS, _sharedts.FORMAT, _sharedts.CONFIG)), values = _parse.values, params = _parse.positionals;
|
|
182
|
+
format = (0, _sharedts.formatOf)(values);
|
|
183
|
+
configPath = values.config;
|
|
184
|
+
cfg = ctx.resolveConfig(configPath);
|
|
151
185
|
entry = cfg.queries[queryName];
|
|
152
186
|
if (entry === undefined) {
|
|
153
187
|
console.error('unknown query: "'.concat(queryName, '"'));
|
|
@@ -155,13 +189,13 @@ function named(ctx, queryName, params) {
|
|
|
155
189
|
process.exit(2);
|
|
156
190
|
}
|
|
157
191
|
if (typeof entry === 'string') {
|
|
158
|
-
(0, _sharedts.runSql)(cfg, entry, params,
|
|
192
|
+
(0, _sharedts.runSql)(cfg, entry, params, format, 'query "'.concat(queryName, '"'));
|
|
159
193
|
return [
|
|
160
194
|
2
|
|
161
195
|
];
|
|
162
196
|
}
|
|
163
197
|
if ('sql' in entry) {
|
|
164
|
-
(0, _sharedts.runSql)(cfg, entry.sql, params,
|
|
198
|
+
(0, _sharedts.runSql)(cfg, entry.sql, params, format, 'query "'.concat(queryName, '"'));
|
|
165
199
|
return [
|
|
166
200
|
2
|
|
167
201
|
];
|
|
@@ -170,16 +204,16 @@ function named(ctx, queryName, params) {
|
|
|
170
204
|
if (params.length > 0) {
|
|
171
205
|
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
206
|
}
|
|
173
|
-
k = (_parseK = (0, _sharedts.parseK)(ctx)) !== null && _parseK !== void 0 ? _parseK : entry.k;
|
|
174
|
-
where = (
|
|
175
|
-
preset = (
|
|
176
|
-
include = (
|
|
207
|
+
k = (_parseK = (0, _sharedts.parseK)(values.k, ctx.usageError)) !== null && _parseK !== void 0 ? _parseK : entry.k;
|
|
208
|
+
where = (_values_where = values.where) !== null && _values_where !== void 0 ? _values_where : entry.where;
|
|
209
|
+
preset = (_values_preset = values.preset) !== null && _values_preset !== void 0 ? _values_preset : entry.preset;
|
|
210
|
+
include = (_values_include = values.include) !== null && _values_include !== void 0 ? _values_include : entry.include;
|
|
177
211
|
// --lexical upgrades a saved search's semantic behavior the same way --where/--k
|
|
178
212
|
// override; absent means the saved value (the flag has no default false override).
|
|
179
|
-
semantic =
|
|
213
|
+
semantic = values.lexical ? false : entry.semantic;
|
|
180
214
|
return [
|
|
181
215
|
4,
|
|
182
|
-
(0, _sharedts.withDb)(ctx, function(db, resolvedCfg) {
|
|
216
|
+
(0, _sharedts.withDb)(ctx, configPath, function(db, resolvedCfg) {
|
|
183
217
|
return _async_to_generator(function() {
|
|
184
218
|
return _ts_generator(this, function(_state) {
|
|
185
219
|
switch(_state.label){
|
|
@@ -199,7 +233,7 @@ function named(ctx, queryName, params) {
|
|
|
199
233
|
2,
|
|
200
234
|
_outputts.printRows.apply(void 0, [
|
|
201
235
|
_state.sent(),
|
|
202
|
-
|
|
236
|
+
format
|
|
203
237
|
])
|
|
204
238
|
];
|
|
205
239
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/named.ts"],"sourcesContent":["import { search } from '../commands.ts';\nimport { printRows } from '../output.ts';\nimport { parseK, runSql, withDb } from './shared.ts';\nimport type { Ctx } from './types.ts';\n\n// Fallback when the first positional is not a command: a named query from config, either a\n// SQL string (run as-is) or a saved search (run through the `search` command's own machinery).\nexport default async function named(ctx: Ctx, queryName: string
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/named.ts"],"sourcesContent":["import { search } from '../commands.ts';\nimport { printRows } from '../output.ts';\nimport { CONFIG, FORMAT, formatOf, parse, parseK, 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 named query from config, either a\n// SQL string (run as-is) or a saved search (run through the `search` command's own machinery).\n// Flags cover both shapes -- SEARCH_FLAGS override a saved search's fields the same way they\n// 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] [--config path] [--where \"<sql>\"] [--k n] [--preset name] [--include glob ...] [--lexical]`;\n const { values, positionals: params } = parse(ctx.argv, usage, { ...SEARCH_FLAGS, ...FORMAT, ...CONFIG });\n const format = formatOf(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 query: \"${queryName}\"`);\n console.error(`valid queries: ${Object.keys(cfg.queries).sort().join(', ')}`);\n process.exit(2);\n }\n\n if (typeof entry === 'string') {\n runSql(cfg, entry, params, format, `query \"${queryName}\"`);\n return;\n }\n if ('sql' in entry) {\n runSql(cfg, entry.sql, params, format, `query \"${queryName}\"`);\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 // --lexical upgrades a saved search's semantic behavior the same way --where/--k\n // override; absent means the saved value (the flag has no default false override).\n const semantic = values.lexical ? false : entry.semantic;\n await withDb(ctx, configPath, async (db, resolvedCfg) => printRows(await search(db, resolvedCfg, entry.search, { k, where, preset, include, semantic }), format));\n}\n"],"names":["named","ctx","queryName","parseK","values","usage","parse","params","format","configPath","cfg","entry","k","where","preset","include","semantic","name","argv","SEARCH_FLAGS","FORMAT","CONFIG","positionals","formatOf","config","resolveConfig","queries","undefined","console","error","Object","keys","sort","join","process","exit","runSql","sql","length","usageError","lexical","withDb","db","resolvedCfg","search","printRows"],"mappings":";;;;+BAKA,2FAA2F;AAC3F,+FAA+F;AAC/F,6FAA6F;AAC7F,uBAAuB;AACvB;;;eAA8BA;;;0BATP;wBACG;wBAC4D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOvE,SAAeA,MAAMC,GAAQ,EAAEC,SAAiB;;YA2BnDC,SACKC,eACCA,gBACCA,iBA7BXC,OACkCC,QAAhCF,QAAqBG,QACvBC,QACAC,YAEAC,KACAC,OAoBAC,GACAC,OACAC,QACAC,SAGAC;;;;oBAhCAX,QAAQ,AAAC,UAAqBH,OAAZD,IAAIgB,IAAI,EAAC,KAAa,OAAVf,WAAU;oBACNI,SAAAA,IAAAA,eAAK,EAACL,IAAIiB,IAAI,EAAEb,OAAO,mBAAKc,sBAAY,EAAKC,gBAAM,EAAKC,gBAAM,IAA9FjB,SAAgCE,OAAhCF,QAAqBG,SAAWD,OAAxBgB;oBACVd,SAASe,IAAAA,kBAAQ,EAACnB;oBAClBK,aAAaL,OAAOoB,MAAM;oBAE1Bd,MAAMT,IAAIwB,aAAa,CAAChB;oBACxBE,QAAQD,IAAIgB,OAAO,CAACxB,UAAU;oBACpC,IAAIS,UAAUgB,WAAW;wBACvBC,QAAQC,KAAK,CAAC,AAAC,mBAA4B,OAAV3B,WAAU;wBAC3C0B,QAAQC,KAAK,CAAC,AAAC,kBAA4D,OAA3CC,OAAOC,IAAI,CAACrB,IAAIgB,OAAO,EAAEM,IAAI,GAAGC,IAAI,CAAC;wBACrEC,QAAQC,IAAI,CAAC;oBACf;oBAEA,IAAI,OAAOxB,UAAU,UAAU;wBAC7ByB,IAAAA,gBAAM,EAAC1B,KAAKC,OAAOJ,QAAQC,QAAQ,AAAC,UAAmB,OAAVN,WAAU;wBACvD;;;oBACF;oBACA,IAAI,SAASS,OAAO;wBAClByB,IAAAA,gBAAM,EAAC1B,KAAKC,MAAM0B,GAAG,EAAE9B,QAAQC,QAAQ,AAAC,UAAmB,OAAVN,WAAU;wBAC3D;;;oBACF;oBAEA,uFAAuF;oBACvF,IAAIK,OAAO+B,MAAM,GAAG,GAAG;wBACrBrC,IAAIsC,UAAU,CAAC,AAAC,IAAuHtC,OAApHC,WAAU,4GAAmH,OAATD,IAAIgB,IAAI,EAAC;oBAClJ;oBACML,KAAIT,UAAAA,IAAAA,gBAAM,EAACC,OAAOQ,CAAC,EAAwBX,IAAIsC,UAAU,eAArDpC,qBAAAA,UAA0DQ,MAAMC,CAAC;oBACrEC,SAAST,gBAAAA,OAAOS,KAAK,cAAZT,2BAAAA,gBAAuCO,MAAME,KAAK;oBAC3DC,UAAUV,iBAAAA,OAAOU,MAAM,cAAbV,4BAAAA,iBAAwCO,MAAMG,MAAM;oBAC9DC,WAAWX,kBAAAA,OAAOW,OAAO,cAAdX,6BAAAA,kBAA2CO,MAAMI,OAAO;oBACzE,iFAAiF;oBACjF,mFAAmF;oBAC7EC,WAAWZ,OAAOoC,OAAO,GAAG,QAAQ7B,MAAMK,QAAQ;oBACxD;;wBAAMyB,IAAAA,gBAAM,EAACxC,KAAKQ,YAAY,SAAOiC,IAAIC;;;;;4CAA0B;;gDAAMC,IAAAA,kBAAM,EAACF,IAAIC,aAAahC,MAAMiC,MAAM,EAAE;oDAAEhC,GAAAA;oDAAGC,OAAAA;oDAAOC,QAAAA;oDAAQC,SAAAA;oDAASC,UAAAA;gDAAS;;;;;gDAA5F6B,mBAAS;oDAAC;oDAAsFrC;;;;;;;;;oBAAzJ;;;;;;IACF"}
|
package/dist/cjs/cli/peek.js
CHANGED
|
@@ -10,6 +10,7 @@ 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");
|
|
14
15
|
function _array_like_to_array(arr, len) {
|
|
15
16
|
if (len == null || len > arr.length) len = arr.length;
|
|
@@ -19,6 +20,19 @@ function _array_like_to_array(arr, len) {
|
|
|
19
20
|
function _array_with_holes(arr) {
|
|
20
21
|
if (Array.isArray(arr)) return arr;
|
|
21
22
|
}
|
|
23
|
+
function _define_property(obj, key, value) {
|
|
24
|
+
if (key in obj) {
|
|
25
|
+
Object.defineProperty(obj, key, {
|
|
26
|
+
value: value,
|
|
27
|
+
enumerable: true,
|
|
28
|
+
configurable: true,
|
|
29
|
+
writable: true
|
|
30
|
+
});
|
|
31
|
+
} else {
|
|
32
|
+
obj[key] = value;
|
|
33
|
+
}
|
|
34
|
+
return obj;
|
|
35
|
+
}
|
|
22
36
|
function _iterable_to_array_limit(arr, i) {
|
|
23
37
|
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
24
38
|
if (_i == null) return;
|
|
@@ -46,6 +60,21 @@ function _iterable_to_array_limit(arr, i) {
|
|
|
46
60
|
function _non_iterable_rest() {
|
|
47
61
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
48
62
|
}
|
|
63
|
+
function _object_spread(target) {
|
|
64
|
+
for(var i = 1; i < arguments.length; i++){
|
|
65
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
66
|
+
var ownKeys = Object.keys(source);
|
|
67
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
68
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
69
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
70
|
+
}));
|
|
71
|
+
}
|
|
72
|
+
ownKeys.forEach(function(key) {
|
|
73
|
+
_define_property(target, key, source[key]);
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
return target;
|
|
77
|
+
}
|
|
49
78
|
function _sliced_to_array(arr, i) {
|
|
50
79
|
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
51
80
|
}
|
|
@@ -58,11 +87,14 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
58
87
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
59
88
|
}
|
|
60
89
|
var peekCmd = function peekCmd(ctx) {
|
|
61
|
-
var
|
|
62
|
-
|
|
63
|
-
|
|
90
|
+
var usage = "usage: ".concat(ctx.name, " ").concat(_indexts.USAGE.peek);
|
|
91
|
+
var _parse = (0, _sharedts.parse)(ctx.argv, usage, _object_spread({}, _sharedts.FORMAT, _sharedts.CONFIG)), values = _parse.values, positionals = _parse.positionals;
|
|
92
|
+
var _positionals = _sliced_to_array(positionals, 1), pathArg = _positionals[0];
|
|
93
|
+
if (!pathArg) ctx.usageError(usage);
|
|
94
|
+
var format = (0, _sharedts.formatOf)(values);
|
|
95
|
+
return (0, _sharedts.withDb)(ctx, values.config, function(db, cfg) {
|
|
64
96
|
var result = (0, _commandsts.peek)(db, cfg, pathArg);
|
|
65
|
-
console.log(
|
|
97
|
+
console.log(format === 'json' ? JSON.stringify(result, null, 2) : (0, _outputts.renderPeek)(result));
|
|
66
98
|
});
|
|
67
99
|
};
|
|
68
100
|
var _default = peekCmd;
|
package/dist/cjs/cli/peek.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/peek.ts"],"sourcesContent":["import { peek } from '../commands.ts';\nimport { renderPeek } from '../output.ts';\nimport { withDb } from './shared.ts';\nimport type { Command } from './types.ts';\n\nconst peekCmd: Command = (ctx) => {\n const [pathArg] =
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/peek.ts"],"sourcesContent":["import { peek } from '../commands.ts';\nimport { renderPeek } 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 peekCmd: Command = (ctx) => {\n const usage = `usage: ${ctx.name} ${USAGE.peek}`;\n const { values, positionals } = parse(ctx.argv, usage, { ...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 result = peek(db, cfg, pathArg);\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","FORMAT","CONFIG","values","positionals","pathArg","usageError","format","formatOf","withDb","config","db","cfg","result","console","log","JSON","stringify","renderPeek"],"mappings":";;;;+BAiBA;;;eAAA;;;0BAjBqB;wBACM;uBACL;wBACkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGxD,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,gBAAM,EAAKC,gBAAM,IAArEC,SAAwBJ,OAAxBI,QAAQC,cAAgBL,OAAhBK;IAChB,IAAkBA,gCAAAA,iBAAXC,UAAWD;IAClB,IAAI,CAACC,SAASX,IAAIY,UAAU,CAACX;IAC7B,IAAMY,SAASC,IAAAA,kBAAQ,EAACL;IACxB,OAAOM,IAAAA,gBAAM,EAACf,KAAKS,OAAOO,MAAM,EAAwB,SAACC,IAAIC;QAC3D,IAAMC,SAASf,IAAAA,gBAAI,EAACa,IAAIC,KAAKP;QAC7BS,QAAQC,GAAG,CAACR,WAAW,SAASS,KAAKC,SAAS,CAACJ,QAAQ,MAAM,KAAKK,IAAAA,oBAAU,EAACL;IAC/E;AACF;IACA,WAAepB"}
|
package/dist/cjs/cli/query.js
CHANGED
|
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "default", {
|
|
|
8
8
|
return _default;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
+
var _indexts = require("./index.js");
|
|
11
12
|
var _sharedts = require("./shared.js");
|
|
12
13
|
function _array_like_to_array(arr, len) {
|
|
13
14
|
if (len == null || len > arr.length) len = arr.length;
|
|
@@ -17,12 +18,40 @@ function _array_like_to_array(arr, len) {
|
|
|
17
18
|
function _array_with_holes(arr) {
|
|
18
19
|
if (Array.isArray(arr)) return arr;
|
|
19
20
|
}
|
|
21
|
+
function _define_property(obj, key, value) {
|
|
22
|
+
if (key in obj) {
|
|
23
|
+
Object.defineProperty(obj, key, {
|
|
24
|
+
value: value,
|
|
25
|
+
enumerable: true,
|
|
26
|
+
configurable: true,
|
|
27
|
+
writable: true
|
|
28
|
+
});
|
|
29
|
+
} else {
|
|
30
|
+
obj[key] = value;
|
|
31
|
+
}
|
|
32
|
+
return obj;
|
|
33
|
+
}
|
|
20
34
|
function _iterable_to_array(iter) {
|
|
21
35
|
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
|
22
36
|
}
|
|
23
37
|
function _non_iterable_rest() {
|
|
24
38
|
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
25
39
|
}
|
|
40
|
+
function _object_spread(target) {
|
|
41
|
+
for(var i = 1; i < arguments.length; i++){
|
|
42
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
43
|
+
var ownKeys = Object.keys(source);
|
|
44
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
45
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
46
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
47
|
+
}));
|
|
48
|
+
}
|
|
49
|
+
ownKeys.forEach(function(key) {
|
|
50
|
+
_define_property(target, key, source[key]);
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return target;
|
|
54
|
+
}
|
|
26
55
|
function _to_array(arr) {
|
|
27
56
|
return _array_with_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_rest();
|
|
28
57
|
}
|
|
@@ -35,9 +64,12 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
35
64
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
36
65
|
}
|
|
37
66
|
var query = function query(ctx) {
|
|
38
|
-
var
|
|
39
|
-
|
|
40
|
-
|
|
67
|
+
var usage = "usage: ".concat(ctx.name, " ").concat(_indexts.USAGE.query);
|
|
68
|
+
var _parse = (0, _sharedts.parse)(ctx.argv, usage, _object_spread({}, _sharedts.FORMAT, _sharedts.CONFIG)), values = _parse.values, positionals = _parse.positionals;
|
|
69
|
+
var _positionals = _to_array(positionals), sql = _positionals[0], params = _positionals.slice(1);
|
|
70
|
+
if (!sql) ctx.usageError(usage);
|
|
71
|
+
var format = (0, _sharedts.formatOf)(values);
|
|
72
|
+
(0, _sharedts.runSql)(ctx.resolveConfig(values.config), sql, params, format, 'ad-hoc query');
|
|
41
73
|
};
|
|
42
74
|
var _default = query;
|
|
43
75
|
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/query.ts"],"sourcesContent":["import { runSql } from './shared.ts';\nimport type { Command } from './types.ts';\n\nconst query: Command = (ctx) => {\n const [sql, ...params] =
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/query.ts"],"sourcesContent":["import { USAGE } from './index.ts';\nimport { CONFIG, FORMAT, formatOf, parse, runSql } from './shared.ts';\nimport type { Command } from './types.ts';\n\nconst query: Command = (ctx) => {\n const usage = `usage: ${ctx.name} ${USAGE.query}`;\n const { values, positionals } = parse(ctx.argv, usage, { ...FORMAT, ...CONFIG });\n const [sql, ...params] = positionals;\n if (!sql) ctx.usageError(usage);\n const format = formatOf(values);\n runSql(ctx.resolveConfig(values.config as string | undefined), sql, params, format, 'ad-hoc query');\n};\nexport default query;\n"],"names":["query","ctx","usage","USAGE","name","parse","argv","FORMAT","CONFIG","values","positionals","sql","params","usageError","format","formatOf","runSql","resolveConfig","config"],"mappings":";;;;+BAYA;;;eAAA;;;uBAZsB;wBACkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGxD,IAAMA,QAAiB,eAACC;IACtB,IAAMC,QAAQ,AAAC,UAAqBC,OAAZF,IAAIG,IAAI,EAAC,KAAe,OAAZD,cAAK,CAACH,KAAK;IAC/C,IAAgCK,SAAAA,IAAAA,eAAK,EAACJ,IAAIK,IAAI,EAAEJ,OAAO,mBAAKK,gBAAM,EAAKC,gBAAM,IAArEC,SAAwBJ,OAAxBI,QAAQC,cAAgBL,OAAhBK;IAChB,IAAyBA,yBAAAA,cAAlBC,MAAkBD,iBAAb,AAAGE,SAAUF,mBAAb;IACZ,IAAI,CAACC,KAAKV,IAAIY,UAAU,CAACX;IACzB,IAAMY,SAASC,IAAAA,kBAAQ,EAACN;IACxBO,IAAAA,gBAAM,EAACf,IAAIgB,aAAa,CAACR,OAAOS,MAAM,GAAyBP,KAAKC,QAAQE,QAAQ;AACtF;IACA,WAAed"}
|