sensemaking 0.9.5 → 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 +24 -18
- 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 +7 -3
- package/schema.json +12 -16
- package/skills/sense/EXAMPLES.md +8 -8
- package/skills/sense/SKILL.md +41 -19
- package/skills/sense-setup/EXAMPLES.md +24 -21
- package/skills/sense-setup/SKILL.md +9 -9
- 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
package/README.md
CHANGED
|
@@ -13,15 +13,16 @@ Markdown notes accumulate: research, decisions, meeting notes, agent output. Pas
|
|
|
13
13
|
```bash
|
|
14
14
|
npm install -g sensemaking
|
|
15
15
|
cd your-notes && sense init
|
|
16
|
+
sense download # the embedding model, once per machine; nothing fetches it implicitly
|
|
16
17
|
```
|
|
17
18
|
|
|
18
|
-
Needs Node 22.
|
|
19
|
+
Needs Node 22.20 or newer: the first release whose built-in SQLite has both FTS5, which `sense search` indexes prose with, and row-returning `INSERT ... RETURNING`, which `sense path` and `peek` walk the link graph with.
|
|
19
20
|
|
|
20
21
|
```bash
|
|
21
22
|
sense map # orient: fields, hub notes, recent changes
|
|
22
23
|
sense search "revenue OR earnings" --k 10 # locate: words + links + meaning, one ranked list
|
|
23
24
|
sense peek notes/q3-report.md # structure: outline + links, before reading
|
|
24
|
-
sense
|
|
25
|
+
sense sql "SELECT path FROM frontmatter WHERE has(tags, ?)" urgent
|
|
25
26
|
```
|
|
26
27
|
|
|
27
28
|
## Model
|
|
@@ -37,7 +38,7 @@ Every file becomes rows in these tables, plus whatever an enabled feature adds o
|
|
|
37
38
|
|
|
38
39
|
Results are references (path, title, summary, excerpt), never file contents. Reading happens afterward through the filesystem, scoped to the line ranges `peek` returns. This is the [just-in-time context pattern](https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents): the agent holds lightweight identifiers and loads payloads only when needed.
|
|
39
40
|
|
|
40
|
-
Output size is a contract, measured per release ([BENCHMARKING.md](BENCHMARKING.md)): `map` is fixed-size, a `
|
|
41
|
+
Output size is a contract, measured per release ([BENCHMARKING.md](BENCHMARKING.md)): `map` is fixed-size, a `search` row is tens of tokens, and a `peek` stays flat however large the note is. What it saves over reading grows with the file; a small note is cheaper to read whole.
|
|
41
42
|
|
|
42
43
|
```sql
|
|
43
44
|
-- filter and search compose in one query
|
|
@@ -52,17 +53,20 @@ ORDER BY bm25(content, 10.0, 5.0, 1.0) LIMIT 10
|
|
|
52
53
|
| command | does |
|
|
53
54
|
|---|---|
|
|
54
55
|
| `map` | doc count, frontmatter field coverage, top hubs by link rank, recent changes |
|
|
55
|
-
| `search "<text>" [--preset name] [--include glob] [--where "<sql>"] [--k n]
|
|
56
|
-
| `peek <path
|
|
57
|
-
| `
|
|
56
|
+
| `search "<text>" [--preset name] [--include glob] [--exclude glob] [--no-exclude] [--where "<sql>"] [--k n]` | words + links + vectors, one fused ranked list; `via` labels each row's evidence |
|
|
57
|
+
| `peek <path> [--preset name] [--where "<sql>"]` | frontmatter + heading outline (`[L143-162, ~380t]`) + links both ways (first 20 per list, each with its total) |
|
|
58
|
+
| `path <a> <b> [--max-depth n] [--preset name] [--where "<sql>"]` | shortest link chain between two notes, or none within the bound |
|
|
59
|
+
| `related <note> [--k n] [--preset name] [--where "<sql>"]` | notes similar in meaning that `<note>` does not yet link to; reads vectors, so semantic-search cost |
|
|
60
|
+
| `sql "<statement>" [params...]` | ad-hoc SQL over all the tables; `?` binds positional args |
|
|
58
61
|
| `<name> [params...]` | run a query saved in the config; `--list` names them |
|
|
59
62
|
| `init` | write a starter `sense.config.json` |
|
|
60
63
|
| `status` | index location, doc count, per-preset coverage, watcher heartbeat |
|
|
61
|
-
| `check` | run every saved query
|
|
64
|
+
| `check` | run every saved query, so a broken one fails here instead of mid-task |
|
|
62
65
|
| `rebuild` | delete the cache and re-crawl |
|
|
66
|
+
| `download` | fetch the embedding model named in the config (once per machine; nothing else downloads it) |
|
|
63
67
|
| `watch` | keep the index warm in the background (optional; see [WATCH.md](WATCH.md)) |
|
|
64
68
|
|
|
65
|
-
`search` runs one text through every engine its scope has: FTS5 word match (BM25-ranked, bare words AND-join, operators are yours), a personalized-PageRank walk over the link graph, and vector similarity, fused into one list. `via` labels each row's evidence (`match`, `link`, `vector`, combinations); `similarity` is the cosine against the best-matching chunk; `lines` points at the section that earned the row (a direct read range). A `vector`-only row means the search words don't appear in that note; it showed up because the model judged it semantically related. `--preset` picks a named settings bundle from the config, `--
|
|
69
|
+
`search` runs one text through every engine its scope has: FTS5 word match (BM25-ranked, bare words AND-join, operators are yours), a personalized-PageRank walk over the link graph, and vector similarity, fused into one list. `via` labels each row's evidence (`match`, `link`, `vector`, combinations); `similarity` is the cosine against the best-matching chunk; `lines` points at the section that earned the row (a direct read range). A `vector`-only row means the search words don't appear in that note; it showed up because the model judged it semantically related. `--preset` picks a named settings bundle from the config, `--where` filters on frontmatter. `--format json` on any reporting command returns structured output; `--version` and `--help` do what they say.
|
|
66
70
|
|
|
67
71
|
## Config
|
|
68
72
|
|
|
@@ -71,28 +75,30 @@ ORDER BY bm25(content, 10.0, 5.0, 1.0) LIMIT 10
|
|
|
71
75
|
```json
|
|
72
76
|
{
|
|
73
77
|
"$schema": "https://unpkg.com/sensemaking/schema.json",
|
|
74
|
-
"version":
|
|
78
|
+
"version": 4,
|
|
75
79
|
"presets": {
|
|
76
80
|
"default": { "include": ["**/*.md"], "k": 10 },
|
|
77
|
-
"raw": { "include": ["raw/**/*.md"], "k": 5
|
|
81
|
+
"raw": { "include": ["raw/**/*.md"], "k": 5 }
|
|
78
82
|
},
|
|
83
|
+
"embed": { "model": "minishlab/potion-retrieval-32M", "type": "static" },
|
|
79
84
|
"queries": {
|
|
80
|
-
"dead-links": "SELECT src, target FROM links WHERE dst IS NULL",
|
|
81
|
-
"by-tag": "SELECT path, title FROM frontmatter WHERE has(tags, ?) ORDER BY path",
|
|
82
|
-
"hot":
|
|
85
|
+
"dead-links": { "sql": "SELECT src, target FROM links WHERE dst IS NULL" },
|
|
86
|
+
"by-tag": { "sql": "SELECT path, title FROM frontmatter WHERE has(tags, ?) ORDER BY path" },
|
|
87
|
+
"hot": { "search": "pricing OR billing", "preset": "raw" }
|
|
83
88
|
}
|
|
84
89
|
}
|
|
85
90
|
```
|
|
86
91
|
|
|
87
92
|
| key | holds |
|
|
88
93
|
|---|---|
|
|
89
|
-
| `presets` | named bundles of `include`/`exclude` globs, `k` (result count), `semantic` (vectors, on unless `false`), `where` (a standing SQL filter). A file is indexed if any preset includes it, embedded if
|
|
90
|
-
| `
|
|
94
|
+
| `presets` | named bundles of `include`/`exclude` globs, `k` (result count), `semantic` (vectors for this scope, on unless `false`), `where` (a standing SQL filter). A file is indexed if any preset includes it, embedded if a model is named and some covering preset has `semantic` on; `status` shows each preset's coverage. |
|
|
95
|
+
| `embed` | the model vectors are built with. Naming one gives the tree vectors; omitting the block means none at all, whatever the presets say. `sense download` fetches it. |
|
|
96
|
+
| `queries` | entries runnable as `sense <name>`, each naming the verb it runs: `{ sql }` for SQL (`?` binds positional args) or `{ search }` for a ranked search with its settings baked in, so `sense hot` needs no flags. `sense check` runs them all, so a typo'd column fails at check time instead of mid-task. |
|
|
91
97
|
| `version` | schema version; older configs auto-migrate on load, noted on stderr. |
|
|
92
98
|
|
|
93
99
|
Bare commands use the `default` preset; `--preset` names another; flags override single fields. Editing a preset rebuilds the cache and says which preset caused it.
|
|
94
100
|
|
|
95
|
-
Vectors
|
|
101
|
+
Vectors need a model, and nothing downloads it implicitly: `sense download` fetches it once per machine into `$XDG_CACHE_HOME/sensemaking/models` (or `~/.cache/...`), one directory per model, shared by every tree (124 MB, never in the package). `embed.model` is a Hugging Face id, or a path to a directory holding `model.safetensors` and `tokenizer.json`, which `sense download` leaves to you to populate. A preset that asks for vectors without the model is an error naming `sense download`, rather than a quieter result that would make the same search answer differently before and after; a `semantic: false` preset never asks, so it is unaffected. An optional top-level `"embed": { "model", "type", "url", "key" }` block points at any Model2Vec model, local path, or OpenAI-compatible endpoint (Ollama, LM Studio, hosted). Embedding the notes themselves happens on the first semantic search, with progress.
|
|
96
102
|
|
|
97
103
|
`has(field, value)` is the one custom SQL function: array membership on JSON-array fields, substring on strings, false on missing keys. Frontmatter parsing is lenient: syntax errors are per-file warnings, and the values are still indexed, so one bad note never costs you the crawl.
|
|
98
104
|
|
|
@@ -117,7 +123,7 @@ Two skills: `sense` for querying a tree (what each command is for, FTS5 syntax,
|
|
|
117
123
|
## Prior art
|
|
118
124
|
|
|
119
125
|
- [Effective context engineering for AI agents](https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents) (Anthropic): agents should hold lightweight identifiers (file paths, links) and load payloads just in time, because context is a finite resource. The commands implement that pattern as a CLI.
|
|
120
|
-
- [llm-wiki](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f) (Karpathy): an agent-maintained wiki navigated by an `index.md` and links, which he notes needs real search infrastructure past a few hundred pages. `sense map` derives that index from the notes instead of maintaining it; `
|
|
126
|
+
- [llm-wiki](https://gist.github.com/karpathy/442a6bf555914893e9891c11519de94f) (Karpathy): an agent-maintained wiki navigated by an `index.md` and links, which he notes needs real search infrastructure past a few hundred pages. `sense map` derives that index from the notes instead of maintaining it; `sense search` is the hybrid local search it calls for.
|
|
121
127
|
- Agent memory patterns (llm-wiki's raw/wiki split, Claude Code's dreaming-style nightly consolidation) are trees of small notes with metadata, links, and layers of differing authority. sense is the query layer such patterns need: filter by metadata and age, scope by layer, surface near-duplicates semantically. It isn't an implementation of any one of them.
|
|
122
128
|
|
|
123
129
|
## Alternatives
|
|
@@ -130,7 +136,7 @@ Two skills: `sense` for querying a tree (what each command is for, FTS5 syntax,
|
|
|
130
136
|
- **RAG / vector stores:** similarity can't express `WHERE status = 'active'`. Here vectors are one signal inside `search`: same SQLite file, filters compose, every row labels its evidence (`via`), and a preset turns vectors off per layer of the tree. No second store, no daemon, no native builds.
|
|
131
137
|
- **Document-OS apps (Anytype, Logseq, SilverBullet, Capacities):** full applications with their own UI and storage. `sense` is headless: your files stay files, there's no app to run.
|
|
132
138
|
|
|
133
|
-
Dependencies: [yaml](https://github.com/eemeli/yaml), [remove-markdown](https://github.com/zuchka/remove-markdown), [
|
|
139
|
+
Dependencies: [yaml](https://github.com/eemeli/yaml), [remove-markdown](https://github.com/zuchka/remove-markdown), [@huggingface/tokenizers](https://github.com/huggingface/tokenizers.js) (pure JS), and Node's built-in SQLite. No native builds.
|
|
134
140
|
|
|
135
141
|
## License
|
|
136
142
|
|
package/dist/cjs/cli/check.js
CHANGED
|
@@ -219,16 +219,9 @@ function _ts_generator(thisArg, body) {
|
|
|
219
219
|
};
|
|
220
220
|
}
|
|
221
221
|
}
|
|
222
|
-
// A
|
|
223
|
-
//
|
|
224
|
-
//
|
|
225
|
-
// unknown-column errors without executing it; queries that take no parameters are also run
|
|
226
|
-
// for a row count. Parameterised queries are validated but not counted: inventing arguments
|
|
227
|
-
// would report a count for a query nobody ran. Saved searches run lexically with k=1 -- that
|
|
228
|
-
// validates the `where` fragment, the FTS5 terms, and the `preset` name (resolveSearch throws
|
|
229
|
-
// on an unknown one, the same breakage class prepare() catches for SQL strings) -- but never
|
|
230
|
-
// semantically (a semantic pass costs model time and, on api trees, network). Whether a
|
|
231
|
-
// result being empty is good or bad is the reader's judgment -- there is no assertion path.
|
|
222
|
+
// A broken query and an empty one look identical, so prepare each to catch syntax and column
|
|
223
|
+
// errors. Parameterised ones are not run (inventing arguments would report a bogus count);
|
|
224
|
+
// searches probe at k=1 without vectors. Empty results are the reader's judgment, not a fail.
|
|
232
225
|
var check = function check(ctx) {
|
|
233
226
|
return _async_to_generator(function() {
|
|
234
227
|
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;
|
|
@@ -278,7 +271,8 @@ var check = function check(ctx) {
|
|
|
278
271
|
where: entry.where,
|
|
279
272
|
preset: entry.preset,
|
|
280
273
|
include: entry.include,
|
|
281
|
-
|
|
274
|
+
exclude: entry.exclude,
|
|
275
|
+
probe: true
|
|
282
276
|
})
|
|
283
277
|
];
|
|
284
278
|
case 4:
|
|
@@ -287,7 +281,7 @@ var check = function check(ctx) {
|
|
|
287
281
|
query: name,
|
|
288
282
|
params: '—',
|
|
289
283
|
rows: '—',
|
|
290
|
-
status: count === 0 ? 'ok, but matches 0 notes (
|
|
284
|
+
status: count === 0 ? 'ok, but matches 0 notes (words and links only)' : 'ok (probe run with k=1)'
|
|
291
285
|
});
|
|
292
286
|
return [
|
|
293
287
|
3,
|
|
@@ -312,7 +306,7 @@ var check = function check(ctx) {
|
|
|
312
306
|
8
|
|
313
307
|
];
|
|
314
308
|
case 7:
|
|
315
|
-
sql =
|
|
309
|
+
sql = entry.sql;
|
|
316
310
|
params = ((_sql_match = sql.match(/\?/g)) !== null && _sql_match !== void 0 ? _sql_match : []).length;
|
|
317
311
|
try {
|
|
318
312
|
statement = db.prepare(sql);
|
|
@@ -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 { USAGE } from './index.ts';\nimport { CONFIG, FORMAT, formatOf, parse, printWarnings } from './shared.ts';\nimport type { Command } from './types.ts';\n\n// A
|
|
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 broken query and an empty one look identical, so prepare each to catch syntax and column\n// errors. Parameterised ones are not run (inventing arguments would report a bogus count);\n// searches probe at k=1 without vectors. Empty results are the reader's judgment, not a fail.\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, exclude: entry.exclude, probe: true })).length;\n rows.push({ query: name, params: '—', rows: '—', status: count === 0 ? 'ok, but matches 0 notes (words and links only)' : '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 = 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","exclude","probe","length","push","query","status","message","match","prepare","all","close","console","log","printRows","process","exit"],"mappings":"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"}
|
|
@@ -0,0 +1,214 @@
|
|
|
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 _configts = require("../config.js");
|
|
12
|
+
var _errorsts = require("../errors.js");
|
|
13
|
+
var _embedts = require("../features/embed.js");
|
|
14
|
+
var _indexts = require("./index.js");
|
|
15
|
+
var _sharedts = require("./shared.js");
|
|
16
|
+
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
17
|
+
try {
|
|
18
|
+
var info = gen[key](arg);
|
|
19
|
+
var value = info.value;
|
|
20
|
+
} catch (error) {
|
|
21
|
+
reject(error);
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
if (info.done) {
|
|
25
|
+
resolve(value);
|
|
26
|
+
} else {
|
|
27
|
+
Promise.resolve(value).then(_next, _throw);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
function _async_to_generator(fn) {
|
|
31
|
+
return function() {
|
|
32
|
+
var self = this, args = arguments;
|
|
33
|
+
return new Promise(function(resolve, reject) {
|
|
34
|
+
var gen = fn.apply(self, args);
|
|
35
|
+
function _next(value) {
|
|
36
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value);
|
|
37
|
+
}
|
|
38
|
+
function _throw(err) {
|
|
39
|
+
asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err);
|
|
40
|
+
}
|
|
41
|
+
_next(undefined);
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
function _define_property(obj, key, value) {
|
|
46
|
+
if (key in obj) {
|
|
47
|
+
Object.defineProperty(obj, key, {
|
|
48
|
+
value: value,
|
|
49
|
+
enumerable: true,
|
|
50
|
+
configurable: true,
|
|
51
|
+
writable: true
|
|
52
|
+
});
|
|
53
|
+
} else {
|
|
54
|
+
obj[key] = value;
|
|
55
|
+
}
|
|
56
|
+
return obj;
|
|
57
|
+
}
|
|
58
|
+
function _object_spread(target) {
|
|
59
|
+
for(var i = 1; i < arguments.length; i++){
|
|
60
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
61
|
+
var ownKeys = Object.keys(source);
|
|
62
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
63
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
64
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
65
|
+
}));
|
|
66
|
+
}
|
|
67
|
+
ownKeys.forEach(function(key) {
|
|
68
|
+
_define_property(target, key, source[key]);
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
return target;
|
|
72
|
+
}
|
|
73
|
+
function _ts_generator(thisArg, body) {
|
|
74
|
+
var f, y, t, _ = {
|
|
75
|
+
label: 0,
|
|
76
|
+
sent: function() {
|
|
77
|
+
if (t[0] & 1) throw t[1];
|
|
78
|
+
return t[1];
|
|
79
|
+
},
|
|
80
|
+
trys: [],
|
|
81
|
+
ops: []
|
|
82
|
+
}, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype), d = Object.defineProperty;
|
|
83
|
+
return d(g, "next", {
|
|
84
|
+
value: verb(0)
|
|
85
|
+
}), d(g, "throw", {
|
|
86
|
+
value: verb(1)
|
|
87
|
+
}), d(g, "return", {
|
|
88
|
+
value: verb(2)
|
|
89
|
+
}), typeof Symbol === "function" && d(g, Symbol.iterator, {
|
|
90
|
+
value: function() {
|
|
91
|
+
return this;
|
|
92
|
+
}
|
|
93
|
+
}), g;
|
|
94
|
+
function verb(n) {
|
|
95
|
+
return function(v) {
|
|
96
|
+
return step([
|
|
97
|
+
n,
|
|
98
|
+
v
|
|
99
|
+
]);
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
function step(op) {
|
|
103
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
104
|
+
while(g && (g = 0, op[0] && (_ = 0)), _)try {
|
|
105
|
+
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;
|
|
106
|
+
if (y = 0, t) op = [
|
|
107
|
+
op[0] & 2,
|
|
108
|
+
t.value
|
|
109
|
+
];
|
|
110
|
+
switch(op[0]){
|
|
111
|
+
case 0:
|
|
112
|
+
case 1:
|
|
113
|
+
t = op;
|
|
114
|
+
break;
|
|
115
|
+
case 4:
|
|
116
|
+
_.label++;
|
|
117
|
+
return {
|
|
118
|
+
value: op[1],
|
|
119
|
+
done: false
|
|
120
|
+
};
|
|
121
|
+
case 5:
|
|
122
|
+
_.label++;
|
|
123
|
+
y = op[1];
|
|
124
|
+
op = [
|
|
125
|
+
0
|
|
126
|
+
];
|
|
127
|
+
continue;
|
|
128
|
+
case 7:
|
|
129
|
+
op = _.ops.pop();
|
|
130
|
+
_.trys.pop();
|
|
131
|
+
continue;
|
|
132
|
+
default:
|
|
133
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) {
|
|
134
|
+
_ = 0;
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
if (op[0] === 3 && (!t || op[1] > t[0] && op[1] < t[3])) {
|
|
138
|
+
_.label = op[1];
|
|
139
|
+
break;
|
|
140
|
+
}
|
|
141
|
+
if (op[0] === 6 && _.label < t[1]) {
|
|
142
|
+
_.label = t[1];
|
|
143
|
+
t = op;
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
if (t && _.label < t[2]) {
|
|
147
|
+
_.label = t[2];
|
|
148
|
+
_.ops.push(op);
|
|
149
|
+
break;
|
|
150
|
+
}
|
|
151
|
+
if (t[2]) _.ops.pop();
|
|
152
|
+
_.trys.pop();
|
|
153
|
+
continue;
|
|
154
|
+
}
|
|
155
|
+
op = body.call(thisArg, _);
|
|
156
|
+
} catch (e) {
|
|
157
|
+
op = [
|
|
158
|
+
6,
|
|
159
|
+
e
|
|
160
|
+
];
|
|
161
|
+
y = 0;
|
|
162
|
+
} finally{
|
|
163
|
+
f = t = 0;
|
|
164
|
+
}
|
|
165
|
+
if (op[0] & 5) throw op[1];
|
|
166
|
+
return {
|
|
167
|
+
value: op[0] ? op[1] : void 0,
|
|
168
|
+
done: true
|
|
169
|
+
};
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
// The one command that fetches weights. Nothing else touches the network for them, so a
|
|
173
|
+
// query that reads like a query never spends minutes pulling 124 MB. Asks nothing, so there
|
|
174
|
+
// is no prompt for CI to bypass; running it twice is a no-op.
|
|
175
|
+
var download = function download(ctx) {
|
|
176
|
+
return _async_to_generator(function() {
|
|
177
|
+
var values, cfg, e, dir;
|
|
178
|
+
return _ts_generator(this, function(_state) {
|
|
179
|
+
switch(_state.label){
|
|
180
|
+
case 0:
|
|
181
|
+
values = (0, _sharedts.parse)(ctx.argv, "usage: ".concat(ctx.name, " ").concat(_indexts.USAGE.download), _object_spread({}, _sharedts.CONFIG)).values;
|
|
182
|
+
cfg = ctx.resolveConfig(values.config);
|
|
183
|
+
e = (0, _configts.embedConfig)(cfg);
|
|
184
|
+
if (!e) throw new _errorsts.SenseError('EMBED_DISABLED', 'no preset asks for vectors, so there is no model to download');
|
|
185
|
+
if (e.type === 'api') {
|
|
186
|
+
console.log('embed type is "api" ('.concat(e.url, "), so there is nothing to download; ").concat(ctx.name, " search reaches it over the network"));
|
|
187
|
+
return [
|
|
188
|
+
2
|
|
189
|
+
];
|
|
190
|
+
}
|
|
191
|
+
if ((0, _embedts.modelPresent)(cfg)) {
|
|
192
|
+
console.log("".concat(e.model, " is already available in ").concat((0, _embedts.modelDir)(e.model)));
|
|
193
|
+
return [
|
|
194
|
+
2
|
|
195
|
+
];
|
|
196
|
+
}
|
|
197
|
+
return [
|
|
198
|
+
4,
|
|
199
|
+
(0, _embedts.downloadModel)(e.model, function(file, into) {
|
|
200
|
+
return console.error("fetching ".concat(e.model, "/").concat(file, " into ").concat(into));
|
|
201
|
+
})
|
|
202
|
+
];
|
|
203
|
+
case 1:
|
|
204
|
+
dir = _state.sent();
|
|
205
|
+
console.log("downloaded ".concat(e.model, " into ").concat(dir));
|
|
206
|
+
return [
|
|
207
|
+
2
|
|
208
|
+
];
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
})();
|
|
212
|
+
};
|
|
213
|
+
var _default = download;
|
|
214
|
+
/* 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/download.ts"],"sourcesContent":["import { embedConfig } from '../config.ts';\nimport { SenseError } from '../errors.ts';\nimport { downloadModel, modelDir, modelPresent } from '../features/embed.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, parse } from './shared.ts';\nimport type { Command } from './types.ts';\n\n// The one command that fetches weights. Nothing else touches the network for them, so a\n// query that reads like a query never spends minutes pulling 124 MB. Asks nothing, so there\n// is no prompt for CI to bypass; running it twice is a no-op.\nconst download: Command = async (ctx) => {\n const { values } = parse(ctx.argv, `usage: ${ctx.name} ${USAGE.download}`, { ...CONFIG });\n const cfg = ctx.resolveConfig(values.config as string | undefined);\n const e = embedConfig(cfg);\n if (!e) throw new SenseError('EMBED_DISABLED', 'no preset asks for vectors, so there is no model to download');\n\n if (e.type === 'api') {\n console.log(`embed type is \"api\" (${e.url}), so there is nothing to download; ${ctx.name} search reaches it over the network`);\n return;\n }\n if (modelPresent(cfg)) {\n console.log(`${e.model} is already available in ${modelDir(e.model)}`);\n return;\n }\n const dir = await downloadModel(e.model, (file, into) => console.error(`fetching ${e.model}/${file} into ${into}`));\n console.log(`downloaded ${e.model} into ${dir}`);\n};\nexport default download;\n"],"names":["download","ctx","values","cfg","e","dir","parse","argv","USAGE","name","CONFIG","resolveConfig","config","embedConfig","SenseError","type","console","log","url","modelPresent","modelDir","model","downloadModel","file","into","error"],"mappings":";;;;+BA2BA;;;eAAA;;;wBA3B4B;wBACD;uBAC2B;uBAChC;wBACQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG9B,wFAAwF;AACxF,4FAA4F;AAC5F,8DAA8D;AAC9D,IAAMA,WAAoB,kBAAOC;;YACvBC,QACFC,KACAC,GAWAC;;;;oBAbEH,SAAWI,IAAAA,eAAK,EAACL,IAAIM,IAAI,EAAE,AAAC,UAAqBC,OAAZP,IAAIQ,IAAI,EAAC,KAAkB,OAAfD,cAAK,CAACR,QAAQ,GAAI,mBAAKU,gBAAM,GAA9ER;oBACFC,MAAMF,IAAIU,aAAa,CAACT,OAAOU,MAAM;oBACrCR,IAAIS,IAAAA,qBAAW,EAACV;oBACtB,IAAI,CAACC,GAAG,MAAM,IAAIU,oBAAU,CAAC,kBAAkB;oBAE/C,IAAIV,EAAEW,IAAI,KAAK,OAAO;wBACpBC,QAAQC,GAAG,CAAC,AAAC,wBAAmEhB,OAA5CG,EAAEc,GAAG,EAAC,wCAA+C,OAATjB,IAAIQ,IAAI,EAAC;wBACzF;;;oBACF;oBACA,IAAIU,IAAAA,qBAAY,EAAChB,MAAM;wBACrBa,QAAQC,GAAG,CAAC,AAAC,GAAqCG,OAAnChB,EAAEiB,KAAK,EAAC,6BAA6C,OAAlBD,IAAAA,iBAAQ,EAAChB,EAAEiB,KAAK;wBAClE;;;oBACF;oBACY;;wBAAMC,IAAAA,sBAAa,EAAClB,EAAEiB,KAAK,EAAE,SAACE,MAAMC;mCAASR,QAAQS,KAAK,CAAC,AAAC,YAAsBF,OAAXnB,EAAEiB,KAAK,EAAC,KAAgBG,OAAbD,MAAK,UAAa,OAALC;;;;oBAArGnB,MAAM;oBACZW,QAAQC,GAAG,CAAC,AAAC,cAA6BZ,OAAhBD,EAAEiB,KAAK,EAAC,UAAY,OAAJhB;;;;;;IAC5C;;IACA,WAAeL"}
|
package/dist/cjs/cli/index.d.cts
CHANGED
|
@@ -5,10 +5,13 @@ export declare const USAGE: {
|
|
|
5
5
|
readonly status: "status [--format table|json] [--config path]";
|
|
6
6
|
readonly check: "check [--format table|json] [--config path]";
|
|
7
7
|
readonly rebuild: "rebuild [--config path]";
|
|
8
|
-
readonly
|
|
9
|
-
readonly
|
|
8
|
+
readonly download: "download [--config path]";
|
|
9
|
+
readonly sql: "sql \"<statement>\" [params...] [--format table|json] [--config path]";
|
|
10
|
+
readonly search: "search \"<terms>\" [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--k n] [--format table|json] [--config path]";
|
|
10
11
|
readonly map: "map [--format table|json] [--config path]";
|
|
11
|
-
readonly peek: "peek <path> [--format table|json] [--config path]";
|
|
12
|
+
readonly peek: "peek <path> [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--format table|json] [--config path]";
|
|
13
|
+
readonly path: "path <a> <b> [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--max-depth n] [--format table|json] [--config path]";
|
|
14
|
+
readonly related: "related <note> [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--k n] [--format table|json] [--config path]";
|
|
12
15
|
};
|
|
13
16
|
export declare const COMMANDS: Record<string, () => Promise<{
|
|
14
17
|
default: Command;
|
package/dist/cjs/cli/index.d.ts
CHANGED
|
@@ -5,10 +5,13 @@ export declare const USAGE: {
|
|
|
5
5
|
readonly status: "status [--format table|json] [--config path]";
|
|
6
6
|
readonly check: "check [--format table|json] [--config path]";
|
|
7
7
|
readonly rebuild: "rebuild [--config path]";
|
|
8
|
-
readonly
|
|
9
|
-
readonly
|
|
8
|
+
readonly download: "download [--config path]";
|
|
9
|
+
readonly sql: "sql \"<statement>\" [params...] [--format table|json] [--config path]";
|
|
10
|
+
readonly search: "search \"<terms>\" [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--k n] [--format table|json] [--config path]";
|
|
10
11
|
readonly map: "map [--format table|json] [--config path]";
|
|
11
|
-
readonly peek: "peek <path> [--format table|json] [--config path]";
|
|
12
|
+
readonly peek: "peek <path> [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--format table|json] [--config path]";
|
|
13
|
+
readonly path: "path <a> <b> [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--max-depth n] [--format table|json] [--config path]";
|
|
14
|
+
readonly related: "related <note> [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--k n] [--format table|json] [--config path]";
|
|
12
15
|
};
|
|
13
16
|
export declare const COMMANDS: Record<string, () => Promise<{
|
|
14
17
|
default: Command;
|
package/dist/cjs/cli/index.js
CHANGED
|
@@ -63,10 +63,13 @@ var USAGE = {
|
|
|
63
63
|
status: 'status [--format table|json] [--config path]',
|
|
64
64
|
check: 'check [--format table|json] [--config path]',
|
|
65
65
|
rebuild: 'rebuild [--config path]',
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
download: 'download [--config path]',
|
|
67
|
+
sql: 'sql "<statement>" [params...] [--format table|json] [--config path]',
|
|
68
|
+
search: 'search "<terms>" [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where "<sql>"] [--k n] [--format table|json] [--config path]',
|
|
68
69
|
map: 'map [--format table|json] [--config path]',
|
|
69
|
-
peek: 'peek <path> [--format table|json] [--config path]'
|
|
70
|
+
peek: 'peek <path> [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where "<sql>"] [--format table|json] [--config path]',
|
|
71
|
+
path: 'path <a> <b> [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where "<sql>"] [--max-depth n] [--format table|json] [--config path]',
|
|
72
|
+
related: 'related <note> [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where "<sql>"] [--k n] [--format table|json] [--config path]'
|
|
70
73
|
};
|
|
71
74
|
var COMMANDS = {
|
|
72
75
|
init: function init() {
|
|
@@ -94,9 +97,14 @@ var COMMANDS = {
|
|
|
94
97
|
return /*#__PURE__*/ _interop_require_wildcard(require("./rebuild.js"));
|
|
95
98
|
});
|
|
96
99
|
},
|
|
97
|
-
|
|
100
|
+
download: function download() {
|
|
98
101
|
return Promise.resolve().then(function() {
|
|
99
|
-
return /*#__PURE__*/ _interop_require_wildcard(require("./
|
|
102
|
+
return /*#__PURE__*/ _interop_require_wildcard(require("./download.js"));
|
|
103
|
+
});
|
|
104
|
+
},
|
|
105
|
+
sql: function sql() {
|
|
106
|
+
return Promise.resolve().then(function() {
|
|
107
|
+
return /*#__PURE__*/ _interop_require_wildcard(require("./sql.js"));
|
|
100
108
|
});
|
|
101
109
|
},
|
|
102
110
|
search: function search() {
|
|
@@ -113,6 +121,16 @@ var COMMANDS = {
|
|
|
113
121
|
return Promise.resolve().then(function() {
|
|
114
122
|
return /*#__PURE__*/ _interop_require_wildcard(require("./peek.js"));
|
|
115
123
|
});
|
|
124
|
+
},
|
|
125
|
+
path: function path() {
|
|
126
|
+
return Promise.resolve().then(function() {
|
|
127
|
+
return /*#__PURE__*/ _interop_require_wildcard(require("./path.js"));
|
|
128
|
+
});
|
|
129
|
+
},
|
|
130
|
+
related: function related() {
|
|
131
|
+
return Promise.resolve().then(function() {
|
|
132
|
+
return /*#__PURE__*/ _interop_require_wildcard(require("./related.js"));
|
|
133
|
+
});
|
|
116
134
|
}
|
|
117
135
|
};
|
|
118
136
|
/* 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/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
|
|
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 download: 'download [--config path]',\n sql: 'sql \"<statement>\" [params...] [--format table|json] [--config path]',\n search: 'search \"<terms>\" [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--k n] [--format table|json] [--config path]',\n map: 'map [--format table|json] [--config path]',\n peek: 'peek <path> [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--format table|json] [--config path]',\n path: 'path <a> <b> [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--max-depth n] [--format table|json] [--config path]',\n related: 'related <note> [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--k n] [--format table|json] [--config path]',\n} as const;\n\n// Lazy registry: a command's imports load only when it runs, so a heavy dependency in one\n// command never taxes the others (or --version/--help). These names are reserved: a saved\n// entry in config can never shadow them.\nexport const COMMANDS: Record<string, () => Promise<{ default: Command }>> = {\n init: () => import('./init.ts'),\n watch: () => import('./watch.ts'),\n status: () => import('./status.ts'),\n check: () => import('./check.ts'),\n rebuild: () => import('./rebuild.ts'),\n download: () => import('./download.ts'),\n sql: () => import('./sql.ts'),\n search: () => import('./search.ts'),\n map: () => import('./map.ts'),\n peek: () => import('./peek.ts'),\n path: () => import('./path.ts'),\n related: () => import('./related.ts'),\n};\n\nexport type { Command, Ctx } from './types.ts';\n"],"names":["COMMANDS","USAGE","init","watch","status","check","rebuild","download","sql","search","map","peek","path","related"],"mappings":";;;;;;;;;;;QAuBaA;eAAAA;;QAlBAC;eAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAN,IAAMA,QAAQ;IACnBC,MAAM;IACNC,OAAO;IACPC,QAAQ;IACRC,OAAO;IACPC,SAAS;IACTC,UAAU;IACVC,KAAK;IACLC,QAAQ;IACRC,KAAK;IACLC,MAAM;IACNC,MAAM;IACNC,SAAS;AACX;AAKO,IAAMb,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,UAAU,SAAVA;eAAgB;2DAAA,QAAO;;;IACvBC,KAAK,SAALA;eAAW;2DAAA,QAAO;;;IAClBC,QAAQ,SAARA;eAAc;2DAAA,QAAO;;;IACrBC,KAAK,SAALA;eAAW;2DAAA,QAAO;;;IAClBC,MAAM,SAANA;eAAY;2DAAA,QAAO;;;IACnBC,MAAM,SAANA;eAAY;2DAAA,QAAO;;;IACnBC,SAAS,SAATA;eAAe;2DAAA,QAAO;;;AACxB"}
|
package/dist/cjs/cli/init.js
CHANGED
|
@@ -15,7 +15,10 @@ var init = function init(ctx) {
|
|
|
15
15
|
(0, _sharedts.parse)(ctx.argv, "usage: ".concat(ctx.name, " ").concat(_indexts.USAGE.init), {});
|
|
16
16
|
var configPath = (0, _configts.initConfig)(process.cwd());
|
|
17
17
|
console.log("created ".concat(configPath));
|
|
18
|
-
console.log("query away: ".concat(ctx.name, '
|
|
18
|
+
console.log("query away: ".concat(ctx.name, ' sql "SELECT path FROM frontmatter LIMIT 10"'));
|
|
19
|
+
// Semantic search needs a 124 MB model that nothing downloads implicitly; name the step
|
|
20
|
+
// here so the first search meets it as a choice rather than as a degraded result.
|
|
21
|
+
console.log("for meaning-based search: ".concat(ctx.name, " download (one 124 MB model, once)"));
|
|
19
22
|
// The decisions a new tree faces -- features, frontmatter conventions, note size -- are not
|
|
20
23
|
// in this output; name both places that hold them, since an agent may have neither.
|
|
21
24
|
console.log('features and tree design: the sense-setup skill, or schema.json');
|
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 { 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}
|
|
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} sql \"SELECT path FROM frontmatter LIMIT 10\"`);\n // Semantic search needs a 124 MB model that nothing downloads implicitly; name the step\n // here so the first search meets it as a choice rather than as a degraded result.\n console.log(`for meaning-based search: ${ctx.name} download (one 124 MB model, once)`);\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":";;;;+BAiBA;;;eAAA;;;wBAjB2B;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,wFAAwF;IACxF,kFAAkF;IAClFK,QAAQC,GAAG,CAAC,AAAC,6BAAqC,OAATV,IAAII,IAAI,EAAC;IAClD,4FAA4F;IAC5F,oFAAoF;IACpFK,QAAQC,GAAG,CAAC;AACd;IACA,WAAeX"}
|
package/dist/cjs/cli/map.js
CHANGED
|
@@ -41,10 +41,10 @@ function _object_spread(target) {
|
|
|
41
41
|
return target;
|
|
42
42
|
}
|
|
43
43
|
var map = function map(ctx) {
|
|
44
|
-
var values = (0, _sharedts.parse)(ctx.argv, "usage: ".concat(ctx.name, " ").concat(_indexts.USAGE.map), _object_spread({}, _sharedts.FORMAT, _sharedts.CONFIG)).values;
|
|
44
|
+
var values = (0, _sharedts.parse)(ctx.argv, "usage: ".concat(ctx.name, " ").concat(_indexts.USAGE.map), _object_spread({}, _sharedts.SCOPE, _sharedts.FORMAT, _sharedts.CONFIG)).values;
|
|
45
45
|
var format = (0, _sharedts.formatOf)(values);
|
|
46
46
|
return (0, _sharedts.withDb)(ctx, values.config, function(db, cfg) {
|
|
47
|
-
var result = (0, _commandsts.mapTree)(db, cfg);
|
|
47
|
+
var result = (0, _commandsts.mapTree)(db, cfg, (0, _sharedts.scopeOf)(values));
|
|
48
48
|
console.log(format === 'json' ? JSON.stringify(result, null, 2) : (0, _outputts.renderMap)(result));
|
|
49
49
|
});
|
|
50
50
|
};
|
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 { 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;
|
|
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, SCOPE, scopeOf, withDb } from './shared.ts';\nimport type { Command } from './types.ts';\n\nconst map: Command = (ctx) => {\n const { values } = parse(ctx.argv, `usage: ${ctx.name} ${USAGE.map}`, { ...SCOPE, ...FORMAT, ...CONFIG });\n const format = formatOf(values);\n return withDb(ctx, values.config as string | undefined, (db, cfg) => {\n const result = mapTree(db, cfg, scopeOf(values));\n console.log(format === 'json' ? JSON.stringify(result, null, 2) : renderMap(result));\n });\n};\nexport default map;\n"],"names":["map","ctx","values","parse","argv","USAGE","name","SCOPE","FORMAT","CONFIG","format","formatOf","withDb","config","db","cfg","result","mapTree","scopeOf","console","log","JSON","stringify","renderMap"],"mappings":";;;;+BAcA;;;eAAA;;;0BAdwB;wBACE;uBACJ;wBACkD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGxE,IAAMA,MAAe,aAACC;IACpB,IAAM,AAAEC,SAAWC,IAAAA,eAAK,EAACF,IAAIG,IAAI,EAAE,AAAC,UAAqBC,OAAZJ,IAAIK,IAAI,EAAC,KAAa,OAAVD,cAAK,CAACL,GAAG,GAAI,mBAAKO,eAAK,EAAKC,gBAAM,EAAKC,gBAAM,GAA9FP;IACR,IAAMQ,SAASC,IAAAA,kBAAQ,EAACT;IACxB,OAAOU,IAAAA,gBAAM,EAACX,KAAKC,OAAOW,MAAM,EAAwB,SAACC,IAAIC;QAC3D,IAAMC,SAASC,IAAAA,mBAAO,EAACH,IAAIC,KAAKG,IAAAA,iBAAO,EAAChB;QACxCiB,QAAQC,GAAG,CAACV,WAAW,SAASW,KAAKC,SAAS,CAACN,QAAQ,MAAM,KAAKO,IAAAA,mBAAS,EAACP;IAC9E;AACF;IACA,WAAehB"}
|