sensemaking 0.15.3 → 0.16.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 +33 -5
- package/dist/cjs/cli/download.js +15 -19
- package/dist/cjs/cli/download.js.map +1 -1
- package/dist/cjs/cli/index.d.cts +1 -1
- package/dist/cjs/cli/index.d.ts +1 -1
- package/dist/cjs/cli/index.js +9 -20
- package/dist/cjs/cli/index.js.map +1 -1
- package/dist/cjs/cli/init.js +31 -5
- package/dist/cjs/cli/init.js.map +1 -1
- package/dist/cjs/cli/map.js +1 -3
- package/dist/cjs/cli/map.js.map +1 -1
- package/dist/cjs/cli/named.js +3 -8
- package/dist/cjs/cli/named.js.map +1 -1
- package/dist/cjs/cli/path.js +4 -7
- package/dist/cjs/cli/path.js.map +1 -1
- package/dist/cjs/cli/peek.js +2 -4
- package/dist/cjs/cli/peek.js.map +1 -1
- package/dist/cjs/cli/related.js +14 -20
- package/dist/cjs/cli/related.js.map +1 -1
- package/dist/cjs/cli/search.js +12 -17
- package/dist/cjs/cli/search.js.map +1 -1
- package/dist/cjs/cli/shared.js +17 -21
- package/dist/cjs/cli/shared.js.map +1 -1
- package/dist/cjs/cli/sql.js +7 -8
- package/dist/cjs/cli/sql.js.map +1 -1
- package/dist/cjs/cli/status.js +344 -102
- package/dist/cjs/cli/status.js.map +1 -1
- package/dist/cjs/cli/watch.js +3 -8
- package/dist/cjs/cli/watch.js.map +1 -1
- package/dist/cjs/cli.js +22 -34
- package/dist/cjs/cli.js.map +1 -1
- package/dist/cjs/column-hint.js +4 -2
- package/dist/cjs/column-hint.js.map +1 -1
- package/dist/cjs/commands/peek.js +5 -3
- package/dist/cjs/commands/peek.js.map +1 -1
- package/dist/cjs/commands/related.js +31 -28
- package/dist/cjs/commands/related.js.map +1 -1
- package/dist/cjs/commands/scope.js +4 -2
- package/dist/cjs/commands/scope.js.map +1 -1
- package/dist/cjs/commands/search.js +36 -108
- package/dist/cjs/commands/search.js.map +1 -1
- package/dist/cjs/commands/signals.d.cts +18 -0
- package/dist/cjs/commands/signals.d.ts +18 -0
- package/dist/cjs/commands/signals.js +299 -0
- package/dist/cjs/commands/signals.js.map +1 -0
- package/dist/cjs/commands/status.d.cts +2 -2
- package/dist/cjs/commands/status.d.ts +2 -2
- package/dist/cjs/commands/status.js +1 -1
- package/dist/cjs/commands/status.js.map +1 -1
- package/dist/cjs/config/access.d.cts +5 -2
- package/dist/cjs/config/access.d.ts +5 -2
- package/dist/cjs/config/access.js +34 -14
- package/dist/cjs/config/access.js.map +1 -1
- package/dist/cjs/config/index.d.cts +4 -1
- package/dist/cjs/config/index.d.ts +4 -1
- package/dist/cjs/config/index.js +12 -2
- package/dist/cjs/config/index.js.map +1 -1
- package/dist/cjs/config/load.d.cts +6 -1
- package/dist/cjs/config/load.d.ts +6 -1
- package/dist/cjs/config/load.js +87 -15
- package/dist/cjs/config/load.js.map +1 -1
- package/dist/cjs/config/resolve.js +1 -1
- package/dist/cjs/config/resolve.js.map +1 -1
- package/dist/cjs/config/signals.d.cts +4 -0
- package/dist/cjs/config/signals.d.ts +4 -0
- package/dist/cjs/config/signals.js +30 -0
- package/dist/cjs/config/signals.js.map +1 -0
- package/dist/cjs/config/types.d.cts +6 -4
- package/dist/cjs/config/types.d.ts +6 -4
- package/dist/cjs/config/types.js +1 -1
- package/dist/cjs/config/types.js.map +1 -1
- package/dist/cjs/config/validate.js +121 -12
- package/dist/cjs/config/validate.js.map +1 -1
- package/dist/cjs/db/open.d.cts +1 -1
- package/dist/cjs/db/open.d.ts +1 -1
- package/dist/cjs/db/open.js +10 -3
- package/dist/cjs/db/open.js.map +1 -1
- package/dist/cjs/db/reconcile.d.cts +1 -0
- package/dist/cjs/db/reconcile.d.ts +1 -0
- package/dist/cjs/db/reconcile.js +20 -3
- package/dist/cjs/db/reconcile.js.map +1 -1
- package/dist/cjs/embed/cohere.d.cts +2 -0
- package/dist/cjs/embed/cohere.d.ts +2 -0
- package/dist/cjs/embed/cohere.js +238 -0
- package/dist/cjs/embed/cohere.js.map +1 -0
- package/dist/cjs/embed/http.d.cts +2 -0
- package/dist/cjs/embed/http.d.ts +2 -0
- package/dist/cjs/embed/http.js +258 -0
- package/dist/cjs/embed/http.js.map +1 -0
- package/dist/cjs/embed/identity.d.cts +13 -0
- package/dist/cjs/embed/identity.d.ts +13 -0
- package/dist/cjs/embed/identity.js +194 -0
- package/dist/cjs/embed/identity.js.map +1 -0
- package/dist/cjs/embed/langfit.d.cts +6 -0
- package/dist/cjs/embed/langfit.d.ts +6 -0
- package/dist/cjs/embed/langfit.js +326 -0
- package/dist/cjs/embed/langfit.js.map +1 -0
- package/dist/cjs/embed/languages.d.cts +3 -0
- package/dist/cjs/embed/languages.d.ts +3 -0
- package/dist/cjs/embed/languages.js +98 -0
- package/dist/cjs/embed/languages.js.map +1 -0
- package/dist/cjs/embed/openai.d.cts +2 -0
- package/dist/cjs/embed/openai.d.ts +2 -0
- package/dist/cjs/embed/openai.js +268 -0
- package/dist/cjs/embed/openai.js.map +1 -0
- package/dist/cjs/embed/query.d.cts +21 -0
- package/dist/cjs/embed/query.d.ts +21 -0
- package/dist/cjs/embed/query.js +610 -0
- package/dist/cjs/embed/query.js.map +1 -0
- package/dist/cjs/embed/registry.d.cts +3 -0
- package/dist/cjs/embed/registry.d.ts +3 -0
- package/dist/cjs/embed/registry.js +114 -0
- package/dist/cjs/embed/registry.js.map +1 -0
- package/dist/cjs/embed/static.d.cts +2 -0
- package/dist/cjs/embed/static.d.ts +2 -0
- package/dist/cjs/embed/static.js +367 -0
- package/dist/cjs/embed/static.js.map +1 -0
- package/dist/cjs/embed/store.d.cts +8 -0
- package/dist/cjs/embed/store.d.ts +8 -0
- package/dist/cjs/embed/store.js +498 -0
- package/dist/cjs/embed/store.js.map +1 -0
- package/dist/cjs/embed/types.d.cts +8 -0
- package/dist/cjs/embed/types.d.ts +8 -0
- package/dist/cjs/embed/types.js +7 -0
- package/dist/cjs/embed/types.js.map +1 -0
- package/dist/cjs/errors.d.cts +1 -1
- package/dist/cjs/errors.d.ts +1 -1
- package/dist/cjs/errors.js +15 -24
- package/dist/cjs/errors.js.map +1 -1
- package/dist/cjs/features/embed.d.cts +4 -27
- package/dist/cjs/features/embed.d.ts +4 -27
- package/dist/cjs/features/embed.js +6 -978
- package/dist/cjs/features/embed.js.map +1 -1
- package/dist/cjs/features/links.js +4 -2
- package/dist/cjs/features/links.js.map +1 -1
- package/dist/cjs/features/rank.js +1 -1
- package/dist/cjs/features/tags.js +4 -2
- package/dist/cjs/features/tags.js.map +1 -1
- package/dist/cjs/fences.js.map +1 -1
- package/dist/cjs/graph.js +5 -3
- package/dist/cjs/graph.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.d.cts +2 -2
- package/dist/cjs/output.d.ts +2 -2
- package/dist/cjs/output.js +15 -8
- package/dist/cjs/output.js.map +1 -1
- package/dist/cjs/scan.js +13 -8
- package/dist/cjs/scan.js.map +1 -1
- package/dist/cjs/segment.js +67 -14
- package/dist/cjs/segment.js.map +1 -1
- package/dist/cjs/traverse.js +4 -2
- package/dist/cjs/traverse.js.map +1 -1
- package/dist/cjs/watch.js +2 -5
- package/dist/cjs/watch.js.map +1 -1
- package/dist/esm/cli/download.js +9 -8
- package/dist/esm/cli/download.js.map +1 -1
- package/dist/esm/cli/index.d.ts +1 -1
- package/dist/esm/cli/index.js +1 -1
- package/dist/esm/cli/index.js.map +1 -1
- package/dist/esm/cli/init.js +32 -6
- package/dist/esm/cli/init.js.map +1 -1
- package/dist/esm/cli/status.js +36 -8
- package/dist/esm/cli/status.js.map +1 -1
- package/dist/esm/commands/related.js +14 -10
- package/dist/esm/commands/related.js.map +1 -1
- package/dist/esm/commands/search.js +27 -78
- package/dist/esm/commands/search.js.map +1 -1
- package/dist/esm/commands/signals.d.ts +18 -0
- package/dist/esm/commands/signals.js +78 -0
- package/dist/esm/commands/signals.js.map +1 -0
- package/dist/esm/commands/status.d.ts +2 -2
- package/dist/esm/commands/status.js +2 -2
- package/dist/esm/commands/status.js.map +1 -1
- package/dist/esm/config/access.d.ts +5 -2
- package/dist/esm/config/access.js +31 -12
- package/dist/esm/config/access.js.map +1 -1
- package/dist/esm/config/index.d.ts +4 -1
- package/dist/esm/config/index.js +2 -1
- package/dist/esm/config/index.js.map +1 -1
- package/dist/esm/config/load.d.ts +6 -1
- package/dist/esm/config/load.js +67 -9
- package/dist/esm/config/load.js.map +1 -1
- package/dist/esm/config/resolve.js +2 -2
- package/dist/esm/config/resolve.js.map +1 -1
- package/dist/esm/config/signals.d.ts +4 -0
- package/dist/esm/config/signals.js +14 -0
- package/dist/esm/config/signals.js.map +1 -0
- package/dist/esm/config/types.d.ts +6 -4
- package/dist/esm/config/types.js +1 -1
- package/dist/esm/config/types.js.map +1 -1
- package/dist/esm/config/validate.js +58 -11
- package/dist/esm/config/validate.js.map +1 -1
- package/dist/esm/db/open.d.ts +1 -1
- package/dist/esm/db/open.js +7 -2
- package/dist/esm/db/open.js.map +1 -1
- package/dist/esm/db/reconcile.d.ts +1 -0
- package/dist/esm/db/reconcile.js +10 -0
- package/dist/esm/db/reconcile.js.map +1 -1
- package/dist/esm/embed/cohere.d.ts +2 -0
- package/dist/esm/embed/cohere.js +46 -0
- package/dist/esm/embed/cohere.js.map +1 -0
- package/dist/esm/embed/http.d.ts +2 -0
- package/dist/esm/embed/http.js +33 -0
- package/dist/esm/embed/http.js.map +1 -0
- package/dist/esm/embed/identity.d.ts +13 -0
- package/dist/esm/embed/identity.js +92 -0
- package/dist/esm/embed/identity.js.map +1 -0
- package/dist/esm/embed/langfit.d.ts +6 -0
- package/dist/esm/embed/langfit.js +44 -0
- package/dist/esm/embed/langfit.js.map +1 -0
- package/dist/esm/embed/languages.d.ts +3 -0
- package/dist/esm/embed/languages.js +80 -0
- package/dist/esm/embed/languages.js.map +1 -0
- package/dist/esm/embed/openai.d.ts +2 -0
- package/dist/esm/embed/openai.js +49 -0
- package/dist/esm/embed/openai.js.map +1 -0
- package/dist/esm/embed/query.d.ts +21 -0
- package/dist/esm/embed/query.js +181 -0
- package/dist/esm/embed/query.js.map +1 -0
- package/dist/esm/embed/registry.d.ts +3 -0
- package/dist/esm/embed/registry.js +45 -0
- package/dist/esm/embed/registry.js.map +1 -0
- package/dist/esm/embed/static.d.ts +2 -0
- package/dist/esm/embed/static.js +72 -0
- package/dist/esm/embed/static.js.map +1 -0
- package/dist/esm/embed/store.d.ts +8 -0
- package/dist/esm/embed/store.js +123 -0
- package/dist/esm/embed/store.js.map +1 -0
- package/dist/esm/embed/types.d.ts +8 -0
- package/dist/esm/embed/types.js +3 -0
- package/dist/esm/embed/types.js.map +1 -0
- package/dist/esm/errors.d.ts +1 -1
- package/dist/esm/errors.js.map +1 -1
- package/dist/esm/features/embed.d.ts +4 -27
- package/dist/esm/features/embed.js +0 -346
- package/dist/esm/features/embed.js.map +1 -1
- package/dist/esm/fences.js.map +1 -1
- package/dist/esm/index.d.ts +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/output.d.ts +2 -2
- package/dist/esm/output.js +6 -2
- package/dist/esm/output.js.map +1 -1
- package/dist/esm/scan.js +7 -4
- package/dist/esm/scan.js.map +1 -1
- package/dist/esm/segment.js +49 -19
- package/dist/esm/segment.js.map +1 -1
- package/package.json +9 -1
- package/schema.json +14 -7
- package/skills/sense/SKILL.md +21 -5
- package/skills/sense-setup/EXAMPLES.md +6 -6
- package/skills/sense-setup/SKILL.md +6 -4
package/README.md
CHANGED
|
@@ -74,12 +74,12 @@ ORDER BY bm25(content, 10.0, 5.0, 1.0) LIMIT 10
|
|
|
74
74
|
```json
|
|
75
75
|
{
|
|
76
76
|
"$schema": "https://unpkg.com/sensemaking/schema.json",
|
|
77
|
-
"version":
|
|
77
|
+
"version": 5,
|
|
78
78
|
"presets": {
|
|
79
79
|
"default": { "include": ["**/*.md"], "k": 10 },
|
|
80
80
|
"raw": { "include": ["raw/**/*.md"], "k": 5 }
|
|
81
81
|
},
|
|
82
|
-
"embed": { "model": "minishlab/potion-retrieval-32M", "
|
|
82
|
+
"embed": { "model": "minishlab/potion-retrieval-32M", "provider": "static" },
|
|
83
83
|
"queries": {
|
|
84
84
|
"dead-links": { "sql": "SELECT src, target FROM links WHERE dst IS NULL" },
|
|
85
85
|
"by-tag": { "sql": "SELECT path, title FROM frontmatter WHERE has(tags, ?) ORDER BY path" },
|
|
@@ -90,7 +90,7 @@ ORDER BY bm25(content, 10.0, 5.0, 1.0) LIMIT 10
|
|
|
90
90
|
|
|
91
91
|
| key | holds |
|
|
92
92
|
|---|---|
|
|
93
|
-
| `presets` | named bundles of `include`/`exclude` globs, `k` (result count), `
|
|
93
|
+
| `presets` | named bundles of `include`/`exclude` globs, `k` (result count), `signals` (which engines this scope searches with -- `words`, `links`, `vectors`; every signal whose prerequisites hold, unless the preset lists them exhaustively), `where` (a standing SQL filter). A file is indexed if any preset includes it, embedded if a model is named and some covering preset's `signals` include `vectors`; `status` shows each preset's coverage. |
|
|
94
94
|
| `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. |
|
|
95
95
|
| `content` | settings for the `content` table. `tokenize` names the FTS5 tokenizer, defaulting to `porter unicode61`: name `trigram` for substring matching inside a Latin word, or `unicode61 tokenchars '-_'` to keep hyphenated terms whole. Languages written without word spaces (Chinese, Japanese, Thai, Khmer, Lao, Burmese) need no decision here: they are indexed per grapheme and searched as ordered phrases, substring semantics, what grep gives, needing no minimum length; naming a tokenizer turns that off, since the tree has then chosen its own scheme. Changing it rebuilds the text index only; vectors, links, and sections are kept. |
|
|
96
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. Running an entry validates it: a typo'd column errors and exits nonzero, and a parameterised entry validates with any argument, since preparing precedes binding. |
|
|
@@ -98,10 +98,38 @@ ORDER BY bm25(content, 10.0, 5.0, 1.0) LIMIT 10
|
|
|
98
98
|
|
|
99
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.
|
|
100
100
|
|
|
101
|
-
Vectors need a model
|
|
101
|
+
Vectors need a model. Naming a Hugging Face id in `embed.model` is consent to fetch it: it downloads lazily, on the first vector search, with progress on stderr, into `~/.sense/models` (huggingface_hub's cache layout, one snapshot directory per resolved revision, shared by every tree, 124 MB, never in the package). `sense download` prefetches the same model ahead of time, so the wait happens on your schedule instead of the first query's; it is idempotent and prints the resolved revision. `embed.model` is a Hugging Face id, or a path to a directory holding `model.safetensors` and `tokenizer.json`, which nothing fetches for you. A preset that asks for vectors when a local model path is missing those files is an error naming the fix, rather than a quieter result that would make the same search answer differently before and after; a preset whose `signals` exclude `vectors` never asks, so it is unaffected. An optional top-level `"embed": { "model", "provider", "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 vector search, with progress.
|
|
102
102
|
|
|
103
103
|
Two custom SQL functions. `has(field, value)`: array membership on JSON-array fields, substring on strings, false on missing keys. `segment(terms)`: rewrites a run of Chinese, Japanese, Thai, Khmer, Lao, or Burmese text into the ordered grapheme phrase the sidecar columns need, leaving everything else unchanged, so it is safe to add to any hand-written `MATCH`. 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.
|
|
104
104
|
|
|
105
|
+
## Providers
|
|
106
|
+
|
|
107
|
+
`embed.provider` picks the wire protocol; `embed.model` names the model. [INTEGRATIONS.md](INTEGRATIONS.md) is the record of what has actually been run and verified against this codebase -- only that gets named as a recommendation.
|
|
108
|
+
|
|
109
|
+
**static** -- a local, pure-JS Model2Vec model; no network at query time.
|
|
110
|
+
|
|
111
|
+
```json
|
|
112
|
+
"embed": { "model": "minishlab/potion-retrieval-32M", "provider": "static" }
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
`model` is a Hugging Face id, fetched to `~/.sense/models` on first use, or a path to a local directory holding `model.safetensors` and `tokenizer.json`.
|
|
116
|
+
|
|
117
|
+
**openai** -- any endpoint serving an OpenAI-shaped `POST /embeddings`.
|
|
118
|
+
|
|
119
|
+
```json
|
|
120
|
+
"embed": { "model": "nomic-embed-text", "provider": "openai", "url": "http://localhost:11434/v1" }
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
Ollama serves this shape at `http://localhost:11434/v1`. LM Studio serves the same shape at `http://localhost:1234/v1`, with narrower platform support than Ollama: Apple Silicon only on Mac, AVX2 on Windows. Content stays on the machine for either. Any other OpenAI-shaped endpoint, including a hosted one, works the same way through `provider: "openai"` and its own `url`; a hosted endpoint means tree content is sent to that service.
|
|
124
|
+
|
|
125
|
+
**cohere** -- Cohere's native `/v2/embed`, which expresses the doc/query distinction (`input_type`) the OpenAI shape cannot.
|
|
126
|
+
|
|
127
|
+
```json
|
|
128
|
+
"embed": { "model": "embed-v4.0", "provider": "cohere", "key": "COHERE_API_KEY" }
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
`key` names the environment variable holding the API key; the key value itself never goes in the config. Content is sent to Cohere.
|
|
132
|
+
|
|
105
133
|
## Scale
|
|
106
134
|
|
|
107
135
|
Every query starts with a freshness check against the cache in `.sense/`; only changed files are re-parsed. What to expect as a tree grows:
|
|
@@ -136,7 +164,7 @@ Two skills: `sense` for querying a tree (what each command is for, FTS5 syntax,
|
|
|
136
164
|
- **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.
|
|
137
165
|
- **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.
|
|
138
166
|
|
|
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.
|
|
167
|
+
Dependencies: [yaml](https://github.com/eemeli/yaml), [remove-markdown](https://github.com/zuchka/remove-markdown), [@huggingface/tokenizers](https://github.com/huggingface/tokenizers.js), [franc-min](https://github.com/wooorm/franc) (all pure JS), and Node's built-in SQLite. No native builds.
|
|
140
168
|
|
|
141
169
|
## License
|
|
142
170
|
|
package/dist/cjs/cli/download.js
CHANGED
|
@@ -8,9 +8,10 @@ Object.defineProperty(exports, "default", {
|
|
|
8
8
|
return _default;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
+
var _nodepath = require("node:path");
|
|
11
12
|
var _indexts = require("../config/index.js");
|
|
13
|
+
var _storets = require("../embed/store.js");
|
|
12
14
|
var _errorsts = require("../errors.js");
|
|
13
|
-
var _embedts = require("../features/embed.js");
|
|
14
15
|
var _indexts1 = require("./index.js");
|
|
15
16
|
var _sharedts = require("./shared.js");
|
|
16
17
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
@@ -21,11 +22,8 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
21
22
|
reject(error);
|
|
22
23
|
return;
|
|
23
24
|
}
|
|
24
|
-
if (info.done)
|
|
25
|
-
|
|
26
|
-
} else {
|
|
27
|
-
Promise.resolve(value).then(_next, _throw);
|
|
28
|
-
}
|
|
25
|
+
if (info.done) resolve(value);
|
|
26
|
+
else Promise.resolve(value).then(_next, _throw);
|
|
29
27
|
}
|
|
30
28
|
function _async_to_generator(fn) {
|
|
31
29
|
return function() {
|
|
@@ -50,9 +48,7 @@ function _define_property(obj, key, value) {
|
|
|
50
48
|
configurable: true,
|
|
51
49
|
writable: true
|
|
52
50
|
});
|
|
53
|
-
} else
|
|
54
|
-
obj[key] = value;
|
|
55
|
-
}
|
|
51
|
+
} else obj[key] = value;
|
|
56
52
|
return obj;
|
|
57
53
|
}
|
|
58
54
|
function _object_spread(target) {
|
|
@@ -169,12 +165,11 @@ function _ts_generator(thisArg, body) {
|
|
|
169
165
|
};
|
|
170
166
|
}
|
|
171
167
|
}
|
|
172
|
-
//
|
|
173
|
-
//
|
|
174
|
-
// is no prompt for CI to bypass; running it twice is a no-op.
|
|
168
|
+
// A prefetch over the store's own fetch path: a search would fetch the same weights
|
|
169
|
+
// lazily, so this only moves the wait earlier. Idempotent; asks nothing, so CI can run it unattended.
|
|
175
170
|
var download = function download(ctx) {
|
|
176
171
|
return _async_to_generator(function() {
|
|
177
|
-
var values, cfg, e, dir;
|
|
172
|
+
var values, cfg, e, at, dir;
|
|
178
173
|
return _ts_generator(this, function(_state) {
|
|
179
174
|
switch(_state.label){
|
|
180
175
|
case 0:
|
|
@@ -182,27 +177,28 @@ var download = function download(ctx) {
|
|
|
182
177
|
cfg = ctx.resolveConfig(values.config);
|
|
183
178
|
e = (0, _indexts.embedConfig)(cfg);
|
|
184
179
|
if (!e) throw new _errorsts.SenseError('EMBED_DISABLED', 'no preset asks for vectors, so there is no model to download');
|
|
185
|
-
if (e.
|
|
186
|
-
console.log('embed
|
|
180
|
+
if (e.provider !== 'static') {
|
|
181
|
+
console.log('embed provider is "'.concat(e.provider, '" (').concat(e.url, "), so there is nothing to download; ").concat(ctx.name, " search reaches it over the network"));
|
|
187
182
|
return [
|
|
188
183
|
2
|
|
189
184
|
];
|
|
190
185
|
}
|
|
191
|
-
if ((0,
|
|
192
|
-
|
|
186
|
+
if ((0, _storets.modelPresent)(cfg)) {
|
|
187
|
+
at = (0, _storets.isDownloadable)(e.model) ? "@".concat((0, _nodepath.basename)((0, _storets.modelDir)(e.model)), " ") : ' ';
|
|
188
|
+
console.log("".concat(e.model).concat(at, "is already available in ").concat((0, _storets.modelDir)(e.model)));
|
|
193
189
|
return [
|
|
194
190
|
2
|
|
195
191
|
];
|
|
196
192
|
}
|
|
197
193
|
return [
|
|
198
194
|
4,
|
|
199
|
-
(0,
|
|
195
|
+
(0, _storets.downloadModel)(e.model, function(file, into) {
|
|
200
196
|
return console.error("fetching ".concat(e.model, "/").concat(file, " into ").concat(into));
|
|
201
197
|
})
|
|
202
198
|
];
|
|
203
199
|
case 1:
|
|
204
200
|
dir = _state.sent();
|
|
205
|
-
console.log("downloaded ".concat(e.model, " into ").concat(dir));
|
|
201
|
+
console.log("downloaded ".concat(e.model, "@").concat((0, _nodepath.basename)(dir), " into ").concat(dir));
|
|
206
202
|
return [
|
|
207
203
|
2
|
|
208
204
|
];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/download.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/download.ts"],"sourcesContent":["import { basename } from 'node:path';\nimport { embedConfig } from '../config/index.ts';\nimport { downloadModel, isDownloadable, modelDir, modelPresent } from '../embed/store.ts';\nimport { SenseError } from '../errors.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, parse } from './shared.ts';\nimport type { Command } from './types.ts';\n\n// A prefetch over the store's own fetch path: a search would fetch the same weights\n// lazily, so this only moves the wait earlier. Idempotent; asks nothing, so CI can run it unattended.\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.provider !== 'static') {\n console.log(`embed provider is \"${e.provider}\" (${e.url}), so there is nothing to download; ${ctx.name} search reaches it over the network`);\n return;\n }\n if (modelPresent(cfg)) {\n const at = isDownloadable(e.model) ? `@${basename(modelDir(e.model))} ` : ' ';\n console.log(`${e.model}${at}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}@${basename(dir)} into ${dir}`);\n};\nexport default download;\n"],"names":["download","ctx","values","cfg","e","at","dir","parse","argv","USAGE","name","CONFIG","resolveConfig","config","embedConfig","SenseError","provider","console","log","url","modelPresent","isDownloadable","model","basename","modelDir","downloadModel","file","into","error"],"mappings":";;;;+BA4BA;;;eAAA;;;wBA5ByB;uBACG;uBAC0C;wBAC3C;wBACL;wBACQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG9B,oFAAoF;AACpF,sGAAsG;AACtG,IAAMA,WAAoB,kBAAOC;;YACvBC,QACFC,KACAC,GAQEC,IAIFC;;;;oBAdEJ,SAAWK,IAAAA,eAAK,EAACN,IAAIO,IAAI,EAAE,AAAC,UAAqBC,OAAZR,IAAIS,IAAI,EAAC,KAAkB,OAAfD,eAAK,CAACT,QAAQ,GAAI,mBAAKW,gBAAM,GAA9ET;oBACFC,MAAMF,IAAIW,aAAa,CAACV,OAAOW,MAAM;oBACrCT,IAAIU,IAAAA,oBAAW,EAACX;oBACtB,IAAI,CAACC,GAAG,MAAM,IAAIW,oBAAU,CAAC,kBAAkB;oBAE/C,IAAIX,EAAEY,QAAQ,KAAK,UAAU;wBAC3BC,QAAQC,GAAG,CAAC,AAAC,sBAAqCd,OAAhBA,EAAEY,QAAQ,EAAC,OAAiDf,OAA5CG,EAAEe,GAAG,EAAC,wCAA+C,OAATlB,IAAIS,IAAI,EAAC;wBACvG;;;oBACF;oBACA,IAAIU,IAAAA,qBAAY,EAACjB,MAAM;wBACfE,KAAKgB,IAAAA,uBAAc,EAACjB,EAAEkB,KAAK,IAAI,AAAC,IAA+B,OAA5BC,IAAAA,kBAAQ,EAACC,IAAAA,iBAAQ,EAACpB,EAAEkB,KAAK,IAAG,OAAK;wBAC1EL,QAAQC,GAAG,CAAC,AAAC,GAAYb,OAAVD,EAAEkB,KAAK,EAAgCE,OAA7BnB,IAAG,4BAA4C,OAAlBmB,IAAAA,iBAAQ,EAACpB,EAAEkB,KAAK;wBACtE;;;oBACF;oBACY;;wBAAMG,IAAAA,sBAAa,EAACrB,EAAEkB,KAAK,EAAE,SAACI,MAAMC;mCAASV,QAAQW,KAAK,CAAC,AAAC,YAAsBF,OAAXtB,EAAEkB,KAAK,EAAC,KAAgBK,OAAbD,MAAK,UAAa,OAALC;;;;oBAArGrB,MAAM;oBACZW,QAAQC,GAAG,CAAC,AAAC,cAAwBK,OAAXnB,EAAEkB,KAAK,EAAC,KAAyBhB,OAAtBiB,IAAAA,kBAAQ,EAACjB,MAAK,UAAY,OAAJA;;;;;;IAC7D;;IACA,WAAeN"}
|
package/dist/cjs/cli/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Command } from './types.js';
|
|
2
2
|
export declare const USAGE: {
|
|
3
|
-
readonly init: "init";
|
|
3
|
+
readonly init: "init [--model id-or-path] [--provider static|openai|cohere] [--url url]";
|
|
4
4
|
readonly watch: "watch [--force] [--config path]";
|
|
5
5
|
readonly status: "status [--format table|json] [--config path]";
|
|
6
6
|
readonly download: "download [--config path]";
|
package/dist/cjs/cli/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Command } from './types.js';
|
|
2
2
|
export declare const USAGE: {
|
|
3
|
-
readonly init: "init";
|
|
3
|
+
readonly init: "init [--model id-or-path] [--provider static|openai|cohere] [--url url]";
|
|
4
4
|
readonly watch: "watch [--force] [--config path]";
|
|
5
5
|
readonly status: "status [--format table|json] [--config path]";
|
|
6
6
|
readonly download: "download [--config path]";
|
package/dist/cjs/cli/index.js
CHANGED
|
@@ -25,18 +25,12 @@ function _getRequireWildcardCache(nodeInterop) {
|
|
|
25
25
|
})(nodeInterop);
|
|
26
26
|
}
|
|
27
27
|
function _interop_require_wildcard(obj, nodeInterop) {
|
|
28
|
-
if (!nodeInterop && obj && obj.__esModule)
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return {
|
|
33
|
-
default: obj
|
|
34
|
-
};
|
|
35
|
-
}
|
|
28
|
+
if (!nodeInterop && obj && obj.__esModule) return obj;
|
|
29
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") return {
|
|
30
|
+
default: obj
|
|
31
|
+
};
|
|
36
32
|
var cache = _getRequireWildcardCache(nodeInterop);
|
|
37
|
-
if (cache && cache.has(obj))
|
|
38
|
-
return cache.get(obj);
|
|
39
|
-
}
|
|
33
|
+
if (cache && cache.has(obj)) return cache.get(obj);
|
|
40
34
|
var newObj = {
|
|
41
35
|
__proto__: null
|
|
42
36
|
};
|
|
@@ -44,21 +38,16 @@ function _interop_require_wildcard(obj, nodeInterop) {
|
|
|
44
38
|
for(var key in obj){
|
|
45
39
|
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
46
40
|
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
47
|
-
if (desc && (desc.get || desc.set))
|
|
48
|
-
|
|
49
|
-
} else {
|
|
50
|
-
newObj[key] = obj[key];
|
|
51
|
-
}
|
|
41
|
+
if (desc && (desc.get || desc.set)) Object.defineProperty(newObj, key, desc);
|
|
42
|
+
else newObj[key] = obj[key];
|
|
52
43
|
}
|
|
53
44
|
}
|
|
54
45
|
newObj.default = obj;
|
|
55
|
-
if (cache)
|
|
56
|
-
cache.set(obj, newObj);
|
|
57
|
-
}
|
|
46
|
+
if (cache) cache.set(obj, newObj);
|
|
58
47
|
return newObj;
|
|
59
48
|
}
|
|
60
49
|
var USAGE = {
|
|
61
|
-
init: 'init',
|
|
50
|
+
init: 'init [--model id-or-path] [--provider static|openai|cohere] [--url url]',
|
|
62
51
|
watch: 'watch [--force] [--config path]',
|
|
63
52
|
status: 'status [--format table|json] [--config path]',
|
|
64
53
|
download: 'download [--config path]',
|
|
@@ -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 download: 'download [--config path]',\n sql: 'sql \"<statement>\" [params...] [--preset name] [--format table|json|csv] [--config path]',\n search: 'search \"<terms>\" [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--k n] [--format table|json|csv] [--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|csv] [--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 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","download","sql","search","map","peek","path","related"],"mappings":";;;;;;;;;;;QAqBaA;eAAAA;;QAhBAC;eAAAA
|
|
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 [--model id-or-path] [--provider static|openai|cohere] [--url url]',\n watch: 'watch [--force] [--config path]',\n status: 'status [--format table|json] [--config path]',\n download: 'download [--config path]',\n sql: 'sql \"<statement>\" [params...] [--preset name] [--format table|json|csv] [--config path]',\n search: 'search \"<terms>\" [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude] [--where \"<sql>\"] [--k n] [--format table|json|csv] [--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|csv] [--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 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","download","sql","search","map","peek","path","related"],"mappings":";;;;;;;;;;;QAqBaA;eAAAA;;QAhBAC;eAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAN,IAAMA,QAAQ;IACnBC,MAAM;IACNC,OAAO;IACPC,QAAQ;IACRC,UAAU;IACVC,KAAK;IACLC,QAAQ;IACRC,KAAK;IACLC,MAAM;IACNC,MAAM;IACNC,SAAS;AACX;AAKO,IAAMX,WAAgE;IAC3EE,MAAM,SAANA;eAAY;2DAAA,QAAO;;;IACnBC,OAAO,SAAPA;eAAa;2DAAA,QAAO;;;IACpBC,QAAQ,SAARA;eAAc;2DAAA,QAAO;;;IACrBC,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
|
@@ -12,13 +12,39 @@ var _indexts = require("../config/index.js");
|
|
|
12
12
|
var _indexts1 = require("./index.js");
|
|
13
13
|
var _sharedts = require("./shared.js");
|
|
14
14
|
var init = function init(ctx) {
|
|
15
|
-
(0, _sharedts.parse)(ctx.argv, "usage: ".concat(ctx.name, " ").concat(_indexts1.USAGE.init), {
|
|
16
|
-
|
|
15
|
+
var values = (0, _sharedts.parse)(ctx.argv, "usage: ".concat(ctx.name, " ").concat(_indexts1.USAGE.init), {
|
|
16
|
+
model: {
|
|
17
|
+
type: 'string'
|
|
18
|
+
},
|
|
19
|
+
provider: {
|
|
20
|
+
type: 'string'
|
|
21
|
+
},
|
|
22
|
+
url: {
|
|
23
|
+
type: 'string'
|
|
24
|
+
}
|
|
25
|
+
}).values;
|
|
26
|
+
var modelFlag = values.model;
|
|
27
|
+
var providerFlag = values.provider;
|
|
28
|
+
var model = modelFlag !== null && modelFlag !== void 0 ? modelFlag : _indexts.DEFAULT_EMBED_MODEL;
|
|
29
|
+
var provider = providerFlag !== null && providerFlag !== void 0 ? providerFlag : 'static';
|
|
30
|
+
var url = values.url;
|
|
31
|
+
// An invalid --provider throws here (validateConfig's own shape error), before anything is
|
|
32
|
+
// written -- one validator, not a second copy of its rules.
|
|
33
|
+
var configPath = (0, _indexts.initConfig)(process.cwd(), {
|
|
34
|
+
model: modelFlag,
|
|
35
|
+
provider: providerFlag,
|
|
36
|
+
url: url
|
|
37
|
+
});
|
|
17
38
|
console.log("created ".concat(configPath));
|
|
18
39
|
console.log("query away: ".concat(ctx.name, ' sql "SELECT path FROM frontmatter LIMIT 10"'));
|
|
19
|
-
//
|
|
20
|
-
//
|
|
21
|
-
|
|
40
|
+
// Naming a model is consent to fetch it, so writing one into the config says so loudly,
|
|
41
|
+
// with the download consequence and the prefetch command, right where it was just written.
|
|
42
|
+
if (provider === 'static') {
|
|
43
|
+
console.log("embed model: ".concat(model, " (static); nothing downloads until the first vector search -- ").concat(ctx.name, " download fetches it now instead"));
|
|
44
|
+
} else {
|
|
45
|
+
console.log("embed model: ".concat(model, " (").concat(provider).concat(url ? " at ".concat(url) : '', "); reached over the network at search time, nothing to download"));
|
|
46
|
+
}
|
|
47
|
+
console.log('a non-English tree should pick a model for its languages: see the sense-setup skill or INTEGRATIONS.md');
|
|
22
48
|
// The decisions a new tree faces -- features, frontmatter conventions, note size -- are not
|
|
23
49
|
// in this output; name both places that hold them, since an agent may have neither.
|
|
24
50
|
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/index.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 //
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/init.ts"],"sourcesContent":["import { DEFAULT_EMBED_MODEL, initConfig } from '../config/index.ts';\nimport { USAGE } from './index.ts';\nimport { parse } from './shared.ts';\nimport type { Command } from './types.ts';\n\nconst init: Command = (ctx) => {\n const { values } = parse(ctx.argv, `usage: ${ctx.name} ${USAGE.init}`, {\n model: { type: 'string' },\n provider: { type: 'string' },\n url: { type: 'string' },\n });\n const modelFlag = values.model as string | undefined;\n const providerFlag = values.provider as string | undefined;\n const model = modelFlag ?? DEFAULT_EMBED_MODEL;\n const provider = providerFlag ?? 'static';\n const url = values.url as string | undefined;\n // An invalid --provider throws here (validateConfig's own shape error), before anything is\n // written -- one validator, not a second copy of its rules.\n const configPath = initConfig(process.cwd(), { model: modelFlag, provider: providerFlag, url });\n console.log(`created ${configPath}`);\n console.log(`query away: ${ctx.name} sql \"SELECT path FROM frontmatter LIMIT 10\"`);\n // Naming a model is consent to fetch it, so writing one into the config says so loudly,\n // with the download consequence and the prefetch command, right where it was just written.\n if (provider === 'static') {\n console.log(`embed model: ${model} (static); nothing downloads until the first vector search -- ${ctx.name} download fetches it now instead`);\n } else {\n console.log(`embed model: ${model} (${provider}${url ? ` at ${url}` : ''}); reached over the network at search time, nothing to download`);\n }\n console.log('a non-English tree should pick a model for its languages: see the sense-setup skill or INTEGRATIONS.md');\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","values","parse","argv","USAGE","name","model","type","provider","url","modelFlag","providerFlag","DEFAULT_EMBED_MODEL","configPath","initConfig","process","cwd","console","log"],"mappings":";;;;+BAiCA;;;eAAA;;;uBAjCgD;wBAC1B;wBACA;AAGtB,IAAMA,OAAgB,cAACC;IACrB,IAAM,AAAEC,SAAWC,IAAAA,eAAK,EAACF,IAAIG,IAAI,EAAE,AAAC,UAAqBC,OAAZJ,IAAIK,IAAI,EAAC,KAAc,OAAXD,eAAK,CAACL,IAAI,GAAI;QACrEO,OAAO;YAAEC,MAAM;QAAS;QACxBC,UAAU;YAAED,MAAM;QAAS;QAC3BE,KAAK;YAAEF,MAAM;QAAS;IACxB,GAJQN;IAKR,IAAMS,YAAYT,OAAOK,KAAK;IAC9B,IAAMK,eAAeV,OAAOO,QAAQ;IACpC,IAAMF,QAAQI,sBAAAA,uBAAAA,YAAaE,4BAAmB;IAC9C,IAAMJ,WAAWG,yBAAAA,0BAAAA,eAAgB;IACjC,IAAMF,MAAMR,OAAOQ,GAAG;IACtB,2FAA2F;IAC3F,4DAA4D;IAC5D,IAAMI,aAAaC,IAAAA,mBAAU,EAACC,QAAQC,GAAG,IAAI;QAAEV,OAAOI;QAAWF,UAAUG;QAAcF,KAAAA;IAAI;IAC7FQ,QAAQC,GAAG,CAAC,AAAC,WAAqB,OAAXL;IACvBI,QAAQC,GAAG,CAAC,AAAC,eAAuB,OAATlB,IAAIK,IAAI,EAAC;IACpC,wFAAwF;IACxF,2FAA2F;IAC3F,IAAIG,aAAa,UAAU;QACzBS,QAAQC,GAAG,CAAC,AAAC,gBAAqFlB,OAAtEM,OAAM,kEAAyE,OAATN,IAAIK,IAAI,EAAC;IAC7G,OAAO;QACLY,QAAQC,GAAG,CAAC,AAAC,gBAAyBV,OAAVF,OAAM,MAAeG,OAAXD,UAAmC,OAAxBC,MAAM,AAAC,OAAU,OAAJA,OAAQ,IAAG;IAC3E;IACAQ,QAAQC,GAAG,CAAC;IACZ,4FAA4F;IAC5F,oFAAoF;IACpFD,QAAQC,GAAG,CAAC;AACd;IACA,WAAenB"}
|
package/dist/cjs/cli/map.js
CHANGED
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/index.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;;;uBAdwB;wBACE;wBACJ;wBACkD
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/map.ts"],"sourcesContent":["import { mapTree } from '../commands/index.ts';\nimport { renderMap } from '../output.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, FORMAT, formatOf, parse, SCOPE, scopeOf, withDb } from './shared.ts';\nimport type { Command } from './types.ts';\n\nconst map: Command = (ctx) => {\n const { values } = parse(ctx.argv, `usage: ${ctx.name} ${USAGE.map}`, { ...SCOPE, ...FORMAT, ...CONFIG });\n const format = formatOf(values);\n return withDb(ctx, values.config as string | undefined, (db, cfg) => {\n const result = mapTree(db, cfg, scopeOf(values));\n console.log(format === 'json' ? JSON.stringify(result, null, 2) : renderMap(result));\n });\n};\nexport default map;\n"],"names":["map","ctx","values","parse","argv","USAGE","name","SCOPE","FORMAT","CONFIG","format","formatOf","withDb","config","db","cfg","result","mapTree","scopeOf","console","log","JSON","stringify","renderMap"],"mappings":";;;;+BAcA;;;eAAA;;;uBAdwB;wBACE;wBACJ;wBACkD;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGxE,IAAMA,MAAe,aAACC;IACpB,IAAM,AAAEC,SAAWC,IAAAA,eAAK,EAACF,IAAIG,IAAI,EAAE,AAAC,UAAqBC,OAAZJ,IAAIK,IAAI,EAAC,KAAa,OAAVD,eAAK,CAACL,GAAG,GAAI,mBAAKO,eAAK,EAAKC,gBAAM,EAAKC,gBAAM,GAA9FP;IACR,IAAMQ,SAASC,IAAAA,kBAAQ,EAACT;IACxB,OAAOU,IAAAA,gBAAM,EAACX,KAAKC,OAAOW,MAAM,EAAwB,SAACC,IAAIC;QAC3D,IAAMC,SAASC,IAAAA,gBAAO,EAACH,IAAIC,KAAKG,IAAAA,iBAAO,EAAChB;QACxCiB,QAAQC,GAAG,CAACV,WAAW,SAASW,KAAKC,SAAS,CAACN,QAAQ,MAAM,KAAKO,IAAAA,mBAAS,EAACP;IAC9E;AACF;IACA,WAAehB"}
|
package/dist/cjs/cli/named.js
CHANGED
|
@@ -21,11 +21,8 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
21
21
|
reject(error);
|
|
22
22
|
return;
|
|
23
23
|
}
|
|
24
|
-
if (info.done)
|
|
25
|
-
|
|
26
|
-
} else {
|
|
27
|
-
Promise.resolve(value).then(_next, _throw);
|
|
28
|
-
}
|
|
24
|
+
if (info.done) resolve(value);
|
|
25
|
+
else Promise.resolve(value).then(_next, _throw);
|
|
29
26
|
}
|
|
30
27
|
function _async_to_generator(fn) {
|
|
31
28
|
return function() {
|
|
@@ -50,9 +47,7 @@ function _define_property(obj, key, value) {
|
|
|
50
47
|
configurable: true,
|
|
51
48
|
writable: true
|
|
52
49
|
});
|
|
53
|
-
} else
|
|
54
|
-
obj[key] = value;
|
|
55
|
-
}
|
|
50
|
+
} else obj[key] = value;
|
|
56
51
|
return obj;
|
|
57
52
|
}
|
|
58
53
|
function _object_spread(target) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/named.ts"],"sourcesContent":["import { search } from '../commands/index.ts';\nimport { printRows } from '../output.ts';\nimport { CONFIG, FORMAT, parse, parseK, rowFormatOf, runSql, SEARCH_FLAGS, withDb } from './shared.ts';\nimport type { Ctx } from './types.ts';\n\n// Fallback when the first positional is not a command: a saved query, { sql } or { search }.\n// SEARCH_FLAGS override a saved search's fields the same way they override a preset's.\nexport default async function named(ctx: Ctx, queryName: string): Promise<void> {\n const usage = `usage: ${ctx.name} ${queryName} [params...] [--format table|json|csv] [--config path] [--where \"<sql>\"] [--k n] [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude]`;\n const { values, positionals: params } = parse(ctx.argv, usage, { ...SEARCH_FLAGS, ...FORMAT, ...CONFIG });\n const format = rowFormatOf(values);\n const configPath = values.config as string | undefined;\n\n const cfg = ctx.resolveConfig(configPath);\n const entry = cfg.queries[queryName];\n if (entry === undefined) {\n console.error(`unknown command or saved entry: \"${queryName}\"`);\n console.error(`saved queries: ${Object.keys(cfg.queries).sort().join(', ')}`);\n process.exit(2);\n }\n\n if ('sql' in entry) {\n // A saved statement written against `scope` is preset-agnostic, so the same entry can be\n // re-pointed at another layer from the command line instead of being copied per preset.\n runSql(cfg, entry.sql, params, format, `query \"${queryName}\"`, values.preset as string | undefined);\n return;\n }\n\n // A saved search's text is fixed in config; there is nowhere for a positional to bind.\n if (params.length > 0) {\n ctx.usageError(`\"${queryName}\" is a saved search and takes no positional parameters; edit its \"search\" in sense.config.json, or use \"${ctx.name} search\" directly`);\n }\n const k = parseK(values.k as string | undefined, ctx.usageError) ?? entry.k;\n const where = (values.where as string | undefined) ?? entry.where;\n const preset = (values.preset as string | undefined) ?? entry.preset;\n const include = (values.include as string[] | undefined) ?? entry.include;\n const exclude = (values.exclude as string[] | undefined) ?? entry.exclude;\n const noExclude = values['no-exclude'] === true;\n await withDb(ctx, configPath, async (db, resolvedCfg) => printRows(await search(db, resolvedCfg, entry.search, { k, where, preset, include, exclude, noExclude }), format));\n}\n"],"names":["named","ctx","queryName","parseK","values","usage","parse","params","format","configPath","cfg","entry","k","where","preset","include","exclude","noExclude","name","argv","SEARCH_FLAGS","FORMAT","CONFIG","positionals","rowFormatOf","config","resolveConfig","queries","undefined","console","error","Object","keys","sort","join","process","exit","runSql","sql","length","usageError","withDb","db","resolvedCfg","search","printRows"],"mappings":";;;;+BAKA,6FAA6F;AAC7F,uFAAuF;AACvF;;;eAA8BA;;;uBAPP;wBACG;wBAC+D
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/named.ts"],"sourcesContent":["import { search } from '../commands/index.ts';\nimport { printRows } from '../output.ts';\nimport { CONFIG, FORMAT, parse, parseK, rowFormatOf, runSql, SEARCH_FLAGS, withDb } from './shared.ts';\nimport type { Ctx } from './types.ts';\n\n// Fallback when the first positional is not a command: a saved query, { sql } or { search }.\n// SEARCH_FLAGS override a saved search's fields the same way they override a preset's.\nexport default async function named(ctx: Ctx, queryName: string): Promise<void> {\n const usage = `usage: ${ctx.name} ${queryName} [params...] [--format table|json|csv] [--config path] [--where \"<sql>\"] [--k n] [--preset name] [--include glob ...] [--exclude glob ...] [--no-exclude]`;\n const { values, positionals: params } = parse(ctx.argv, usage, { ...SEARCH_FLAGS, ...FORMAT, ...CONFIG });\n const format = rowFormatOf(values);\n const configPath = values.config as string | undefined;\n\n const cfg = ctx.resolveConfig(configPath);\n const entry = cfg.queries[queryName];\n if (entry === undefined) {\n console.error(`unknown command or saved entry: \"${queryName}\"`);\n console.error(`saved queries: ${Object.keys(cfg.queries).sort().join(', ')}`);\n process.exit(2);\n }\n\n if ('sql' in entry) {\n // A saved statement written against `scope` is preset-agnostic, so the same entry can be\n // re-pointed at another layer from the command line instead of being copied per preset.\n runSql(cfg, entry.sql, params, format, `query \"${queryName}\"`, values.preset as string | undefined);\n return;\n }\n\n // A saved search's text is fixed in config; there is nowhere for a positional to bind.\n if (params.length > 0) {\n ctx.usageError(`\"${queryName}\" is a saved search and takes no positional parameters; edit its \"search\" in sense.config.json, or use \"${ctx.name} search\" directly`);\n }\n const k = parseK(values.k as string | undefined, ctx.usageError) ?? entry.k;\n const where = (values.where as string | undefined) ?? entry.where;\n const preset = (values.preset as string | undefined) ?? entry.preset;\n const include = (values.include as string[] | undefined) ?? entry.include;\n const exclude = (values.exclude as string[] | undefined) ?? entry.exclude;\n const noExclude = values['no-exclude'] === true;\n await withDb(ctx, configPath, async (db, resolvedCfg) => printRows(await search(db, resolvedCfg, entry.search, { k, where, preset, include, exclude, noExclude }), format));\n}\n"],"names":["named","ctx","queryName","parseK","values","usage","parse","params","format","configPath","cfg","entry","k","where","preset","include","exclude","noExclude","name","argv","SEARCH_FLAGS","FORMAT","CONFIG","positionals","rowFormatOf","config","resolveConfig","queries","undefined","console","error","Object","keys","sort","join","process","exit","runSql","sql","length","usageError","withDb","db","resolvedCfg","search","printRows"],"mappings":";;;;+BAKA,6FAA6F;AAC7F,uFAAuF;AACvF;;;eAA8BA;;;uBAPP;wBACG;wBAC+D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAK1E,SAAeA,MAAMC,GAAQ,EAAEC,SAAiB;;YAyBnDC,SACKC,eACCA,gBACCA,iBACAA,iBA5BXC,OACkCC,QAAhCF,QAAqBG,QACvBC,QACAC,YAEAC,KACAC,OAkBAC,GACAC,OACAC,QACAC,SACAC,SACAC;;;;oBA7BAZ,QAAQ,AAAC,UAAqBH,OAAZD,IAAIiB,IAAI,EAAC,KAAa,OAAVhB,WAAU;oBACNI,SAAAA,IAAAA,eAAK,EAACL,IAAIkB,IAAI,EAAEd,OAAO,mBAAKe,sBAAY,EAAKC,gBAAM,EAAKC,gBAAM,IAA9FlB,SAAgCE,OAAhCF,QAAqBG,SAAWD,OAAxBiB;oBACVf,SAASgB,IAAAA,qBAAW,EAACpB;oBACrBK,aAAaL,OAAOqB,MAAM;oBAE1Bf,MAAMT,IAAIyB,aAAa,CAACjB;oBACxBE,QAAQD,IAAIiB,OAAO,CAACzB,UAAU;oBACpC,IAAIS,UAAUiB,WAAW;wBACvBC,QAAQC,KAAK,CAAC,AAAC,oCAA6C,OAAV5B,WAAU;wBAC5D2B,QAAQC,KAAK,CAAC,AAAC,kBAA4D,OAA3CC,OAAOC,IAAI,CAACtB,IAAIiB,OAAO,EAAEM,IAAI,GAAGC,IAAI,CAAC;wBACrEC,QAAQC,IAAI,CAAC;oBACf;oBAEA,IAAI,SAASzB,OAAO;wBAClB,yFAAyF;wBACzF,wFAAwF;wBACxF0B,IAAAA,gBAAM,EAAC3B,KAAKC,MAAM2B,GAAG,EAAE/B,QAAQC,QAAQ,AAAC,UAAmB,OAAVN,WAAU,MAAIE,OAAOU,MAAM;wBAC5E;;;oBACF;oBAEA,uFAAuF;oBACvF,IAAIP,OAAOgC,MAAM,GAAG,GAAG;wBACrBtC,IAAIuC,UAAU,CAAC,AAAC,IAAuHvC,OAApHC,WAAU,4GAAmH,OAATD,IAAIiB,IAAI,EAAC;oBAClJ;oBACMN,KAAIT,UAAAA,IAAAA,gBAAM,EAACC,OAAOQ,CAAC,EAAwBX,IAAIuC,UAAU,eAArDrC,qBAAAA,UAA0DQ,MAAMC,CAAC;oBACrEC,SAAST,gBAAAA,OAAOS,KAAK,cAAZT,2BAAAA,gBAAuCO,MAAME,KAAK;oBAC3DC,UAAUV,iBAAAA,OAAOU,MAAM,cAAbV,4BAAAA,iBAAwCO,MAAMG,MAAM;oBAC9DC,WAAWX,kBAAAA,OAAOW,OAAO,cAAdX,6BAAAA,kBAA2CO,MAAMI,OAAO;oBACnEC,WAAWZ,kBAAAA,OAAOY,OAAO,cAAdZ,6BAAAA,kBAA2CO,MAAMK,OAAO;oBACnEC,YAAYb,MAAM,CAAC,aAAa,KAAK;oBAC3C;;wBAAMqC,IAAAA,gBAAM,EAACxC,KAAKQ,YAAY,SAAOiC,IAAIC;;;;;4CAA0B;;gDAAMC,IAAAA,eAAM,EAACF,IAAIC,aAAahC,MAAMiC,MAAM,EAAE;oDAAEhC,GAAAA;oDAAGC,OAAAA;oDAAOC,QAAAA;oDAAQC,SAAAA;oDAASC,SAAAA;oDAASC,WAAAA;gDAAU;;;;;gDAAtG4B,mBAAS;oDAAC;oDAAgGrC;;;;;;;;;oBAAnK;;;;;;IACF"}
|
package/dist/cjs/cli/path.js
CHANGED
|
@@ -29,9 +29,7 @@ function _define_property(obj, key, value) {
|
|
|
29
29
|
configurable: true,
|
|
30
30
|
writable: true
|
|
31
31
|
});
|
|
32
|
-
} else
|
|
33
|
-
obj[key] = value;
|
|
34
|
-
}
|
|
32
|
+
} else obj[key] = value;
|
|
35
33
|
return obj;
|
|
36
34
|
}
|
|
37
35
|
function _iterable_to_array_limit(arr, i) {
|
|
@@ -59,7 +57,7 @@ function _iterable_to_array_limit(arr, i) {
|
|
|
59
57
|
return _arr;
|
|
60
58
|
}
|
|
61
59
|
function _non_iterable_rest() {
|
|
62
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance
|
|
60
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
63
61
|
}
|
|
64
62
|
function _object_spread(target) {
|
|
65
63
|
for(var i = 1; i < arguments.length; i++){
|
|
@@ -91,9 +89,8 @@ function ownKeys(object, enumerableOnly) {
|
|
|
91
89
|
}
|
|
92
90
|
function _object_spread_props(target, source) {
|
|
93
91
|
source = source != null ? source : {};
|
|
94
|
-
if (Object.getOwnPropertyDescriptors)
|
|
95
|
-
|
|
96
|
-
} else {
|
|
92
|
+
if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
93
|
+
else {
|
|
97
94
|
ownKeys(Object(source)).forEach(function(key) {
|
|
98
95
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
99
96
|
});
|
package/dist/cjs/cli/path.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/path.ts"],"sourcesContent":["import { resolveNote, scopedPaths } from '../commands/index.ts';\nimport type { Row } from '../output.ts';\nimport { printRows } from '../output.ts';\nimport { findPath } from '../traverse.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, FORMAT, formatOf, parse, SCOPE, scopeOf, withDb } from './shared.ts';\nimport type { Command } from './types.ts';\n\n// --max-depth must be a positive integer, mirroring shared.ts's parseK.\nfunction parseMaxDepth(depth: string | undefined, usageError: (message: string) => never): number | undefined {\n if (depth === undefined) return undefined;\n const parsed = Number(depth);\n if (!Number.isInteger(parsed) || parsed <= 0) usageError(`--max-depth expects a positive integer, got \"${depth}\"`);\n return parsed;\n}\n\nconst pathCmd: Command = (ctx) => {\n const usage = `usage: ${ctx.name} ${USAGE.path}`;\n const { values, positionals } = parse(ctx.argv, usage, { ...SCOPE, ...FORMAT, ...CONFIG, 'max-depth': { type: 'string' } });\n const [a, b] = positionals;\n if (!a || !b) ctx.usageError(usage);\n const maxDepth = parseMaxDepth(values['max-depth'] as string | undefined, ctx.usageError);\n const format = formatOf(values);\n return withDb(ctx, values.config as string | undefined, (db, cfg) => {\n const paths = (db.prepare('SELECT \"path\" FROM frontmatter').all() as Array<{ path: string }>).map((r) => r.path);\n const from = resolveNote(paths, a);\n const to = resolveNote(paths, b);\n const allowed = scopedPaths(db, cfg, scopeOf(values));\n const hops = findPath(db, from, to, { maxDepth, allowed });\n\n if (format === 'json') {\n console.log(JSON.stringify(hops));\n return;\n }\n if (hops === null) {\n console.log(maxDepth ? `no path within ${maxDepth} hops` : 'no path');\n return;\n }\n const rows: Row[] = hops.map((p, step) => ({ step, path: p }));\n printRows(rows, format);\n });\n};\nexport default pathCmd;\n"],"names":["parseMaxDepth","depth","usageError","undefined","parsed","Number","isInteger","pathCmd","ctx","usage","USAGE","name","path","parse","argv","SCOPE","FORMAT","CONFIG","type","values","positionals","a","b","maxDepth","format","formatOf","withDb","config","db","cfg","paths","prepare","all","map","r","from","resolveNote","to","allowed","scopedPaths","scopeOf","hops","findPath","console","log","JSON","stringify","rows","p","step","printRows"],"mappings":";;;;+BA0CA;;;eAAA;;;uBA1CyC;wBAEf;0BACD;wBACH;wBACkD
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/path.ts"],"sourcesContent":["import { resolveNote, scopedPaths } from '../commands/index.ts';\nimport type { Row } from '../output.ts';\nimport { printRows } from '../output.ts';\nimport { findPath } from '../traverse.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, FORMAT, formatOf, parse, SCOPE, scopeOf, withDb } from './shared.ts';\nimport type { Command } from './types.ts';\n\n// --max-depth must be a positive integer, mirroring shared.ts's parseK.\nfunction parseMaxDepth(depth: string | undefined, usageError: (message: string) => never): number | undefined {\n if (depth === undefined) return undefined;\n const parsed = Number(depth);\n if (!Number.isInteger(parsed) || parsed <= 0) usageError(`--max-depth expects a positive integer, got \"${depth}\"`);\n return parsed;\n}\n\nconst pathCmd: Command = (ctx) => {\n const usage = `usage: ${ctx.name} ${USAGE.path}`;\n const { values, positionals } = parse(ctx.argv, usage, { ...SCOPE, ...FORMAT, ...CONFIG, 'max-depth': { type: 'string' } });\n const [a, b] = positionals;\n if (!a || !b) ctx.usageError(usage);\n const maxDepth = parseMaxDepth(values['max-depth'] as string | undefined, ctx.usageError);\n const format = formatOf(values);\n return withDb(ctx, values.config as string | undefined, (db, cfg) => {\n const paths = (db.prepare('SELECT \"path\" FROM frontmatter').all() as Array<{ path: string }>).map((r) => r.path);\n const from = resolveNote(paths, a);\n const to = resolveNote(paths, b);\n const allowed = scopedPaths(db, cfg, scopeOf(values));\n const hops = findPath(db, from, to, { maxDepth, allowed });\n\n if (format === 'json') {\n console.log(JSON.stringify(hops));\n return;\n }\n if (hops === null) {\n console.log(maxDepth ? `no path within ${maxDepth} hops` : 'no path');\n return;\n }\n const rows: Row[] = hops.map((p, step) => ({ step, path: p }));\n printRows(rows, format);\n });\n};\nexport default pathCmd;\n"],"names":["parseMaxDepth","depth","usageError","undefined","parsed","Number","isInteger","pathCmd","ctx","usage","USAGE","name","path","parse","argv","SCOPE","FORMAT","CONFIG","type","values","positionals","a","b","maxDepth","format","formatOf","withDb","config","db","cfg","paths","prepare","all","map","r","from","resolveNote","to","allowed","scopedPaths","scopeOf","hops","findPath","console","log","JSON","stringify","rows","p","step","printRows"],"mappings":";;;;+BA0CA;;;eAAA;;;uBA1CyC;wBAEf;0BACD;wBACH;wBACkD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGxE,wEAAwE;AACxE,SAASA,cAAcC,KAAyB,EAAEC,UAAsC;IACtF,IAAID,UAAUE,WAAW,OAAOA;IAChC,IAAMC,SAASC,OAAOJ;IACtB,IAAI,CAACI,OAAOC,SAAS,CAACF,WAAWA,UAAU,GAAGF,WAAW,AAAC,gDAAqD,OAAND,OAAM;IAC/G,OAAOG;AACT;AAEA,IAAMG,UAAmB,iBAACC;IACxB,IAAMC,QAAQ,AAAC,UAAqBC,OAAZF,IAAIG,IAAI,EAAC,KAAc,OAAXD,eAAK,CAACE,IAAI;IAC9C,IAAgCC,SAAAA,IAAAA,eAAK,EAACL,IAAIM,IAAI,EAAEL,OAAO,wCAAKM,eAAK,EAAKC,gBAAM,EAAKC,gBAAM;QAAE,aAAa;YAAEC,MAAM;QAAS;SAA/GC,SAAwBN,OAAxBM,QAAQC,cAAgBP,OAAhBO;IAChB,IAAeA,gCAAAA,iBAARC,IAAQD,iBAALE,IAAKF;IACf,IAAI,CAACC,KAAK,CAACC,GAAGd,IAAIN,UAAU,CAACO;IAC7B,IAAMc,WAAWvB,cAAcmB,MAAM,CAAC,YAAY,EAAwBX,IAAIN,UAAU;IACxF,IAAMsB,SAASC,IAAAA,kBAAQ,EAACN;IACxB,OAAOO,IAAAA,gBAAM,EAAClB,KAAKW,OAAOQ,MAAM,EAAwB,SAACC,IAAIC;QAC3D,IAAMC,QAAQ,AAACF,GAAGG,OAAO,CAAC,kCAAkCC,GAAG,GAA+BC,GAAG,CAAC,SAACC;mBAAMA,EAAEtB,IAAI;;QAC/G,IAAMuB,OAAOC,IAAAA,oBAAW,EAACN,OAAOT;QAChC,IAAMgB,KAAKD,IAAAA,oBAAW,EAACN,OAAOR;QAC9B,IAAMgB,UAAUC,IAAAA,oBAAW,EAACX,IAAIC,KAAKW,IAAAA,iBAAO,EAACrB;QAC7C,IAAMsB,OAAOC,IAAAA,oBAAQ,EAACd,IAAIO,MAAME,IAAI;YAAEd,UAAAA;YAAUe,SAAAA;QAAQ;QAExD,IAAId,WAAW,QAAQ;YACrBmB,QAAQC,GAAG,CAACC,KAAKC,SAAS,CAACL;YAC3B;QACF;QACA,IAAIA,SAAS,MAAM;YACjBE,QAAQC,GAAG,CAACrB,WAAW,AAAC,kBAA0B,OAATA,UAAS,WAAS;YAC3D;QACF;QACA,IAAMwB,OAAcN,KAAKR,GAAG,CAAC,SAACe,GAAGC;mBAAU;gBAAEA,MAAAA;gBAAMrC,MAAMoC;YAAE;;QAC3DE,IAAAA,mBAAS,EAACH,MAAMvB;IAClB;AACF;IACA,WAAejB"}
|
package/dist/cjs/cli/peek.js
CHANGED
|
@@ -28,9 +28,7 @@ function _define_property(obj, key, value) {
|
|
|
28
28
|
configurable: true,
|
|
29
29
|
writable: true
|
|
30
30
|
});
|
|
31
|
-
} else
|
|
32
|
-
obj[key] = value;
|
|
33
|
-
}
|
|
31
|
+
} else obj[key] = value;
|
|
34
32
|
return obj;
|
|
35
33
|
}
|
|
36
34
|
function _iterable_to_array_limit(arr, i) {
|
|
@@ -58,7 +56,7 @@ function _iterable_to_array_limit(arr, i) {
|
|
|
58
56
|
return _arr;
|
|
59
57
|
}
|
|
60
58
|
function _non_iterable_rest() {
|
|
61
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance
|
|
59
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
62
60
|
}
|
|
63
61
|
function _object_spread(target) {
|
|
64
62
|
for(var i = 1; i < arguments.length; i++){
|
package/dist/cjs/cli/peek.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/peek.ts"],"sourcesContent":["import { peek } from '../commands/index.ts';\nimport { renderPeek } 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 peekCmd: Command = (ctx) => {\n const usage = `usage: ${ctx.name} ${USAGE.peek}`;\n const { values, positionals } = parse(ctx.argv, usage, { ...SCOPE, ...FORMAT, ...CONFIG });\n const [pathArg] = positionals;\n if (!pathArg) ctx.usageError(usage);\n const format = formatOf(values);\n return withDb(ctx, values.config as string | undefined, (db, cfg) => {\n const overrides = scopeOf(values);\n const result = peek(db, cfg, pathArg, overrides);\n console.log(format === 'json' ? JSON.stringify(result, null, 2) : renderPeek(result));\n });\n};\nexport default peekCmd;\n"],"names":["peekCmd","ctx","usage","USAGE","name","peek","parse","argv","SCOPE","FORMAT","CONFIG","values","positionals","pathArg","usageError","format","formatOf","withDb","config","db","cfg","overrides","scopeOf","result","console","log","JSON","stringify","renderPeek"],"mappings":";;;;+BAkBA;;;eAAA;;;uBAlBqB;wBACM;wBACL;wBACkD
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/peek.ts"],"sourcesContent":["import { peek } from '../commands/index.ts';\nimport { renderPeek } from '../output.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, FORMAT, formatOf, parse, SCOPE, scopeOf, withDb } from './shared.ts';\nimport type { Command } from './types.ts';\n\nconst peekCmd: Command = (ctx) => {\n const usage = `usage: ${ctx.name} ${USAGE.peek}`;\n const { values, positionals } = parse(ctx.argv, usage, { ...SCOPE, ...FORMAT, ...CONFIG });\n const [pathArg] = positionals;\n if (!pathArg) ctx.usageError(usage);\n const format = formatOf(values);\n return withDb(ctx, values.config as string | undefined, (db, cfg) => {\n const overrides = scopeOf(values);\n const result = peek(db, cfg, pathArg, overrides);\n console.log(format === 'json' ? JSON.stringify(result, null, 2) : renderPeek(result));\n });\n};\nexport default peekCmd;\n"],"names":["peekCmd","ctx","usage","USAGE","name","peek","parse","argv","SCOPE","FORMAT","CONFIG","values","positionals","pathArg","usageError","format","formatOf","withDb","config","db","cfg","overrides","scopeOf","result","console","log","JSON","stringify","renderPeek"],"mappings":";;;;+BAkBA;;;eAAA;;;uBAlBqB;wBACM;wBACL;wBACkD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGxE,IAAMA,UAAmB,iBAACC;IACxB,IAAMC,QAAQ,AAAC,UAAqBC,OAAZF,IAAIG,IAAI,EAAC,KAAc,OAAXD,eAAK,CAACE,IAAI;IAC9C,IAAgCC,SAAAA,IAAAA,eAAK,EAACL,IAAIM,IAAI,EAAEL,OAAO,mBAAKM,eAAK,EAAKC,gBAAM,EAAKC,gBAAM,IAA/EC,SAAwBL,OAAxBK,QAAQC,cAAgBN,OAAhBM;IAChB,IAAkBA,gCAAAA,iBAAXC,UAAWD;IAClB,IAAI,CAACC,SAASZ,IAAIa,UAAU,CAACZ;IAC7B,IAAMa,SAASC,IAAAA,kBAAQ,EAACL;IACxB,OAAOM,IAAAA,gBAAM,EAAChB,KAAKU,OAAOO,MAAM,EAAwB,SAACC,IAAIC;QAC3D,IAAMC,YAAYC,IAAAA,iBAAO,EAACX;QAC1B,IAAMY,SAASlB,IAAAA,aAAI,EAACc,IAAIC,KAAKP,SAASQ;QACtCG,QAAQC,GAAG,CAACV,WAAW,SAASW,KAAKC,SAAS,CAACJ,QAAQ,MAAM,KAAKK,IAAAA,oBAAU,EAACL;IAC/E;AACF;IACA,WAAevB"}
|
package/dist/cjs/cli/related.js
CHANGED
|
@@ -28,11 +28,8 @@ function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
|
28
28
|
reject(error);
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
|
-
if (info.done)
|
|
32
|
-
|
|
33
|
-
} else {
|
|
34
|
-
Promise.resolve(value).then(_next, _throw);
|
|
35
|
-
}
|
|
31
|
+
if (info.done) resolve(value);
|
|
32
|
+
else Promise.resolve(value).then(_next, _throw);
|
|
36
33
|
}
|
|
37
34
|
function _async_to_generator(fn) {
|
|
38
35
|
return function() {
|
|
@@ -57,9 +54,7 @@ function _define_property(obj, key, value) {
|
|
|
57
54
|
configurable: true,
|
|
58
55
|
writable: true
|
|
59
56
|
});
|
|
60
|
-
} else
|
|
61
|
-
obj[key] = value;
|
|
62
|
-
}
|
|
57
|
+
} else obj[key] = value;
|
|
63
58
|
return obj;
|
|
64
59
|
}
|
|
65
60
|
function _iterable_to_array_limit(arr, i) {
|
|
@@ -87,7 +82,7 @@ function _iterable_to_array_limit(arr, i) {
|
|
|
87
82
|
return _arr;
|
|
88
83
|
}
|
|
89
84
|
function _non_iterable_rest() {
|
|
90
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance
|
|
85
|
+
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
86
|
}
|
|
92
87
|
function _object_spread(target) {
|
|
93
88
|
for(var i = 1; i < arguments.length; i++){
|
|
@@ -119,9 +114,8 @@ function ownKeys(object, enumerableOnly) {
|
|
|
119
114
|
}
|
|
120
115
|
function _object_spread_props(target, source) {
|
|
121
116
|
source = source != null ? source : {};
|
|
122
|
-
if (Object.getOwnPropertyDescriptors)
|
|
123
|
-
|
|
124
|
-
} else {
|
|
117
|
+
if (Object.getOwnPropertyDescriptors) Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
|
|
118
|
+
else {
|
|
125
119
|
ownKeys(Object(source)).forEach(function(key) {
|
|
126
120
|
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
127
121
|
});
|
|
@@ -131,14 +125,6 @@ function _object_spread_props(target, source) {
|
|
|
131
125
|
function _sliced_to_array(arr, i) {
|
|
132
126
|
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
133
127
|
}
|
|
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
128
|
function _ts_generator(thisArg, body) {
|
|
143
129
|
var f, y, t, _ = {
|
|
144
130
|
label: 0,
|
|
@@ -238,6 +224,14 @@ function _ts_generator(thisArg, body) {
|
|
|
238
224
|
};
|
|
239
225
|
}
|
|
240
226
|
}
|
|
227
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
228
|
+
if (!o) return;
|
|
229
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
230
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
231
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
232
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
233
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
234
|
+
}
|
|
241
235
|
var RELATED_DEFAULT_K = 5;
|
|
242
236
|
var relatedCmd = function relatedCmd(ctx) {
|
|
243
237
|
var _parseK;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/related.ts"],"sourcesContent":["import { relatedNotes } from '../commands/index.ts';\nimport type { Row } from '../output.ts';\nimport { printRows } from '../output.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, FORMAT, parse, parseK, rowFormatOf, SCOPE, scopeOf, withDb } from './shared.ts';\nimport type { Command } from './types.ts';\n\nconst RELATED_DEFAULT_K = 5;\n\nconst relatedCmd: Command = (ctx) => {\n const usage = `usage: ${ctx.name} ${USAGE.related}`;\n const { values, positionals } = parse(ctx.argv, usage, { ...SCOPE, ...FORMAT, ...CONFIG, k: { type: 'string' } });\n const [pathArg] = positionals;\n if (!pathArg) ctx.usageError(usage);\n const k = parseK(values.k as string | undefined, ctx.usageError) ?? RELATED_DEFAULT_K;\n const format = rowFormatOf(values);\n return withDb(ctx, values.config as string | undefined, async (db, cfg) => {\n const overrides = scopeOf(values);\n printRows((await relatedNotes(db, cfg, pathArg, overrides, k)) as Row[], format);\n });\n};\nexport default relatedCmd;\n"],"names":["RELATED_DEFAULT_K","relatedCmd","ctx","parseK","usage","USAGE","name","related","parse","argv","SCOPE","FORMAT","CONFIG","k","type","values","positionals","pathArg","usageError","format","rowFormatOf","withDb","config","db","cfg","overrides","scopeOf","relatedNotes","printRows"],"mappings":";;;;+BAqBA;;;eAAA;;;uBArB6B;wBAEH;wBACJ;wBAC6D
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/related.ts"],"sourcesContent":["import { relatedNotes } from '../commands/index.ts';\nimport type { Row } from '../output.ts';\nimport { printRows } from '../output.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, FORMAT, parse, parseK, rowFormatOf, SCOPE, scopeOf, withDb } from './shared.ts';\nimport type { Command } from './types.ts';\n\nconst RELATED_DEFAULT_K = 5;\n\nconst relatedCmd: Command = (ctx) => {\n const usage = `usage: ${ctx.name} ${USAGE.related}`;\n const { values, positionals } = parse(ctx.argv, usage, { ...SCOPE, ...FORMAT, ...CONFIG, k: { type: 'string' } });\n const [pathArg] = positionals;\n if (!pathArg) ctx.usageError(usage);\n const k = parseK(values.k as string | undefined, ctx.usageError) ?? RELATED_DEFAULT_K;\n const format = rowFormatOf(values);\n return withDb(ctx, values.config as string | undefined, async (db, cfg) => {\n const overrides = scopeOf(values);\n printRows((await relatedNotes(db, cfg, pathArg, overrides, k)) as Row[], format);\n });\n};\nexport default relatedCmd;\n"],"names":["RELATED_DEFAULT_K","relatedCmd","ctx","parseK","usage","USAGE","name","related","parse","argv","SCOPE","FORMAT","CONFIG","k","type","values","positionals","pathArg","usageError","format","rowFormatOf","withDb","config","db","cfg","overrides","scopeOf","relatedNotes","printRows"],"mappings":";;;;+BAqBA;;;eAAA;;;uBArB6B;wBAEH;wBACJ;wBAC6D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGnF,IAAMA,oBAAoB;AAE1B,IAAMC,aAAsB,oBAACC;QAKjBC;IAJV,IAAMC,QAAQ,AAAC,UAAqBC,OAAZH,IAAII,IAAI,EAAC,KAAiB,OAAdD,eAAK,CAACE,OAAO;IACjD,IAAgCC,SAAAA,IAAAA,eAAK,EAACN,IAAIO,IAAI,EAAEL,OAAO,wCAAKM,eAAK,EAAKC,gBAAM,EAAKC,gBAAM;QAAEC,GAAG;YAAEC,MAAM;QAAS;SAArGC,SAAwBP,OAAxBO,QAAQC,cAAgBR,OAAhBQ;IAChB,IAAkBA,gCAAAA,iBAAXC,UAAWD;IAClB,IAAI,CAACC,SAASf,IAAIgB,UAAU,CAACd;IAC7B,IAAMS,KAAIV,UAAAA,IAAAA,gBAAM,EAACY,OAAOF,CAAC,EAAwBX,IAAIgB,UAAU,eAArDf,qBAAAA,UAA0DH;IACpE,IAAMmB,SAASC,IAAAA,qBAAW,EAACL;IAC3B,OAAOM,IAAAA,gBAAM,EAACnB,KAAKa,OAAOO,MAAM,EAAwB,SAAOC,IAAIC;;gBAC3DC;;;;wBAAAA,YAAYC,IAAAA,iBAAO,EAACX;wBACf;;4BAAMY,IAAAA,qBAAY,EAACJ,IAAIC,KAAKP,SAASQ,WAAWZ;;;wBAA3De,mBAAS;4BAAE;4BAA8DT;;;;;;;QAC3E;;AACF;IACA,WAAelB"}
|