sensemaking 0.9.4 → 0.10.0
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 +50 -100
- package/dist/cjs/cli/check.js +7 -13
- package/dist/cjs/cli/check.js.map +1 -1
- package/dist/cjs/cli/download.d.cts +3 -0
- package/dist/cjs/cli/download.d.ts +3 -0
- package/dist/cjs/cli/download.js +214 -0
- package/dist/cjs/cli/download.js.map +1 -0
- package/dist/cjs/cli/index.d.cts +6 -3
- package/dist/cjs/cli/index.d.ts +6 -3
- package/dist/cjs/cli/index.js +23 -5
- package/dist/cjs/cli/index.js.map +1 -1
- package/dist/cjs/cli/init.js +4 -1
- package/dist/cjs/cli/init.js.map +1 -1
- package/dist/cjs/cli/map.js +2 -2
- package/dist/cjs/cli/map.js.map +1 -1
- package/dist/cjs/cli/named.js +10 -18
- package/dist/cjs/cli/named.js.map +1 -1
- package/dist/cjs/cli/path.d.cts +3 -0
- package/dist/cjs/cli/path.d.ts +3 -0
- package/dist/cjs/cli/path.js +161 -0
- package/dist/cjs/cli/path.js.map +1 -0
- package/dist/cjs/cli/peek.js +3 -2
- package/dist/cjs/cli/peek.js.map +1 -1
- package/dist/cjs/cli/related.d.cts +3 -0
- package/dist/cjs/cli/related.d.ts +3 -0
- package/dist/cjs/cli/related.js +279 -0
- package/dist/cjs/cli/related.js.map +1 -0
- package/dist/cjs/cli/search.js +3 -7
- package/dist/cjs/cli/search.js.map +1 -1
- package/dist/cjs/cli/shared.d.cts +3 -1
- package/dist/cjs/cli/shared.d.ts +3 -1
- package/dist/cjs/cli/shared.js +28 -5
- package/dist/cjs/cli/shared.js.map +1 -1
- package/dist/cjs/cli/sql.d.cts +3 -0
- package/dist/cjs/cli/sql.d.ts +3 -0
- package/dist/cjs/cli/{query.js → sql.js} +4 -4
- package/dist/cjs/cli/sql.js.map +1 -0
- package/dist/cjs/cli/status.js +9 -2
- package/dist/cjs/cli/status.js.map +1 -1
- package/dist/cjs/cli.js +14 -15
- package/dist/cjs/cli.js.map +1 -1
- package/dist/cjs/commands.d.cts +12 -4
- package/dist/cjs/commands.d.ts +12 -4
- package/dist/cjs/commands.js +138 -58
- package/dist/cjs/commands.js.map +1 -1
- package/dist/cjs/config.d.cts +6 -4
- package/dist/cjs/config.d.ts +6 -4
- package/dist/cjs/config.js +137 -58
- package/dist/cjs/config.js.map +1 -1
- package/dist/cjs/db.js +14 -34
- package/dist/cjs/db.js.map +1 -1
- package/dist/cjs/errors.d.cts +1 -1
- package/dist/cjs/errors.d.ts +1 -1
- package/dist/cjs/errors.js.map +1 -1
- package/dist/cjs/features/embed.d.cts +14 -0
- package/dist/cjs/features/embed.d.ts +14 -0
- package/dist/cjs/features/embed.js +248 -54
- package/dist/cjs/features/embed.js.map +1 -1
- package/dist/cjs/features/links.js +7 -16
- package/dist/cjs/features/links.js.map +1 -1
- package/dist/cjs/features/rank.js +2 -6
- package/dist/cjs/features/rank.js.map +1 -1
- package/dist/cjs/index.d.cts +1 -1
- package/dist/cjs/index.d.ts +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/output.js +11 -14
- package/dist/cjs/output.js.map +1 -1
- package/dist/cjs/progress.js +2 -4
- package/dist/cjs/progress.js.map +1 -1
- package/dist/cjs/scan.d.cts +1 -0
- package/dist/cjs/scan.d.ts +1 -0
- package/dist/cjs/scan.js +67 -32
- package/dist/cjs/scan.js.map +1 -1
- package/dist/cjs/search-error.js +4 -6
- package/dist/cjs/search-error.js.map +1 -1
- package/dist/cjs/traverse.d.cts +8 -0
- package/dist/cjs/traverse.d.ts +8 -0
- package/dist/cjs/traverse.js +97 -0
- package/dist/cjs/traverse.js.map +1 -0
- package/dist/esm/cli/check.js +7 -13
- package/dist/esm/cli/check.js.map +1 -1
- package/dist/esm/cli/download.d.ts +3 -0
- package/dist/esm/cli/download.js +27 -0
- package/dist/esm/cli/download.js.map +1 -0
- package/dist/esm/cli/index.d.ts +6 -3
- package/dist/esm/cli/index.js +13 -7
- package/dist/esm/cli/index.js.map +1 -1
- package/dist/esm/cli/init.js +4 -1
- package/dist/esm/cli/init.js.map +1 -1
- package/dist/esm/cli/map.js +3 -2
- package/dist/esm/cli/map.js.map +1 -1
- package/dist/esm/cli/named.js +10 -16
- package/dist/esm/cli/named.js.map +1 -1
- package/dist/esm/cli/path.d.ts +3 -0
- package/dist/esm/cli/path.js +51 -0
- package/dist/esm/cli/path.js.map +1 -0
- package/dist/esm/cli/peek.js +4 -2
- package/dist/esm/cli/peek.js.map +1 -1
- package/dist/esm/cli/related.d.ts +3 -0
- package/dist/esm/cli/related.js +26 -0
- package/dist/esm/cli/related.js.map +1 -0
- package/dist/esm/cli/search.js +2 -5
- package/dist/esm/cli/search.js.map +1 -1
- package/dist/esm/cli/shared.d.ts +3 -1
- package/dist/esm/cli/shared.js +28 -5
- package/dist/esm/cli/shared.js.map +1 -1
- package/dist/esm/cli/sql.d.ts +3 -0
- package/dist/esm/cli/{query.js → sql.js} +4 -4
- package/dist/esm/cli/sql.js.map +1 -0
- package/dist/esm/cli/status.js +8 -1
- package/dist/esm/cli/status.js.map +1 -1
- package/dist/esm/cli.js +13 -10
- package/dist/esm/cli.js.map +1 -1
- package/dist/esm/commands.d.ts +12 -4
- package/dist/esm/commands.js +111 -68
- package/dist/esm/commands.js.map +1 -1
- package/dist/esm/config.d.ts +6 -4
- package/dist/esm/config.js +126 -75
- package/dist/esm/config.js.map +1 -1
- package/dist/esm/db.js +16 -38
- package/dist/esm/db.js.map +1 -1
- package/dist/esm/errors.d.ts +1 -1
- package/dist/esm/errors.js.map +1 -1
- package/dist/esm/features/embed.d.ts +14 -0
- package/dist/esm/features/embed.js +110 -35
- package/dist/esm/features/embed.js.map +1 -1
- package/dist/esm/features/links.js +8 -17
- package/dist/esm/features/links.js.map +1 -1
- package/dist/esm/features/rank.js +2 -6
- package/dist/esm/features/rank.js.map +1 -1
- package/dist/esm/features/types.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/output.js +13 -16
- package/dist/esm/output.js.map +1 -1
- package/dist/esm/progress.js +2 -4
- package/dist/esm/progress.js.map +1 -1
- package/dist/esm/scan.d.ts +1 -0
- package/dist/esm/scan.js +41 -34
- package/dist/esm/scan.js.map +1 -1
- package/dist/esm/search-error.js +4 -6
- package/dist/esm/search-error.js.map +1 -1
- package/dist/esm/traverse.d.ts +8 -0
- package/dist/esm/traverse.js +71 -0
- package/dist/esm/traverse.js.map +1 -0
- package/package.json +18 -5
- package/schema.json +12 -16
- package/skills/sense/EXAMPLES.md +13 -22
- package/skills/sense/SKILL.md +65 -140
- package/skills/sense-setup/EXAMPLES.md +30 -46
- package/skills/sense-setup/SKILL.md +22 -83
- package/dist/cjs/cli/query.d.cts +0 -3
- package/dist/cjs/cli/query.d.ts +0 -3
- package/dist/cjs/cli/query.js.map +0 -1
- package/dist/esm/cli/query.d.ts +0 -3
- package/dist/esm/cli/query.js.map +0 -1
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "default", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return _default;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
var _commandsts = require("../commands.js");
|
|
12
|
+
var _outputts = require("../output.js");
|
|
13
|
+
var _indexts = require("./index.js");
|
|
14
|
+
var _sharedts = require("./shared.js");
|
|
15
|
+
function _array_like_to_array(arr, len) {
|
|
16
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
17
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
18
|
+
return arr2;
|
|
19
|
+
}
|
|
20
|
+
function _array_with_holes(arr) {
|
|
21
|
+
if (Array.isArray(arr)) return arr;
|
|
22
|
+
}
|
|
23
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
24
|
+
try {
|
|
25
|
+
var info = gen[key](arg);
|
|
26
|
+
var value = info.value;
|
|
27
|
+
} catch (error) {
|
|
28
|
+
reject(error);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (info.done) {
|
|
32
|
+
resolve(value);
|
|
33
|
+
} else {
|
|
34
|
+
Promise.resolve(value).then(_next, _throw);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function _async_to_generator(fn) {
|
|
38
|
+
return function() {
|
|
39
|
+
var self = this, args = arguments;
|
|
40
|
+
return new Promise(function(resolve, reject) {
|
|
41
|
+
var gen = fn.apply(self, args);
|
|
42
|
+
function _next(value) {
|
|
43
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
44
|
+
}
|
|
45
|
+
function _throw(err) {
|
|
46
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
47
|
+
}
|
|
48
|
+
_next(undefined);
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
function _define_property(obj, key, value) {
|
|
53
|
+
if (key in obj) {
|
|
54
|
+
Object.defineProperty(obj, key, {
|
|
55
|
+
value: value,
|
|
56
|
+
enumerable: true,
|
|
57
|
+
configurable: true,
|
|
58
|
+
writable: true
|
|
59
|
+
});
|
|
60
|
+
} else {
|
|
61
|
+
obj[key] = value;
|
|
62
|
+
}
|
|
63
|
+
return obj;
|
|
64
|
+
}
|
|
65
|
+
function _iterable_to_array_limit(arr, i) {
|
|
66
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
67
|
+
if (_i == null) return;
|
|
68
|
+
var _arr = [];
|
|
69
|
+
var _n = true;
|
|
70
|
+
var _d = false;
|
|
71
|
+
var _s, _e;
|
|
72
|
+
try {
|
|
73
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
74
|
+
_arr.push(_s.value);
|
|
75
|
+
if (i && _arr.length === i) break;
|
|
76
|
+
}
|
|
77
|
+
} catch (err) {
|
|
78
|
+
_d = true;
|
|
79
|
+
_e = err;
|
|
80
|
+
} finally{
|
|
81
|
+
try {
|
|
82
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
83
|
+
} finally{
|
|
84
|
+
if (_d) throw _e;
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
return _arr;
|
|
88
|
+
}
|
|
89
|
+
function _non_iterable_rest() {
|
|
90
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
91
|
+
}
|
|
92
|
+
function _object_spread(target) {
|
|
93
|
+
for(var i = 1; i < arguments.length; i++){
|
|
94
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
95
|
+
var ownKeys = Object.keys(source);
|
|
96
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
97
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
98
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
99
|
+
}));
|
|
100
|
+
}
|
|
101
|
+
ownKeys.forEach(function(key) {
|
|
102
|
+
_define_property(target, key, source[key]);
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
return target;
|
|
106
|
+
}
|
|
107
|
+
function ownKeys(object, enumerableOnly) {
|
|
108
|
+
var keys = Object.keys(object);
|
|
109
|
+
if (Object.getOwnPropertySymbols) {
|
|
110
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
111
|
+
if (enumerableOnly) {
|
|
112
|
+
symbols = symbols.filter(function(sym) {
|
|
113
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
keys.push.apply(keys, symbols);
|
|
117
|
+
}
|
|
118
|
+
return keys;
|
|
119
|
+
}
|
|
120
|
+
function _object_spread_props(target, source) {
|
|
121
|
+
source = source != null ? source : {};
|
|
122
|
+
if (Object.getOwnPropertyDescriptors) {
|
|
123
|
+
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
124
|
+
} else {
|
|
125
|
+
ownKeys(Object(source)).forEach(function(key) {
|
|
126
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
return target;
|
|
130
|
+
}
|
|
131
|
+
function _sliced_to_array(arr, i) {
|
|
132
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
133
|
+
}
|
|
134
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
135
|
+
if (!o) return;
|
|
136
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
137
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
138
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
139
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
140
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
141
|
+
}
|
|
142
|
+
function _ts_generator(thisArg, body) {
|
|
143
|
+
var f, y, t, _ = {
|
|
144
|
+
label: 0,
|
|
145
|
+
sent: function() {
|
|
146
|
+
if (t[0] & 1) throw t[1];
|
|
147
|
+
return t[1];
|
|
148
|
+
},
|
|
149
|
+
trys: [],
|
|
150
|
+
ops: []
|
|
151
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
152
|
+
return d(g, "next", {
|
|
153
|
+
value: verb(0)
|
|
154
|
+
}), d(g, "throw", {
|
|
155
|
+
value: verb(1)
|
|
156
|
+
}), d(g, "return", {
|
|
157
|
+
value: verb(2)
|
|
158
|
+
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
159
|
+
value: function() {
|
|
160
|
+
return this;
|
|
161
|
+
}
|
|
162
|
+
}), g;
|
|
163
|
+
function verb(n) {
|
|
164
|
+
return function(v) {
|
|
165
|
+
return step([
|
|
166
|
+
n,
|
|
167
|
+
v
|
|
168
|
+
]);
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
function step(op) {
|
|
172
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
173
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
174
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
175
|
+
if (y = 0, t) op = [
|
|
176
|
+
op[0] & 2,
|
|
177
|
+
t.value
|
|
178
|
+
];
|
|
179
|
+
switch(op[0]){
|
|
180
|
+
case 0:
|
|
181
|
+
case 1:
|
|
182
|
+
t = op;
|
|
183
|
+
break;
|
|
184
|
+
case 4:
|
|
185
|
+
_.label++;
|
|
186
|
+
return {
|
|
187
|
+
value: op[1],
|
|
188
|
+
done: false
|
|
189
|
+
};
|
|
190
|
+
case 5:
|
|
191
|
+
_.label++;
|
|
192
|
+
y = op[1];
|
|
193
|
+
op = [
|
|
194
|
+
0
|
|
195
|
+
];
|
|
196
|
+
continue;
|
|
197
|
+
case 7:
|
|
198
|
+
op = _.ops.pop();
|
|
199
|
+
_.trys.pop();
|
|
200
|
+
continue;
|
|
201
|
+
default:
|
|
202
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
203
|
+
_ = 0;
|
|
204
|
+
continue;
|
|
205
|
+
}
|
|
206
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
207
|
+
_.label = op[1];
|
|
208
|
+
break;
|
|
209
|
+
}
|
|
210
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
211
|
+
_.label = t[1];
|
|
212
|
+
t = op;
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
215
|
+
if (t && _.label < t[2]) {
|
|
216
|
+
_.label = t[2];
|
|
217
|
+
_.ops.push(op);
|
|
218
|
+
break;
|
|
219
|
+
}
|
|
220
|
+
if (t[2]) _.ops.pop();
|
|
221
|
+
_.trys.pop();
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
op = body.call(thisArg, _);
|
|
225
|
+
} catch (e) {
|
|
226
|
+
op = [
|
|
227
|
+
6,
|
|
228
|
+
e
|
|
229
|
+
];
|
|
230
|
+
y = 0;
|
|
231
|
+
} finally{
|
|
232
|
+
f = t = 0;
|
|
233
|
+
}
|
|
234
|
+
if (op[0] & 5) throw op[1];
|
|
235
|
+
return {
|
|
236
|
+
value: op[0] ? op[1] : void 0,
|
|
237
|
+
done: true
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
var RELATED_DEFAULT_K = 5;
|
|
242
|
+
var relatedCmd = function relatedCmd(ctx) {
|
|
243
|
+
var _parseK;
|
|
244
|
+
var usage = "usage: ".concat(ctx.name, " ").concat(_indexts.USAGE.related);
|
|
245
|
+
var _parse = (0, _sharedts.parse)(ctx.argv, usage, _object_spread_props(_object_spread({}, _sharedts.SCOPE, _sharedts.FORMAT, _sharedts.CONFIG), {
|
|
246
|
+
k: {
|
|
247
|
+
type: 'string'
|
|
248
|
+
}
|
|
249
|
+
})), values = _parse.values, positionals = _parse.positionals;
|
|
250
|
+
var _positionals = _sliced_to_array(positionals, 1), pathArg = _positionals[0];
|
|
251
|
+
if (!pathArg) ctx.usageError(usage);
|
|
252
|
+
var k = (_parseK = (0, _sharedts.parseK)(values.k, ctx.usageError)) !== null && _parseK !== void 0 ? _parseK : RELATED_DEFAULT_K;
|
|
253
|
+
var format = (0, _sharedts.formatOf)(values);
|
|
254
|
+
return (0, _sharedts.withDb)(ctx, values.config, function(db, cfg) {
|
|
255
|
+
return _async_to_generator(function() {
|
|
256
|
+
var overrides;
|
|
257
|
+
return _ts_generator(this, function(_state) {
|
|
258
|
+
switch(_state.label){
|
|
259
|
+
case 0:
|
|
260
|
+
overrides = (0, _sharedts.scopeOf)(values);
|
|
261
|
+
return [
|
|
262
|
+
4,
|
|
263
|
+
(0, _commandsts.relatedNotes)(db, cfg, pathArg, overrides, k)
|
|
264
|
+
];
|
|
265
|
+
case 1:
|
|
266
|
+
_outputts.printRows.apply(void 0, [
|
|
267
|
+
_state.sent(),
|
|
268
|
+
format
|
|
269
|
+
]);
|
|
270
|
+
return [
|
|
271
|
+
2
|
|
272
|
+
];
|
|
273
|
+
}
|
|
274
|
+
});
|
|
275
|
+
})();
|
|
276
|
+
});
|
|
277
|
+
};
|
|
278
|
+
var _default = relatedCmd;
|
|
279
|
+
/* 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/related.ts"],"sourcesContent":["import { relatedNotes } from '../commands.ts';\nimport type { Row } from '../output.ts';\nimport { printRows } from '../output.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, FORMAT, formatOf, parse, parseK, SCOPE, scopeOf, withDb } from './shared.ts';\nimport type { Command } from './types.ts';\n\nconst RELATED_DEFAULT_K = 5;\n\nconst relatedCmd: Command = (ctx) => {\n const usage = `usage: ${ctx.name} ${USAGE.related}`;\n const { values, positionals } = parse(ctx.argv, usage, { ...SCOPE, ...FORMAT, ...CONFIG, k: { type: 'string' } });\n const [pathArg] = positionals;\n if (!pathArg) ctx.usageError(usage);\n const k = parseK(values.k as string | undefined, ctx.usageError) ?? RELATED_DEFAULT_K;\n const format = formatOf(values);\n return withDb(ctx, values.config as string | undefined, async (db, cfg) => {\n const overrides = scopeOf(values);\n printRows((await relatedNotes(db, cfg, pathArg, overrides, k)) as Row[], format);\n });\n};\nexport default relatedCmd;\n"],"names":["RELATED_DEFAULT_K","relatedCmd","ctx","parseK","usage","USAGE","name","related","parse","argv","SCOPE","FORMAT","CONFIG","k","type","values","positionals","pathArg","usageError","format","formatOf","withDb","config","db","cfg","overrides","scopeOf","relatedNotes","printRows"],"mappings":";;;;+BAqBA;;;eAAA;;;0BArB6B;wBAEH;uBACJ;wBAC0D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGhF,IAAMA,oBAAoB;AAE1B,IAAMC,aAAsB,oBAACC;QAKjBC;IAJV,IAAMC,QAAQ,AAAC,UAAqBC,OAAZH,IAAII,IAAI,EAAC,KAAiB,OAAdD,cAAK,CAACE,OAAO;IACjD,IAAgCC,SAAAA,IAAAA,eAAK,EAACN,IAAIO,IAAI,EAAEL,OAAO,wCAAKM,eAAK,EAAKC,gBAAM,EAAKC,gBAAM;QAAEC,GAAG;YAAEC,MAAM;QAAS;SAArGC,SAAwBP,OAAxBO,QAAQC,cAAgBR,OAAhBQ;IAChB,IAAkBA,gCAAAA,iBAAXC,UAAWD;IAClB,IAAI,CAACC,SAASf,IAAIgB,UAAU,CAACd;IAC7B,IAAMS,KAAIV,UAAAA,IAAAA,gBAAM,EAACY,OAAOF,CAAC,EAAwBX,IAAIgB,UAAU,eAArDf,qBAAAA,UAA0DH;IACpE,IAAMmB,SAASC,IAAAA,kBAAQ,EAACL;IACxB,OAAOM,IAAAA,gBAAM,EAACnB,KAAKa,OAAOO,MAAM,EAAwB,SAAOC,IAAIC;;gBAC3DC;;;;wBAAAA,YAAYC,IAAAA,iBAAO,EAACX;wBACf;;4BAAMY,IAAAA,wBAAY,EAACJ,IAAIC,KAAKP,SAASQ,WAAWZ;;;wBAA3De,mBAAS;4BAAE;4BAA8DT;;;;;;;QAC3E;;AACF;IACA,WAAelB"}
|
package/dist/cjs/cli/search.js
CHANGED
|
@@ -235,13 +235,9 @@ var searchCmd = function searchCmd(ctx) {
|
|
|
235
235
|
case 0:
|
|
236
236
|
return [
|
|
237
237
|
4,
|
|
238
|
-
(0, _commandsts.search)(db, cfg, terms, {
|
|
239
|
-
k: k
|
|
240
|
-
|
|
241
|
-
preset: values.preset,
|
|
242
|
-
include: values.include,
|
|
243
|
-
semantic: values.lexical ? false : undefined
|
|
244
|
-
})
|
|
238
|
+
(0, _commandsts.search)(db, cfg, terms, _object_spread({
|
|
239
|
+
k: k
|
|
240
|
+
}, (0, _sharedts.scopeOf)(values)))
|
|
245
241
|
];
|
|
246
242
|
case 1:
|
|
247
243
|
return [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/search.ts"],"sourcesContent":["import { search } from '../commands.ts';\nimport { printRows } from '../output.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, FORMAT, formatOf, parse, parseK, SEARCH_FLAGS, withDb } from './shared.ts';\nimport type { Command } from './types.ts';\n\nconst searchCmd: Command = async (ctx) => {\n const usage = `usage: ${ctx.name} ${USAGE.search}`;\n const { values, positionals } = parse(ctx.argv, usage, { ...SEARCH_FLAGS, ...FORMAT, ...CONFIG });\n const [terms] = positionals;\n if (!terms) ctx.usageError(usage);\n const k = parseK(values.k as string | undefined, ctx.usageError);\n const format = formatOf(values);\n await withDb(ctx, values.config as string | undefined, async (db, cfg) => printRows(await search(db, cfg, terms, { k,
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/search.ts"],"sourcesContent":["import { search } from '../commands.ts';\nimport { printRows } from '../output.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, FORMAT, formatOf, parse, parseK, SEARCH_FLAGS, scopeOf, withDb } from './shared.ts';\nimport type { Command } from './types.ts';\n\nconst searchCmd: Command = async (ctx) => {\n const usage = `usage: ${ctx.name} ${USAGE.search}`;\n const { values, positionals } = parse(ctx.argv, usage, { ...SEARCH_FLAGS, ...FORMAT, ...CONFIG });\n const [terms] = positionals;\n if (!terms) ctx.usageError(usage);\n const k = parseK(values.k as string | undefined, ctx.usageError);\n const format = formatOf(values);\n await withDb(ctx, values.config as string | undefined, async (db, cfg) => printRows(await search(db, cfg, terms, { k, ...scopeOf(values) }), format));\n};\nexport default searchCmd;\n"],"names":["searchCmd","ctx","usage","parse","values","positionals","terms","k","format","USAGE","name","search","argv","SEARCH_FLAGS","FORMAT","CONFIG","usageError","parseK","formatOf","withDb","config","db","cfg","scopeOf","printRows"],"mappings":";;;;+BAeA;;;eAAA;;;0BAfuB;wBACG;uBACJ;wBACiE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGvF,IAAMA,YAAqB,mBAAOC;;YAC1BC,OAC0BC,QAAxBC,QAAQC,aACAA,cAATC,OAEDC,GACAC;;;;oBALAN,QAAQ,AAAC,UAAqBO,OAAZR,IAAIS,IAAI,EAAC,KAAgB,OAAbD,cAAK,CAACE,MAAM;oBAChBR,SAAAA,IAAAA,eAAK,EAACF,IAAIW,IAAI,EAAEV,OAAO,mBAAKW,sBAAY,EAAKC,gBAAM,EAAKC,gBAAM,IAAtFX,SAAwBD,OAAxBC,QAAQC,cAAgBF,OAAhBE;oBACAA,gCAAAA,iBAATC,QAASD;oBAChB,IAAI,CAACC,OAAOL,IAAIe,UAAU,CAACd;oBACrBK,IAAIU,IAAAA,gBAAM,EAACb,OAAOG,CAAC,EAAwBN,IAAIe,UAAU;oBACzDR,SAASU,IAAAA,kBAAQ,EAACd;oBACxB;;wBAAMe,IAAAA,gBAAM,EAAClB,KAAKG,OAAOgB,MAAM,EAAwB,SAAOC,IAAIC;;;;;4CAAkB;;gDAAMX,IAAAA,kBAAM,EAACU,IAAIC,KAAKhB,OAAO;oDAAEC,GAAAA;mDAAMgB,IAAAA,iBAAO,EAACnB;;;;;gDAAvDoB,mBAAS;oDAAC;oDAAyDhB;;;;;;;;;oBAA7I;;;;;;IACF;;IACA,WAAeR"}
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { ParseArgsOptionsConfig } from 'node:util';
|
|
2
|
-
import type { ResolvedConfig } from '../config.js';
|
|
2
|
+
import type { ResolvedConfig, SearchOverrides } from '../config.js';
|
|
3
3
|
import type { OpenResult } from '../db.js';
|
|
4
4
|
import type { Ctx } from './types.js';
|
|
5
5
|
export declare const FORMAT: ParseArgsOptionsConfig;
|
|
6
6
|
export declare const CONFIG: ParseArgsOptionsConfig;
|
|
7
|
+
export declare const SCOPE: ParseArgsOptionsConfig;
|
|
7
8
|
export declare const SEARCH_FLAGS: ParseArgsOptionsConfig;
|
|
8
9
|
type Values = Record<string, string | boolean | string[] | undefined>;
|
|
10
|
+
export declare function scopeOf(values: Values): SearchOverrides;
|
|
9
11
|
export declare function formatOf(values: Values): 'table' | 'json';
|
|
10
12
|
export declare function parse(argv: string[], usage: string, options: ParseArgsOptionsConfig): {
|
|
11
13
|
values: Values;
|
package/dist/cjs/cli/shared.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { ParseArgsOptionsConfig } from 'node:util';
|
|
2
|
-
import type { ResolvedConfig } from '../config.js';
|
|
2
|
+
import type { ResolvedConfig, SearchOverrides } from '../config.js';
|
|
3
3
|
import type { OpenResult } from '../db.js';
|
|
4
4
|
import type { Ctx } from './types.js';
|
|
5
5
|
export declare const FORMAT: ParseArgsOptionsConfig;
|
|
6
6
|
export declare const CONFIG: ParseArgsOptionsConfig;
|
|
7
|
+
export declare const SCOPE: ParseArgsOptionsConfig;
|
|
7
8
|
export declare const SEARCH_FLAGS: ParseArgsOptionsConfig;
|
|
8
9
|
type Values = Record<string, string | boolean | string[] | undefined>;
|
|
10
|
+
export declare function scopeOf(values: Values): SearchOverrides;
|
|
9
11
|
export declare function formatOf(values: Values): 'table' | 'json';
|
|
10
12
|
export declare function parse(argv: string[], usage: string, options: ParseArgsOptionsConfig): {
|
|
11
13
|
values: Values;
|
package/dist/cjs/cli/shared.js
CHANGED
|
@@ -15,6 +15,9 @@ _export(exports, {
|
|
|
15
15
|
get FORMAT () {
|
|
16
16
|
return FORMAT;
|
|
17
17
|
},
|
|
18
|
+
get SCOPE () {
|
|
19
|
+
return SCOPE;
|
|
20
|
+
},
|
|
18
21
|
get SEARCH_FLAGS () {
|
|
19
22
|
return SEARCH_FLAGS;
|
|
20
23
|
},
|
|
@@ -33,6 +36,9 @@ _export(exports, {
|
|
|
33
36
|
get runSql () {
|
|
34
37
|
return runSql;
|
|
35
38
|
},
|
|
39
|
+
get scopeOf () {
|
|
40
|
+
return scopeOf;
|
|
41
|
+
},
|
|
36
42
|
get withDb () {
|
|
37
43
|
return withDb;
|
|
38
44
|
}
|
|
@@ -257,13 +263,10 @@ var CONFIG = {
|
|
|
257
263
|
type: 'string'
|
|
258
264
|
}
|
|
259
265
|
};
|
|
260
|
-
var
|
|
266
|
+
var SCOPE = {
|
|
261
267
|
where: {
|
|
262
268
|
type: 'string'
|
|
263
269
|
},
|
|
264
|
-
k: {
|
|
265
|
-
type: 'string'
|
|
266
|
-
},
|
|
267
270
|
preset: {
|
|
268
271
|
type: 'string'
|
|
269
272
|
},
|
|
@@ -271,11 +274,31 @@ var SEARCH_FLAGS = {
|
|
|
271
274
|
type: 'string',
|
|
272
275
|
multiple: true
|
|
273
276
|
},
|
|
274
|
-
|
|
277
|
+
exclude: {
|
|
278
|
+
type: 'string',
|
|
279
|
+
multiple: true
|
|
280
|
+
},
|
|
281
|
+
// Widening, which no other flag can express: --include and --exclude each override their
|
|
282
|
+
// own side of the preset, so neither can drop an exclusion the preset declares.
|
|
283
|
+
'no-exclude': {
|
|
275
284
|
type: 'boolean',
|
|
276
285
|
default: false
|
|
277
286
|
}
|
|
278
287
|
};
|
|
288
|
+
var SEARCH_FLAGS = _object_spread_props(_object_spread({}, SCOPE), {
|
|
289
|
+
k: {
|
|
290
|
+
type: 'string'
|
|
291
|
+
}
|
|
292
|
+
});
|
|
293
|
+
function scopeOf(values) {
|
|
294
|
+
return {
|
|
295
|
+
preset: values.preset,
|
|
296
|
+
include: values.include,
|
|
297
|
+
exclude: values.exclude,
|
|
298
|
+
where: values.where,
|
|
299
|
+
noExclude: values['no-exclude'] === true
|
|
300
|
+
};
|
|
301
|
+
}
|
|
279
302
|
function formatOf(values) {
|
|
280
303
|
return values.format === 'json' ? 'json' : 'table';
|
|
281
304
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/shared.ts"],"sourcesContent":["import type { ParseArgsOptionsConfig } from 'node:util';\nimport { parseArgs } from 'node:util';\nimport type { ResolvedConfig } from '../config.ts';\nimport type { OpenResult } from '../db.ts';\nimport { open } from '../db.ts';\nimport type { Row } from '../output.ts';\nimport { printRows } from '../output.ts';\nimport { searchError } from '../search-error.ts';\nimport type { Ctx } from './types.ts';\n\n// Spreadable option fragments -- one flag name keeps one meaning across every command's table.\nexport const FORMAT: ParseArgsOptionsConfig = { format: { type: 'string', default: 'table' } };\nexport const CONFIG: ParseArgsOptionsConfig = { config: { type: 'string' } };\nexport const
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/shared.ts"],"sourcesContent":["import type { ParseArgsOptionsConfig } from 'node:util';\nimport { parseArgs } from 'node:util';\nimport type { ResolvedConfig, SearchOverrides } from '../config.ts';\nimport type { OpenResult } from '../db.ts';\nimport { open } from '../db.ts';\nimport type { Row } from '../output.ts';\nimport { printRows } from '../output.ts';\nimport { searchError } from '../search-error.ts';\nimport type { Ctx } from './types.ts';\n\n// Spreadable option fragments -- one flag name keeps one meaning across every command's table.\nexport const FORMAT: ParseArgsOptionsConfig = { format: { type: 'string', default: 'table' } };\nexport const CONFIG: ParseArgsOptionsConfig = { config: { type: 'string' } };\n// The scope vocabulary every scoped command shares: named preset, ad hoc include/exclude\n// globs, a where SQL condition. search adds k on top.\nexport const SCOPE: ParseArgsOptionsConfig = {\n where: { type: 'string' },\n preset: { type: 'string' },\n include: { type: 'string', multiple: true },\n exclude: { type: 'string', multiple: true },\n // Widening, which no other flag can express: --include and --exclude each override their\n // own side of the preset, so neither can drop an exclusion the preset declares.\n 'no-exclude': { type: 'boolean', default: false },\n};\nexport const SEARCH_FLAGS: ParseArgsOptionsConfig = { ...SCOPE, k: { type: 'string' } };\n\ntype Values = Record<string, string | boolean | string[] | undefined>;\n\n// The SCOPE fragment's parsed values as the overrides every scoped command passes down. One\n// place to read them, so a new scope field is added to the fragment and here, not in each\n// command's call.\nexport function scopeOf(values: Values): SearchOverrides {\n return {\n preset: values.preset as string | undefined,\n include: values.include as string[] | undefined,\n exclude: values.exclude as string[] | undefined,\n where: values.where as string | undefined,\n noExclude: values['no-exclude'] === true,\n };\n}\n\nexport function formatOf(values: Values): 'table' | 'json' {\n return values.format === 'json' ? 'json' : 'table';\n}\n\n// Per-command parseArgs: strict (a foreign flag exits 2), and every table gets --help for free.\nexport function parse(argv: string[], usage: string, options: ParseArgsOptionsConfig): { values: Values; positionals: string[] } {\n let values: Values;\n let positionals: string[];\n try {\n ({ values, positionals } = parseArgs({\n args: argv,\n options: { ...options, help: { type: 'boolean', default: false, short: 'h' } },\n strict: true,\n allowPositionals: true,\n }));\n } catch (err) {\n console.error((err as Error).message);\n console.error(usage);\n process.exit(2);\n }\n if (values.help) {\n console.log(usage);\n process.exit(0);\n }\n return { values, positionals };\n}\n\n// --k must be a positive integer: SQLite reads a bound LIMIT of -1 as \"unlimited\" and 0 as\n// \"nothing\", and parseInt would silently truncate \"5.9\" -- all three are caller mistakes\n// worth a usage error, matching the config-level SavedSearch validation.\nexport function parseK(k: string | undefined, usageError: (message: string) => never): number | undefined {\n if (k === undefined) return undefined;\n const parsed = Number(k);\n if (!Number.isInteger(parsed) || parsed <= 0) usageError(`--k expects a positive integer, got \"${k}\"`);\n return parsed;\n}\n\n// Shared open-query-close envelope for commands that touch the tree.\n\nexport function printWarnings(warnings: string[]): void {\n for (const w of warnings) console.warn(w);\n}\n\nexport async function withDb(ctx: Ctx, configPath: string | undefined, fn: (db: OpenResult['db'], cfg: ResolvedConfig) => void | Promise<void>): Promise<void> {\n const cfg = ctx.resolveConfig(configPath);\n const { db, warnings } = open(cfg);\n printWarnings(warnings);\n try {\n await fn(db, cfg);\n } finally {\n db.close();\n }\n}\n\n// An unbound `?` silently binds NULL, so mismatched param counts fail loudly instead.\nexport function runSql(cfg: ResolvedConfig, sql: string, params: string[], format: 'table' | 'json', label: string): void {\n const placeholderCount = (sql.match(/\\?/g) ?? []).length;\n if (params.length !== placeholderCount) {\n console.error(`${label} expects ${placeholderCount} parameter(s), got ${params.length}`);\n process.exit(2);\n }\n const { db, warnings } = open(cfg);\n printWarnings(warnings);\n let rows: Row[];\n try {\n rows = db.prepare(sql).all(...params) as Row[];\n } catch (err) {\n db.close();\n // A saved query or ad-hoc SQL can carry `content MATCH ?` too, so the same FTS5\n // punctuation trap applies -- the bound parameters are the search terms there. SQL\n // without MATCH gets its error verbatim; search advice on a plain typo would mislead.\n if (/\\bMATCH\\b/i.test(sql)) throw searchError(err as Error, params.join(' '));\n throw err;\n }\n printRows(rows, format);\n db.close();\n}\n"],"names":["CONFIG","FORMAT","SCOPE","SEARCH_FLAGS","formatOf","parse","parseK","printWarnings","runSql","scopeOf","withDb","format","type","default","config","where","preset","include","multiple","exclude","k","values","noExclude","argv","usage","options","positionals","parseArgs","args","help","short","strict","allowPositionals","err","console","error","message","process","exit","log","usageError","undefined","parsed","Number","isInteger","warnings","w","warn","ctx","configPath","fn","cfg","open","db","resolveConfig","close","sql","params","label","placeholderCount","match","length","rows","prepare","all","test","searchError","join","printRows"],"mappings":"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"}
|
|
@@ -63,13 +63,13 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
63
63
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
64
64
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
65
65
|
}
|
|
66
|
-
var
|
|
67
|
-
var usage = "usage: ".concat(ctx.name, " ").concat(_indexts.USAGE.
|
|
66
|
+
var sqlCmd = function sqlCmd(ctx) {
|
|
67
|
+
var usage = "usage: ".concat(ctx.name, " ").concat(_indexts.USAGE.sql);
|
|
68
68
|
var _parse = (0, _sharedts.parse)(ctx.argv, usage, _object_spread({}, _sharedts.FORMAT, _sharedts.CONFIG)), values = _parse.values, positionals = _parse.positionals;
|
|
69
69
|
var _positionals = _to_array(positionals), sql = _positionals[0], params = _positionals.slice(1);
|
|
70
70
|
if (!sql) ctx.usageError(usage);
|
|
71
71
|
var format = (0, _sharedts.formatOf)(values);
|
|
72
|
-
(0, _sharedts.runSql)(ctx.resolveConfig(values.config), sql, params, format, 'ad-hoc
|
|
72
|
+
(0, _sharedts.runSql)(ctx.resolveConfig(values.config), sql, params, format, 'ad-hoc statement');
|
|
73
73
|
};
|
|
74
|
-
var _default =
|
|
74
|
+
var _default = sqlCmd;
|
|
75
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; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/sql.ts"],"sourcesContent":["import { USAGE } from './index.ts';\nimport { CONFIG, FORMAT, formatOf, parse, runSql } from './shared.ts';\nimport type { Command } from './types.ts';\n\nconst sqlCmd: Command = (ctx) => {\n const usage = `usage: ${ctx.name} ${USAGE.sql}`;\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 statement');\n};\nexport default sqlCmd;\n"],"names":["sqlCmd","ctx","usage","USAGE","name","sql","parse","argv","FORMAT","CONFIG","values","positionals","params","usageError","format","formatOf","runSql","resolveConfig","config"],"mappings":";;;;+BAYA;;;eAAA;;;uBAZsB;wBACkC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGxD,IAAMA,SAAkB,gBAACC;IACvB,IAAMC,QAAQ,AAAC,UAAqBC,OAAZF,IAAIG,IAAI,EAAC,KAAa,OAAVD,cAAK,CAACE,GAAG;IAC7C,IAAgCC,SAAAA,IAAAA,eAAK,EAACL,IAAIM,IAAI,EAAEL,OAAO,mBAAKM,gBAAM,EAAKC,gBAAM,IAArEC,SAAwBJ,OAAxBI,QAAQC,cAAgBL,OAAhBK;IAChB,IAAyBA,yBAAAA,cAAlBN,MAAkBM,iBAAb,AAAGC,SAAUD,mBAAb;IACZ,IAAI,CAACN,KAAKJ,IAAIY,UAAU,CAACX;IACzB,IAAMY,SAASC,IAAAA,kBAAQ,EAACL;IACxBM,IAAAA,gBAAM,EAACf,IAAIgB,aAAa,CAACP,OAAOQ,MAAM,GAAyBb,KAAKO,QAAQE,QAAQ;AACtF;IACA,WAAed"}
|
package/dist/cjs/cli/status.js
CHANGED
|
@@ -11,6 +11,7 @@ Object.defineProperty(exports, "default", {
|
|
|
11
11
|
var _commandsts = require("../commands.js");
|
|
12
12
|
var _configts = require("../config.js");
|
|
13
13
|
var _dbts = require("../db.js");
|
|
14
|
+
var _embedts = require("../features/embed.js");
|
|
14
15
|
var _outputts = require("../output.js");
|
|
15
16
|
var _indexts = require("./index.js");
|
|
16
17
|
var _sharedts = require("./shared.js");
|
|
@@ -61,6 +62,7 @@ var status = function status(ctx) {
|
|
|
61
62
|
(0, _sharedts.printWarnings)(warnings);
|
|
62
63
|
var features = (0, _configts.featureStates)(cfg);
|
|
63
64
|
var e = (0, _configts.embedConfig)(cfg);
|
|
65
|
+
var hasModel = e ? (0, _embedts.modelPresent)(cfg) : false;
|
|
64
66
|
var vectors = e ? vectorState(db) : null;
|
|
65
67
|
var presets = (0, _commandsts.presetCoverage)(db, cfg);
|
|
66
68
|
var heartbeat = (0, _dbts.getMeta)(db, 'watch_heartbeat');
|
|
@@ -75,7 +77,8 @@ var status = function status(ctx) {
|
|
|
75
77
|
featuresOff: features.off,
|
|
76
78
|
embed: e ? _object_spread({
|
|
77
79
|
type: e.type,
|
|
78
|
-
model: e.model
|
|
80
|
+
model: e.model,
|
|
81
|
+
downloaded: hasModel
|
|
79
82
|
}, vectors !== null && vectors !== void 0 ? vectors : {}) : null,
|
|
80
83
|
presets: presets,
|
|
81
84
|
watcherHeartbeatSecondsAgo: heartbeat ? Math.round((Date.now() - Date.parse(heartbeat)) / 1000) : null,
|
|
@@ -87,7 +90,11 @@ var status = function status(ctx) {
|
|
|
87
90
|
console.log("db: ".concat(result.db));
|
|
88
91
|
console.log("docs: ".concat(result.docs));
|
|
89
92
|
console.log((0, _outputts.featuresLine)(features));
|
|
90
|
-
|
|
93
|
+
// One authoritative line, off states included: an absent model reads as a degraded
|
|
94
|
+
// search, not as an empty corpus.
|
|
95
|
+
if (!e) console.log('embed: off (no preset asks for vectors)');
|
|
96
|
+
else if (!hasModel) console.log("embed: ".concat(e.type, " ").concat(e.model, " — unavailable, so search runs on words and links only (").concat((0, _embedts.isDownloadable)(e.model) ? "run `".concat(ctx.name, " download`") : "no ".concat(_embedts.MODEL_FILENAMES, " in that directory"), ")"));
|
|
97
|
+
else console.log("embed: ".concat(e.type, " ").concat(e.model).concat(vectors ? " (vectors: ".concat(vectors.embedded, " embedded, ").concat(vectors.pending, " pending — embedded on the first semantic search)") : ''));
|
|
91
98
|
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
92
99
|
try {
|
|
93
100
|
for(var _iterator = (0, _outputts.presetsLines)(presets)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/status.ts"],"sourcesContent":["import { presetCoverage } from '../commands.ts';\nimport { embedConfig, featureStates } from '../config.ts';\nimport { docCount, getMeta, open } from '../db.ts';\nimport { featuresLine, presetsLines } 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// Vectors are computed on the first semantic query, not at reconcile, so a tree can have a\n// semantic-on preset with nothing embedded yet -- reported here because a fast `rebuild` on\n// such a tree otherwise reads as \"the feature isn't on\".\nfunction vectorState(db: ReturnType<typeof open>['db']): { embedded: number; pending: number } | null {\n try {\n const row = db.prepare('SELECT COUNT(vector) AS embedded, COUNT(*) - COUNT(vector) AS pending FROM embeddings').get() as { embedded: number; pending: number };\n return row;\n } catch {\n return null;\n }\n}\n\nconst status: Command = (ctx) => {\n const { values } = parse(ctx.argv, `usage: ${ctx.name} ${USAGE.status}`, { ...FORMAT, ...CONFIG });\n const format = formatOf(values);\n const cfg = ctx.resolveConfig(values.config as string | undefined);\n const { db, dbPath, warnings } = open(cfg);\n printWarnings(warnings);\n\n const features = featureStates(cfg);\n const e = embedConfig(cfg);\n const vectors = e ? vectorState(db) : null;\n const presets = presetCoverage(db, cfg);\n const heartbeat = getMeta(db, 'watch_heartbeat');\n // Derived at open() (F): 3x the largest reconcile this cache has ever held its write\n // transaction for, floored at 30s -- read back from the connection rather than\n // recomputed here, so this always reports what open() actually set.\n const busyTimeoutMs = (db.prepare('PRAGMA busy_timeout').get() as { timeout: number }).timeout;\n const result = {\n db: dbPath,\n docs: docCount(db),\n features: features.on,\n featuresOff: features.off,\n embed: e ? { type: e.type, model: e.model, ...(vectors ?? {}) } : null,\n presets,\n watcherHeartbeatSecondsAgo: heartbeat ? Math.round((Date.now() - Date.parse(heartbeat)) / 1000) : null,\n busyTimeoutMs,\n };\n\n if (format === 'json') {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`db: ${result.db}`);\n console.log(`docs: ${result.docs}`);\n console.log(featuresLine(features));\n if (e) console.log(`embed: ${e.type} ${e.model}${vectors ? ` (vectors: ${vectors.embedded} embedded, ${vectors.pending} pending — embedded on the first semantic search)` : ''}`);\n for (const line of presetsLines(presets)) console.log(line);\n console.log(result.watcherHeartbeatSecondsAgo === null ? 'watcher: no watcher' : `watcher: last heartbeat ${result.watcherHeartbeatSecondsAgo}s ago`);\n console.log(`busy_timeout: ${result.busyTimeoutMs}ms (derived: 3x the largest reconcile this cache has recorded, floored at 30000ms)`);\n }\n db.close();\n};\nexport default status;\n"],"names":["vectorState","db","row","prepare","get","status","ctx","values","parse","argv","USAGE","name","FORMAT","CONFIG","format","formatOf","cfg","resolveConfig","config","open","dbPath","warnings","printWarnings","features","featureStates","e","embedConfig","vectors","presets","presetCoverage","heartbeat","getMeta","busyTimeoutMs","timeout","result","docs","docCount","on","featuresOff","off","embed","type","model","watcherHeartbeatSecondsAgo","Math","round","Date","now","console","log","JSON","stringify","featuresLine","embedded","pending","presetsLines","line","close"],"mappings":";;;;+
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/status.ts"],"sourcesContent":["import { presetCoverage } from '../commands.ts';\nimport { embedConfig, featureStates } from '../config.ts';\nimport { docCount, getMeta, open } from '../db.ts';\nimport { isDownloadable, MODEL_FILENAMES, modelPresent } from '../features/embed.ts';\nimport { featuresLine, presetsLines } 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// Vectors are computed on the first semantic query, not at reconcile, so a tree can have a\n// semantic-on preset with nothing embedded yet -- reported here because a fast `rebuild` on\n// such a tree otherwise reads as \"the feature isn't on\".\nfunction vectorState(db: ReturnType<typeof open>['db']): { embedded: number; pending: number } | null {\n try {\n const row = db.prepare('SELECT COUNT(vector) AS embedded, COUNT(*) - COUNT(vector) AS pending FROM embeddings').get() as { embedded: number; pending: number };\n return row;\n } catch {\n return null;\n }\n}\n\nconst status: Command = (ctx) => {\n const { values } = parse(ctx.argv, `usage: ${ctx.name} ${USAGE.status}`, { ...FORMAT, ...CONFIG });\n const format = formatOf(values);\n const cfg = ctx.resolveConfig(values.config as string | undefined);\n const { db, dbPath, warnings } = open(cfg);\n printWarnings(warnings);\n\n const features = featureStates(cfg);\n const e = embedConfig(cfg);\n const hasModel = e ? modelPresent(cfg) : false;\n const vectors = e ? vectorState(db) : null;\n const presets = presetCoverage(db, cfg);\n const heartbeat = getMeta(db, 'watch_heartbeat');\n // Derived at open() (F): 3x the largest reconcile this cache has ever held its write\n // transaction for, floored at 30s -- read back from the connection rather than\n // recomputed here, so this always reports what open() actually set.\n const busyTimeoutMs = (db.prepare('PRAGMA busy_timeout').get() as { timeout: number }).timeout;\n const result = {\n db: dbPath,\n docs: docCount(db),\n features: features.on,\n featuresOff: features.off,\n embed: e ? { type: e.type, model: e.model, downloaded: hasModel, ...(vectors ?? {}) } : null,\n presets,\n watcherHeartbeatSecondsAgo: heartbeat ? Math.round((Date.now() - Date.parse(heartbeat)) / 1000) : null,\n busyTimeoutMs,\n };\n\n if (format === 'json') {\n console.log(JSON.stringify(result, null, 2));\n } else {\n console.log(`db: ${result.db}`);\n console.log(`docs: ${result.docs}`);\n console.log(featuresLine(features));\n // One authoritative line, off states included: an absent model reads as a degraded\n // search, not as an empty corpus.\n if (!e) console.log('embed: off (no preset asks for vectors)');\n else if (!hasModel) console.log(`embed: ${e.type} ${e.model} — unavailable, so search runs on words and links only (${isDownloadable(e.model) ? `run \\`${ctx.name} download\\`` : `no ${MODEL_FILENAMES} in that directory`})`);\n else console.log(`embed: ${e.type} ${e.model}${vectors ? ` (vectors: ${vectors.embedded} embedded, ${vectors.pending} pending — embedded on the first semantic search)` : ''}`);\n for (const line of presetsLines(presets)) console.log(line);\n console.log(result.watcherHeartbeatSecondsAgo === null ? 'watcher: no watcher' : `watcher: last heartbeat ${result.watcherHeartbeatSecondsAgo}s ago`);\n console.log(`busy_timeout: ${result.busyTimeoutMs}ms (derived: 3x the largest reconcile this cache has recorded, floored at 30000ms)`);\n }\n db.close();\n};\nexport default status;\n"],"names":["vectorState","db","row","prepare","get","status","ctx","values","parse","argv","USAGE","name","FORMAT","CONFIG","format","formatOf","cfg","resolveConfig","config","open","dbPath","warnings","printWarnings","features","featureStates","e","embedConfig","hasModel","modelPresent","vectors","presets","presetCoverage","heartbeat","getMeta","busyTimeoutMs","timeout","result","docs","docCount","on","featuresOff","off","embed","type","model","downloaded","watcherHeartbeatSecondsAgo","Math","round","Date","now","console","log","JSON","stringify","featuresLine","isDownloadable","MODEL_FILENAMES","embedded","pending","presetsLines","line","close"],"mappings":"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"}
|
package/dist/cjs/cli.js
CHANGED
|
@@ -100,10 +100,6 @@ function _non_iterable_spread() {
|
|
|
100
100
|
function _to_consumable_array(arr) {
|
|
101
101
|
return _array_without_holes(arr) || _iterable_to_array(arr) || _unsupported_iterable_to_array(arr) || _non_iterable_spread();
|
|
102
102
|
}
|
|
103
|
-
function _type_of(obj) {
|
|
104
|
-
"@swc/helpers - typeof";
|
|
105
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
106
|
-
}
|
|
107
103
|
function _unsupported_iterable_to_array(o, minLen) {
|
|
108
104
|
if (!o) return;
|
|
109
105
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
@@ -211,10 +207,8 @@ function _ts_generator(thisArg, body) {
|
|
|
211
207
|
};
|
|
212
208
|
}
|
|
213
209
|
}
|
|
214
|
-
// Parsing and dispatch only
|
|
215
|
-
//
|
|
216
|
-
// per command (each command's own parse() call); this file only handles the bare top-level
|
|
217
|
-
// flags (--version/--help/--list/--config) and dispatch.
|
|
210
|
+
// Parsing and dispatch only; commands lazy-load from src/cli/, so nothing heavy is imported
|
|
211
|
+
// here. Flags parse per command -- this file handles only --version/--help/--list/--config.
|
|
218
212
|
// Works from dist/cjs and dist/esm alike: walk up past the dist type-marker package.json.
|
|
219
213
|
function packageVersion() {
|
|
220
214
|
var load = (0, _nodemodule.createRequire)(require("url").pathToFileURL(__filename).toString());
|
|
@@ -254,7 +248,7 @@ function resolveConfigFor(name, configPath) {
|
|
|
254
248
|
}
|
|
255
249
|
function cli(argv, name) {
|
|
256
250
|
return _async_to_generator(function() {
|
|
257
|
-
var first, values, queries, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, queryName,
|
|
251
|
+
var first, values, queries, _iteratorNormalCompletion, _didIteratorError, _iteratorError, _iterator, _step, queryName, RENAMED, ctx, load, err;
|
|
258
252
|
return _ts_generator(this, function(_state) {
|
|
259
253
|
switch(_state.label){
|
|
260
254
|
case 0:
|
|
@@ -310,9 +304,9 @@ function cli(argv, name) {
|
|
|
310
304
|
try {
|
|
311
305
|
for(_iterator = Object.keys(queries).sort()[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
312
306
|
queryName = _step.value;
|
|
313
|
-
entry
|
|
314
|
-
|
|
315
|
-
console.log(
|
|
307
|
+
// Every entry names its verb, so --list can label both kinds rather than only
|
|
308
|
+
// marking the exception.
|
|
309
|
+
console.log("".concat(queryName, " (").concat('search' in queries[queryName] ? 'search' : 'sql', ")"));
|
|
316
310
|
}
|
|
317
311
|
} catch (err) {
|
|
318
312
|
_didIteratorError = true;
|
|
@@ -339,9 +333,14 @@ function cli(argv, name) {
|
|
|
339
333
|
console.error(usage(name));
|
|
340
334
|
process.exit(2);
|
|
341
335
|
}
|
|
342
|
-
//
|
|
343
|
-
|
|
344
|
-
|
|
336
|
+
// Breaking renames get one release of a pointer instead of an "unknown" error: find ->
|
|
337
|
+
// search, and query -> sql (which took its name back from the search sense of "query").
|
|
338
|
+
RENAMED = {
|
|
339
|
+
find: 'search',
|
|
340
|
+
query: 'sql'
|
|
341
|
+
};
|
|
342
|
+
if (RENAMED[first]) {
|
|
343
|
+
console.error("".concat(name, ": ").concat(first, " is now ").concat(RENAMED[first]));
|
|
345
344
|
console.error(usage(name));
|
|
346
345
|
process.exit(2);
|
|
347
346
|
}
|