sensemaking 0.28.1 → 0.28.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/chunk/extract.js +2 -2
- package/dist/cjs/chunk/extract.js.map +1 -1
- package/dist/cjs/chunk/group.js +15 -15
- package/dist/cjs/chunk/group.js.map +1 -1
- package/dist/cjs/chunk/index.js +13 -13
- package/dist/cjs/chunk/index.js.map +1 -1
- package/dist/cjs/chunk/parse.js +4 -4
- package/dist/cjs/chunk/parse.js.map +1 -1
- package/dist/cjs/chunk/parser.js.map +1 -1
- package/dist/cjs/chunk/tokens.js +2 -2
- package/dist/cjs/chunk/tokens.js.map +1 -1
- package/dist/cjs/cli/build.js +7 -7
- package/dist/cjs/cli/build.js.map +1 -1
- package/dist/cjs/cli/download.js +12 -12
- package/dist/cjs/cli/download.js.map +1 -1
- package/dist/cjs/cli/init.js +6 -6
- package/dist/cjs/cli/init.js.map +1 -1
- package/dist/cjs/cli/map.js +9 -9
- package/dist/cjs/cli/map.js.map +1 -1
- package/dist/cjs/cli/named.js +21 -21
- package/dist/cjs/cli/named.js.map +1 -1
- package/dist/cjs/cli/path.js +11 -11
- package/dist/cjs/cli/path.js.map +1 -1
- package/dist/cjs/cli/peek.js +12 -12
- package/dist/cjs/cli/peek.js.map +1 -1
- package/dist/cjs/cli/related.js +20 -20
- package/dist/cjs/cli/related.js.map +1 -1
- package/dist/cjs/cli/search.js +22 -22
- package/dist/cjs/cli/search.js.map +1 -1
- package/dist/cjs/cli/shared.js +16 -16
- package/dist/cjs/cli/shared.js.map +1 -1
- package/dist/cjs/cli/sql.js +7 -7
- package/dist/cjs/cli/sql.js.map +1 -1
- package/dist/cjs/cli/status.js +41 -41
- package/dist/cjs/cli/status.js.map +1 -1
- package/dist/cjs/cli/watch.js +7 -7
- package/dist/cjs/cli/watch.js.map +1 -1
- package/dist/cjs/cli.js +16 -16
- package/dist/cjs/cli.js.map +1 -1
- package/dist/cjs/commands/index.js +15 -15
- package/dist/cjs/commands/index.js.map +1 -1
- package/dist/cjs/commands/map.js +14 -14
- package/dist/cjs/commands/map.js.map +1 -1
- package/dist/cjs/commands/path.js +16 -16
- package/dist/cjs/commands/path.js.map +1 -1
- package/dist/cjs/commands/peek.js +24 -24
- package/dist/cjs/commands/peek.js.map +1 -1
- package/dist/cjs/commands/related.js +29 -29
- package/dist/cjs/commands/related.js.map +1 -1
- package/dist/cjs/commands/scope.js +11 -11
- package/dist/cjs/commands/scope.js.map +1 -1
- package/dist/cjs/commands/search.js +44 -44
- package/dist/cjs/commands/search.js.map +1 -1
- package/dist/cjs/commands/signals.js +10 -10
- package/dist/cjs/commands/signals.js.map +1 -1
- package/dist/cjs/commands/snapshot.js +11 -11
- package/dist/cjs/commands/snapshot.js.map +1 -1
- package/dist/cjs/commands/status.js +4 -4
- package/dist/cjs/commands/status.js.map +1 -1
- package/dist/cjs/config/access.js +5 -5
- package/dist/cjs/config/access.js.map +1 -1
- package/dist/cjs/config/index.js +31 -31
- package/dist/cjs/config/index.js.map +1 -1
- package/dist/cjs/config/load.js +27 -27
- package/dist/cjs/config/load.js.map +1 -1
- package/dist/cjs/config/resolve.js +4 -4
- package/dist/cjs/config/resolve.js.map +1 -1
- package/dist/cjs/config/validate.js +54 -54
- package/dist/cjs/config/validate.js.map +1 -1
- package/dist/cjs/embed/cohere.js +11 -11
- package/dist/cjs/embed/cohere.js.map +1 -1
- package/dist/cjs/embed/distribution.js +3 -3
- package/dist/cjs/embed/distribution.js.map +1 -1
- package/dist/cjs/embed/endpoint.js.map +1 -1
- package/dist/cjs/embed/handoff.js.map +1 -1
- package/dist/cjs/embed/http.js +3 -3
- package/dist/cjs/embed/http.js.map +1 -1
- package/dist/cjs/embed/identity.js +4 -4
- package/dist/cjs/embed/identity.js.map +1 -1
- package/dist/cjs/embed/langfit.js +8 -8
- package/dist/cjs/embed/langfit.js.map +1 -1
- package/dist/cjs/embed/openai.js +12 -12
- package/dist/cjs/embed/openai.js.map +1 -1
- package/dist/cjs/embed/query.js +36 -36
- package/dist/cjs/embed/query.js.map +1 -1
- package/dist/cjs/embed/registry.js +14 -14
- package/dist/cjs/embed/registry.js.map +1 -1
- package/dist/cjs/embed/static.js +10 -10
- package/dist/cjs/embed/static.js.map +1 -1
- package/dist/cjs/embed/store.d.cts +1 -1
- package/dist/cjs/embed/store.d.ts +1 -1
- package/dist/cjs/embed/store.js +193 -70
- package/dist/cjs/embed/store.js.map +1 -1
- package/dist/cjs/features/embed.js +16 -16
- package/dist/cjs/features/embed.js.map +1 -1
- package/dist/cjs/features/index.js +15 -15
- package/dist/cjs/features/index.js.map +1 -1
- package/dist/cjs/features/links.js +5 -5
- package/dist/cjs/features/links.js.map +1 -1
- package/dist/cjs/features/rank.js +5 -5
- package/dist/cjs/features/rank.js.map +1 -1
- package/dist/cjs/features/sections.js +7 -7
- package/dist/cjs/features/sections.js.map +1 -1
- package/dist/cjs/features/tags.js +5 -5
- package/dist/cjs/features/tags.js.map +1 -1
- package/dist/cjs/graph/graph.js +1 -1
- package/dist/cjs/graph/graph.js.map +1 -1
- package/dist/cjs/graph/traverse.js +3 -3
- package/dist/cjs/graph/traverse.js.map +1 -1
- package/dist/cjs/index.js +27 -27
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/lib/atomic-write.js.map +1 -1
- package/dist/cjs/lib/watch-notification.js +2 -2
- package/dist/cjs/lib/watch-notification.js.map +1 -1
- package/dist/cjs/lib/worker-file.js.map +1 -1
- package/dist/cjs/output/column-hint.js +1 -1
- package/dist/cjs/output/output.js +1 -1
- package/dist/cjs/output/output.js.map +1 -1
- package/dist/cjs/output/progress.js.map +1 -1
- package/dist/cjs/output/search-error.js +7 -7
- package/dist/cjs/output/search-error.js.map +1 -1
- package/dist/cjs/scan/frontmatter.js +1 -1
- package/dist/cjs/scan/frontmatter.js.map +1 -1
- package/dist/cjs/scan/index.js +18 -18
- package/dist/cjs/scan/index.js.map +1 -1
- package/dist/cjs/scan/list.js +6 -6
- package/dist/cjs/scan/list.js.map +1 -1
- package/dist/cjs/scan/pool.js +5 -5
- package/dist/cjs/scan/pool.js.map +1 -1
- package/dist/cjs/scan/reparse.js +5 -5
- package/dist/cjs/scan/reparse.js.map +1 -1
- package/dist/cjs/scan/worker-error.js +3 -3
- package/dist/cjs/scan/worker-error.js.map +1 -1
- package/dist/cjs/store/batch.js +1 -1
- package/dist/cjs/store/builder.js +61 -61
- package/dist/cjs/store/builder.js.map +1 -1
- package/dist/cjs/store/cache.js +2 -2
- package/dist/cjs/store/cache.js.map +1 -1
- package/dist/cjs/store/duckdb/batch.js +3 -3
- package/dist/cjs/store/duckdb/batch.js.map +1 -1
- package/dist/cjs/store/duckdb/connection.js +10 -10
- package/dist/cjs/store/duckdb/connection.js.map +1 -1
- package/dist/cjs/store/duckdb/engine.js +4 -4
- package/dist/cjs/store/duckdb/engine.js.map +1 -1
- package/dist/cjs/store/duckdb/fieldStats.js +3 -3
- package/dist/cjs/store/duckdb/fieldStats.js.map +1 -1
- package/dist/cjs/store/duckdb/lexical.js +28 -28
- package/dist/cjs/store/duckdb/lexical.js.map +1 -1
- package/dist/cjs/store/duckdb/native.js +3 -3
- package/dist/cjs/store/duckdb/native.js.map +1 -1
- package/dist/cjs/store/duckdb/open.js +39 -39
- package/dist/cjs/store/duckdb/open.js.map +1 -1
- package/dist/cjs/store/duckdb/reconcile.js +15 -15
- package/dist/cjs/store/duckdb/reconcile.js.map +1 -1
- package/dist/cjs/store/duckdb/sql-functions.js +7 -7
- package/dist/cjs/store/duckdb/sql-functions.js.map +1 -1
- package/dist/cjs/store/duckdb/store.js +19 -19
- package/dist/cjs/store/duckdb/store.js.map +1 -1
- package/dist/cjs/store/duckdb/vectors.js +11 -11
- package/dist/cjs/store/duckdb/vectors.js.map +1 -1
- package/dist/cjs/store/embed-scope.js +1 -1
- package/dist/cjs/store/engine.js +2 -2
- package/dist/cjs/store/engine.js.map +1 -1
- package/dist/cjs/store/feature-scope.js +1 -1
- package/dist/cjs/store/index.js +37 -37
- package/dist/cjs/store/index.js.map +1 -1
- package/dist/cjs/store/lock-wait.js +2 -2
- package/dist/cjs/store/lock-wait.js.map +1 -1
- package/dist/cjs/store/native.js +14 -6
- package/dist/cjs/store/native.js.map +1 -1
- package/dist/cjs/store/open.js +44 -44
- package/dist/cjs/store/open.js.map +1 -1
- package/dist/cjs/store/preset-scope.js +5 -5
- package/dist/cjs/store/preset-scope.js.map +1 -1
- package/dist/cjs/store/reconcile.js +28 -28
- package/dist/cjs/store/reconcile.js.map +1 -1
- package/dist/cjs/store/shared.js.map +1 -1
- package/dist/cjs/store/signature.js +1 -1
- package/dist/cjs/store/sql-functions.js.map +1 -1
- package/dist/cjs/store/sqlite/connection.js +4 -4
- package/dist/cjs/store/sqlite/connection.js.map +1 -1
- package/dist/cjs/store/sqlite/engine.js +3 -3
- package/dist/cjs/store/sqlite/engine.js.map +1 -1
- package/dist/cjs/store/sqlite/fieldStats.js +3 -3
- package/dist/cjs/store/sqlite/fieldStats.js.map +1 -1
- package/dist/cjs/store/sqlite/lexical.js +4 -4
- package/dist/cjs/store/sqlite/lexical.js.map +1 -1
- package/dist/cjs/store/sqlite/open.js +31 -31
- package/dist/cjs/store/sqlite/open.js.map +1 -1
- package/dist/cjs/store/sqlite/reconcile.js +11 -11
- package/dist/cjs/store/sqlite/reconcile.js.map +1 -1
- package/dist/cjs/store/sqlite/sql-functions.js +5 -5
- package/dist/cjs/store/sqlite/sql-functions.js.map +1 -1
- package/dist/cjs/store/sqlite/store.js +17 -17
- package/dist/cjs/store/sqlite/store.js.map +1 -1
- package/dist/cjs/store/sqlite/vectors.js +9 -9
- package/dist/cjs/store/sqlite/vectors.js.map +1 -1
- package/dist/cjs/store/stages.js +1 -1
- package/dist/cjs/store/transaction.js.map +1 -1
- package/dist/cjs/store/turso/connection.js +15 -15
- package/dist/cjs/store/turso/connection.js.map +1 -1
- package/dist/cjs/store/turso/engine.js +4 -4
- package/dist/cjs/store/turso/engine.js.map +1 -1
- package/dist/cjs/store/turso/fieldStats.js +3 -3
- package/dist/cjs/store/turso/fieldStats.js.map +1 -1
- package/dist/cjs/store/turso/lexical-text.js +3 -3
- package/dist/cjs/store/turso/lexical-text.js.map +1 -1
- package/dist/cjs/store/turso/lexical.js +13 -13
- package/dist/cjs/store/turso/lexical.js.map +1 -1
- package/dist/cjs/store/turso/native.js +3 -3
- package/dist/cjs/store/turso/native.js.map +1 -1
- package/dist/cjs/store/turso/open.js +41 -41
- package/dist/cjs/store/turso/open.js.map +1 -1
- package/dist/cjs/store/turso/reconcile.js +15 -15
- package/dist/cjs/store/turso/reconcile.js.map +1 -1
- package/dist/cjs/store/turso/sql-functions.js +2 -2
- package/dist/cjs/store/turso/sql-functions.js.map +1 -1
- package/dist/cjs/store/turso/store.js +26 -26
- package/dist/cjs/store/turso/store.js.map +1 -1
- package/dist/cjs/store/turso/vectors.js +9 -9
- package/dist/cjs/store/turso/vectors.js.map +1 -1
- package/dist/cjs/text/segment.js.map +1 -1
- package/dist/cjs/text/strip.js +4 -4
- package/dist/cjs/text/strip.js.map +1 -1
- package/dist/cjs/watch-claim.js +11 -11
- package/dist/cjs/watch-claim.js.map +1 -1
- package/dist/cjs/watch.js +18 -18
- package/dist/cjs/watch.js.map +1 -1
- package/dist/cjs/workers/parse.js +7 -7
- package/dist/cjs/workers/parse.js.map +1 -1
- package/dist/cjs/workers/watch-heartbeat.js +8 -8
- package/dist/cjs/workers/watch-heartbeat.js.map +1 -1
- package/dist/esm/chunk/extract.js +1 -1
- package/dist/esm/chunk/extract.js.map +1 -1
- package/dist/esm/chunk/group.js +3 -3
- package/dist/esm/chunk/group.js.map +1 -1
- package/dist/esm/chunk/index.js +6 -6
- package/dist/esm/chunk/parse.js +2 -2
- package/dist/esm/chunk/tokens.js +1 -1
- package/dist/esm/cli/build.js +3 -3
- package/dist/esm/cli/download.js +5 -5
- package/dist/esm/cli/index.js +11 -11
- package/dist/esm/cli/init.js +3 -3
- package/dist/esm/cli/map.js +4 -4
- package/dist/esm/cli/named.js +7 -7
- package/dist/esm/cli/path.js +4 -4
- package/dist/esm/cli/path.js.map +1 -1
- package/dist/esm/cli/peek.js +4 -4
- package/dist/esm/cli/related.js +7 -7
- package/dist/esm/cli/search.js +7 -7
- package/dist/esm/cli/search.js.map +1 -1
- package/dist/esm/cli/shared.js +6 -6
- package/dist/esm/cli/shared.js.map +1 -1
- package/dist/esm/cli/sql.js +2 -2
- package/dist/esm/cli/status.js +11 -11
- package/dist/esm/cli/status.js.map +1 -1
- package/dist/esm/cli/watch.js +3 -3
- package/dist/esm/cli.js +4 -4
- package/dist/esm/cli.js.map +1 -1
- package/dist/esm/commands/index.js +7 -7
- package/dist/esm/commands/map.js +5 -5
- package/dist/esm/commands/map.js.map +1 -1
- package/dist/esm/commands/path.js +7 -7
- package/dist/esm/commands/path.js.map +1 -1
- package/dist/esm/commands/peek.js +6 -6
- package/dist/esm/commands/peek.js.map +1 -1
- package/dist/esm/commands/related.js +8 -8
- package/dist/esm/commands/related.js.map +1 -1
- package/dist/esm/commands/scope.js +3 -3
- package/dist/esm/commands/scope.js.map +1 -1
- package/dist/esm/commands/search.js +10 -10
- package/dist/esm/commands/search.js.map +1 -1
- package/dist/esm/commands/signals.js +4 -4
- package/dist/esm/commands/signals.js.map +1 -1
- package/dist/esm/commands/snapshot.js +4 -4
- package/dist/esm/commands/status.js +1 -1
- package/dist/esm/commands/status.js.map +1 -1
- package/dist/esm/config/access.js +1 -1
- package/dist/esm/config/index.js +6 -6
- package/dist/esm/config/load.js +4 -4
- package/dist/esm/config/load.js.map +1 -1
- package/dist/esm/config/resolve.js +2 -2
- package/dist/esm/config/validate.js +3 -3
- package/dist/esm/config/validate.js.map +1 -1
- package/dist/esm/embed/cohere.js +3 -3
- package/dist/esm/embed/cohere.js.map +1 -1
- package/dist/esm/embed/distribution.js +1 -1
- package/dist/esm/embed/http.js +1 -1
- package/dist/esm/embed/identity.js +1 -1
- package/dist/esm/embed/langfit.js +3 -3
- package/dist/esm/embed/openai.js +3 -3
- package/dist/esm/embed/openai.js.map +1 -1
- package/dist/esm/embed/query.js +13 -13
- package/dist/esm/embed/query.js.map +1 -1
- package/dist/esm/embed/registry.js +6 -6
- package/dist/esm/embed/registry.js.map +1 -1
- package/dist/esm/embed/static.js +2 -2
- package/dist/esm/embed/store.d.ts +1 -1
- package/dist/esm/embed/store.js +84 -15
- package/dist/esm/embed/store.js.map +1 -1
- package/dist/esm/features/embed.js +7 -7
- package/dist/esm/features/embed.js.map +1 -1
- package/dist/esm/features/index.js +7 -7
- package/dist/esm/features/links.js +2 -2
- package/dist/esm/features/links.js.map +1 -1
- package/dist/esm/features/rank.js +2 -2
- package/dist/esm/features/rank.js.map +1 -1
- package/dist/esm/features/sections.js +3 -3
- package/dist/esm/features/tags.js +2 -2
- package/dist/esm/graph/graph.js.map +1 -1
- package/dist/esm/graph/traverse.js +1 -1
- package/dist/esm/index.js +6 -6
- package/dist/esm/lib/atomic-write.js.map +1 -1
- package/dist/esm/lib/watch-notification.js +1 -1
- package/dist/esm/output/output.js.map +1 -1
- package/dist/esm/output/progress.js.map +1 -1
- package/dist/esm/output/search-error.js +2 -2
- package/dist/esm/scan/index.js +5 -5
- package/dist/esm/scan/list.js +1 -1
- package/dist/esm/scan/pool.js +2 -2
- package/dist/esm/scan/pool.js.map +1 -1
- package/dist/esm/scan/reparse.js +2 -2
- package/dist/esm/scan/reparse.js.map +1 -1
- package/dist/esm/scan/worker-error.js +1 -1
- package/dist/esm/store/builder.js +16 -16
- package/dist/esm/store/builder.js.map +1 -1
- package/dist/esm/store/cache.js +1 -1
- package/dist/esm/store/duckdb/batch.js +1 -1
- package/dist/esm/store/duckdb/connection.js +4 -4
- package/dist/esm/store/duckdb/engine.js +2 -2
- package/dist/esm/store/duckdb/engine.js.map +1 -1
- package/dist/esm/store/duckdb/fieldStats.js +1 -1
- package/dist/esm/store/duckdb/lexical.js +6 -6
- package/dist/esm/store/duckdb/lexical.js.map +1 -1
- package/dist/esm/store/duckdb/native.js +1 -1
- package/dist/esm/store/duckdb/native.js.map +1 -1
- package/dist/esm/store/duckdb/open.js +14 -14
- package/dist/esm/store/duckdb/open.js.map +1 -1
- package/dist/esm/store/duckdb/reconcile.js +4 -4
- package/dist/esm/store/duckdb/reconcile.js.map +1 -1
- package/dist/esm/store/duckdb/sql-functions.js +3 -3
- package/dist/esm/store/duckdb/store.js +8 -8
- package/dist/esm/store/duckdb/vectors.js +3 -3
- package/dist/esm/store/duckdb/vectors.js.map +1 -1
- package/dist/esm/store/engine.js +1 -1
- package/dist/esm/store/index.js +13 -13
- package/dist/esm/store/lock-wait.js +1 -1
- package/dist/esm/store/native.js +11 -3
- package/dist/esm/store/native.js.map +1 -1
- package/dist/esm/store/open.js +14 -14
- package/dist/esm/store/open.js.map +1 -1
- package/dist/esm/store/preset-scope.js +2 -2
- package/dist/esm/store/reconcile.js +8 -8
- package/dist/esm/store/reconcile.js.map +1 -1
- package/dist/esm/store/sqlite/connection.js +1 -1
- package/dist/esm/store/sqlite/engine.js +1 -1
- package/dist/esm/store/sqlite/fieldStats.js +1 -1
- package/dist/esm/store/sqlite/lexical.js +2 -2
- package/dist/esm/store/sqlite/open.js +11 -11
- package/dist/esm/store/sqlite/open.js.map +1 -1
- package/dist/esm/store/sqlite/reconcile.js +4 -4
- package/dist/esm/store/sqlite/sql-functions.js +2 -2
- package/dist/esm/store/sqlite/store.js +6 -6
- package/dist/esm/store/sqlite/vectors.js +1 -1
- package/dist/esm/store/sqlite/vectors.js.map +1 -1
- package/dist/esm/store/turso/connection.js +5 -5
- package/dist/esm/store/turso/connection.js.map +1 -1
- package/dist/esm/store/turso/engine.js +2 -2
- package/dist/esm/store/turso/engine.js.map +1 -1
- package/dist/esm/store/turso/fieldStats.js +1 -1
- package/dist/esm/store/turso/lexical-text.js +1 -1
- package/dist/esm/store/turso/lexical.js +4 -4
- package/dist/esm/store/turso/lexical.js.map +1 -1
- package/dist/esm/store/turso/native.js +1 -1
- package/dist/esm/store/turso/native.js.map +1 -1
- package/dist/esm/store/turso/open.js +13 -13
- package/dist/esm/store/turso/open.js.map +1 -1
- package/dist/esm/store/turso/reconcile.js +6 -6
- package/dist/esm/store/turso/reconcile.js.map +1 -1
- package/dist/esm/store/turso/sql-functions.js +1 -1
- package/dist/esm/store/turso/store.js +8 -8
- package/dist/esm/store/turso/store.js.map +1 -1
- package/dist/esm/store/turso/vectors.js +1 -1
- package/dist/esm/store/turso/vectors.js.map +1 -1
- package/dist/esm/text/segment.js.map +1 -1
- package/dist/esm/text/strip.js +2 -2
- package/dist/esm/watch-claim.js +5 -5
- package/dist/esm/watch-claim.js.map +1 -1
- package/dist/esm/watch.js +5 -5
- package/dist/esm/watch.js.map +1 -1
- package/dist/esm/workers/parse.js +4 -4
- package/dist/esm/workers/watch-heartbeat.js +3 -3
- package/package.json +4 -2
package/dist/cjs/cli/status.js
CHANGED
|
@@ -17,17 +17,17 @@ _export(exports, {
|
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
var _nodepath = require("node:path");
|
|
20
|
-
var
|
|
21
|
-
var
|
|
22
|
-
var
|
|
23
|
-
var
|
|
24
|
-
var
|
|
25
|
-
var
|
|
26
|
-
var
|
|
27
|
-
var
|
|
28
|
-
var
|
|
29
|
-
var
|
|
30
|
-
var
|
|
20
|
+
var _status = require("../commands/status.js");
|
|
21
|
+
var _index = require("../config/index.js");
|
|
22
|
+
var _distribution = require("../embed/distribution.js");
|
|
23
|
+
var _http = require("../embed/http.js");
|
|
24
|
+
var _store = require("../embed/store.js");
|
|
25
|
+
var _errors = require("../errors.js");
|
|
26
|
+
var _output = require("../output/output.js");
|
|
27
|
+
var _index1 = require("../store/index.js");
|
|
28
|
+
var _watchclaim = require("../watch-claim.js");
|
|
29
|
+
var _index2 = require("./index.js");
|
|
30
|
+
var _shared = require("./shared.js");
|
|
31
31
|
function _array_like_to_array(arr, len) {
|
|
32
32
|
if (len == null || len > arr.length) len = arr.length;
|
|
33
33
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
@@ -228,7 +228,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
228
228
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
229
229
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
230
230
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
231
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
231
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
232
232
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
233
233
|
}
|
|
234
234
|
// status names what you cannot read off the config file: locations sense chose, values it derived, state it stored. Config content itself is not echoed, since duplicating its globs here would create two places that disagree after an edit.
|
|
@@ -325,7 +325,7 @@ function embedReachable(e) {
|
|
|
325
325
|
base = ((_e_url = e.url) !== null && _e_url !== void 0 ? _e_url : 'https://api.cohere.com').replace(/\/+$/, '');
|
|
326
326
|
return [
|
|
327
327
|
2,
|
|
328
|
-
(0,
|
|
328
|
+
(0, _http.probeReachable)(e.provider === 'openai' ? "".concat(base, "/models") : base)
|
|
329
329
|
];
|
|
330
330
|
});
|
|
331
331
|
})();
|
|
@@ -338,12 +338,12 @@ function languagesInfo(e) {
|
|
|
338
338
|
state: 'declared',
|
|
339
339
|
source: 'config'
|
|
340
340
|
};
|
|
341
|
-
if (e.provider !== 'static' || !(0,
|
|
341
|
+
if (e.provider !== 'static' || !(0, _store.isDownloadable)(e.model)) return {
|
|
342
342
|
languages: null,
|
|
343
343
|
state: null,
|
|
344
344
|
source: null
|
|
345
345
|
};
|
|
346
|
-
var cardLanguages = (0,
|
|
346
|
+
var cardLanguages = (0, _store.readLanguages)(e.model);
|
|
347
347
|
if (cardLanguages === undefined) return {
|
|
348
348
|
languages: null,
|
|
349
349
|
state: 'unresolved',
|
|
@@ -366,14 +366,14 @@ var status = function status(ctx) {
|
|
|
366
366
|
return _ts_generator(this, function(_state) {
|
|
367
367
|
switch(_state.label){
|
|
368
368
|
case 0:
|
|
369
|
-
values = (0,
|
|
370
|
-
format = (0,
|
|
369
|
+
values = (0, _shared.parse)(ctx.argv, "usage: ".concat(ctx.name, " ").concat(_index2.USAGE.status), _object_spread({}, _shared.FORMAT, _shared.CONFIG)).values;
|
|
370
|
+
format = (0, _shared.formatOf)(values);
|
|
371
371
|
cfg = ctx.resolveConfig(values.config, {
|
|
372
372
|
writeMigration: false
|
|
373
373
|
});
|
|
374
374
|
return [
|
|
375
375
|
4,
|
|
376
|
-
(0,
|
|
376
|
+
(0, _index1.lexicalReadiness)(cfg)
|
|
377
377
|
];
|
|
378
378
|
case 1:
|
|
379
379
|
lexical = _state.sent();
|
|
@@ -387,7 +387,7 @@ var status = function status(ctx) {
|
|
|
387
387
|
]);
|
|
388
388
|
return [
|
|
389
389
|
4,
|
|
390
|
-
(0,
|
|
390
|
+
(0, _index1.openStore)(cfg, {
|
|
391
391
|
build: false
|
|
392
392
|
})
|
|
393
393
|
];
|
|
@@ -399,13 +399,13 @@ var status = function status(ctx) {
|
|
|
399
399
|
];
|
|
400
400
|
case 4:
|
|
401
401
|
err = _state.sent();
|
|
402
|
-
if (!_instanceof(err,
|
|
402
|
+
if (!_instanceof(err, _errors.SenseError) || err.code !== 'INDEX_NOT_READY') throw err;
|
|
403
403
|
configDir = (_ref = (_cfg_configDir = cfg.configDir) !== null && _cfg_configDir !== void 0 ? _cfg_configDir : cfg.rootDir) !== null && _ref !== void 0 ? _ref : cfg.baseDir;
|
|
404
|
-
dbPath = (0, _nodepath.join)(configDir,
|
|
405
|
-
watcher = (0,
|
|
404
|
+
dbPath = (0, _nodepath.join)(configDir, _index.STATE_DIR, (0, _index1.storeFilename)(cfg));
|
|
405
|
+
watcher = (0, _watchclaim.readWatchClaim)(configDir);
|
|
406
406
|
result = {
|
|
407
407
|
config: cfg.configPath,
|
|
408
|
-
configVersion:
|
|
408
|
+
configVersion: _index.SUPPORTED_CONFIG_VERSION,
|
|
409
409
|
migratedFrom: (_cfg_migratedFrom = cfg.migratedFrom) !== null && _cfg_migratedFrom !== void 0 ? _cfg_migratedFrom : null,
|
|
410
410
|
unknownConfigKeys: (_cfg_unknownKeys = cfg.unknownKeys) !== null && _cfg_unknownKeys !== void 0 ? _cfg_unknownKeys : null,
|
|
411
411
|
tree: (_cfg_rootDir = cfg.rootDir) !== null && _cfg_rootDir !== void 0 ? _cfg_rootDir : cfg.baseDir,
|
|
@@ -421,10 +421,10 @@ var status = function status(ctx) {
|
|
|
421
421
|
watcherHeartbeatSecondsAgo: watcher ? Math.round((Date.now() - watcher.heartbeatMs) / 1000) : null
|
|
422
422
|
};
|
|
423
423
|
if (format === 'json') {
|
|
424
|
-
console.log((0,
|
|
424
|
+
console.log((0, _output.stringifyJson)(result, 2));
|
|
425
425
|
} else {
|
|
426
426
|
migrated = cfg.migratedFrom !== undefined ? ", migration from v".concat(cfg.migratedFrom, " pending") : '';
|
|
427
|
-
console.log("config: ".concat(result.config, " (v").concat(
|
|
427
|
+
console.log("config: ".concat(result.config, " (v").concat(_index.SUPPORTED_CONFIG_VERSION).concat(migrated, ")"));
|
|
428
428
|
console.log("tree root: ".concat(result.treeRoot));
|
|
429
429
|
console.log("configDir: ".concat(result.configDir));
|
|
430
430
|
console.log("cache: ".concat(result.cache));
|
|
@@ -446,10 +446,10 @@ var status = function status(ctx) {
|
|
|
446
446
|
19,
|
|
447
447
|
21
|
|
448
448
|
]);
|
|
449
|
-
(0,
|
|
450
|
-
features = (0,
|
|
451
|
-
e = (0,
|
|
452
|
-
hasModel = e ? (0,
|
|
449
|
+
(0, _shared.printWarnings)(warnings);
|
|
450
|
+
features = (0, _index.featureStates)(cfg);
|
|
451
|
+
e = (0, _index.embedConfig)(cfg);
|
|
452
|
+
hasModel = e ? (0, _store.modelPresent)(cfg) : false;
|
|
453
453
|
if (!e) return [
|
|
454
454
|
3,
|
|
455
455
|
8
|
|
@@ -490,7 +490,7 @@ var status = function status(ctx) {
|
|
|
490
490
|
vectors = _tmp1;
|
|
491
491
|
return [
|
|
492
492
|
4,
|
|
493
|
-
(0,
|
|
493
|
+
(0, _status.presetCoverage)(store, cfg)
|
|
494
494
|
];
|
|
495
495
|
case 13:
|
|
496
496
|
presets = _state.sent();
|
|
@@ -501,13 +501,13 @@ var status = function status(ctx) {
|
|
|
501
501
|
}, declaredLanguages = _ref3.languages, languagesState = _ref3.state, languagesSource = _ref3.source;
|
|
502
502
|
return [
|
|
503
503
|
4,
|
|
504
|
-
(0,
|
|
504
|
+
(0, _distribution.languageDistribution)(store)
|
|
505
505
|
];
|
|
506
506
|
case 14:
|
|
507
507
|
detectedLanguages = (_ref1 = _state.sent()) !== null && _ref1 !== void 0 ? _ref1 : null;
|
|
508
508
|
return [
|
|
509
509
|
4,
|
|
510
|
-
(0,
|
|
510
|
+
(0, _index1.getMeta)(store, 'schema_version')
|
|
511
511
|
];
|
|
512
512
|
case 15:
|
|
513
513
|
cacheSchema = _state.sent();
|
|
@@ -517,7 +517,7 @@ var status = function status(ctx) {
|
|
|
517
517
|
];
|
|
518
518
|
case 16:
|
|
519
519
|
engine = _state.sent();
|
|
520
|
-
watcher1 = (0,
|
|
520
|
+
watcher1 = (0, _watchclaim.readWatchClaim)((_ref2 = (_cfg_configDir1 = cfg.configDir) !== null && _cfg_configDir1 !== void 0 ? _cfg_configDir1 : cfg.rootDir) !== null && _ref2 !== void 0 ? _ref2 : cfg.baseDir);
|
|
521
521
|
// The env var holds the token; only its name and whether it is set are ever reported.
|
|
522
522
|
keyEnv = (e === null || e === void 0 ? void 0 : e.key) ? {
|
|
523
523
|
name: e.key,
|
|
@@ -525,7 +525,7 @@ var status = function status(ctx) {
|
|
|
525
525
|
} : null;
|
|
526
526
|
_tmp2 = {
|
|
527
527
|
config: cfg.configPath,
|
|
528
|
-
configVersion:
|
|
528
|
+
configVersion: _index.SUPPORTED_CONFIG_VERSION,
|
|
529
529
|
migratedFrom: (_cfg_migratedFrom1 = cfg.migratedFrom) !== null && _cfg_migratedFrom1 !== void 0 ? _cfg_migratedFrom1 : null,
|
|
530
530
|
unknownConfigKeys: (_cfg_unknownKeys1 = cfg.unknownKeys) !== null && _cfg_unknownKeys1 !== void 0 ? _cfg_unknownKeys1 : null,
|
|
531
531
|
tree: (_cfg_rootDir2 = cfg.rootDir) !== null && _cfg_rootDir2 !== void 0 ? _cfg_rootDir2 : cfg.baseDir,
|
|
@@ -541,7 +541,7 @@ var status = function status(ctx) {
|
|
|
541
541
|
};
|
|
542
542
|
return [
|
|
543
543
|
4,
|
|
544
|
-
(0,
|
|
544
|
+
(0, _index1.docCount)(store)
|
|
545
545
|
];
|
|
546
546
|
case 17:
|
|
547
547
|
_tmp2.docs = _state.sent();
|
|
@@ -553,7 +553,7 @@ var status = function status(ctx) {
|
|
|
553
553
|
result1 = (_tmp2.unparseableFrontmatter = _state.sent(), _tmp2.features = features.on, _tmp2.featuresOff = features.off, _tmp2.embed = e ? _object_spread({
|
|
554
554
|
provider: e.provider,
|
|
555
555
|
model: e.model,
|
|
556
|
-
dir: e.provider === 'static' ? (0,
|
|
556
|
+
dir: e.provider === 'static' ? (0, _store.modelDir)(e.model) : null,
|
|
557
557
|
url: e.url ? redactUrl(e.url) : null,
|
|
558
558
|
reachable: reachable,
|
|
559
559
|
keyEnv: keyEnv,
|
|
@@ -563,10 +563,10 @@ var status = function status(ctx) {
|
|
|
563
563
|
detectedLanguages: detectedLanguages
|
|
564
564
|
}, vectors !== null && vectors !== void 0 ? vectors : {}) : null, _tmp2.presets = presets, _tmp2.queries = Object.keys((_cfg_queries = cfg.queries) !== null && _cfg_queries !== void 0 ? _cfg_queries : {}).length, _tmp2.watcherPid = watcher1 ? String(watcher1.pid) : null, _tmp2.watcherHeartbeatSecondsAgo = watcher1 ? Math.round((Date.now() - watcher1.heartbeatMs) / 1000) : null, _tmp2.engine = engine, _tmp2);
|
|
565
565
|
if (format === 'json') {
|
|
566
|
-
console.log((0,
|
|
566
|
+
console.log((0, _output.stringifyJson)(result1, 2));
|
|
567
567
|
} else {
|
|
568
568
|
migrated1 = cfg.migratedFrom !== undefined ? ", migration from v".concat(cfg.migratedFrom, " applied in memory") : '';
|
|
569
|
-
console.log("config: ".concat(result1.config, " (v").concat(
|
|
569
|
+
console.log("config: ".concat(result1.config, " (v").concat(_index.SUPPORTED_CONFIG_VERSION).concat(migrated1, ")"));
|
|
570
570
|
// A load-time stderr warning has scrolled away by the time anyone looks here.
|
|
571
571
|
if (cfg.unknownKeys) console.log(" unknown keys, ignored: ".concat(cfg.unknownKeys.join(', ')));
|
|
572
572
|
console.log("tree root: ".concat(result1.treeRoot));
|
|
@@ -575,13 +575,13 @@ var status = function status(ctx) {
|
|
|
575
575
|
console.log("lexical: ".concat(result1.lexicalReady ? 'ready' : "not ready (".concat(result1.lexicalError, ")")));
|
|
576
576
|
console.log("docs: ".concat(result1.docs).concat(result1.unparseableFrontmatter > 0 ? " (".concat(result1.unparseableFrontmatter, " with unparseable frontmatter: WHERE _parse_error IS NOT NULL)") : ''));
|
|
577
577
|
console.log('');
|
|
578
|
-
console.log((0,
|
|
578
|
+
console.log((0, _output.featuresLine)(features));
|
|
579
579
|
// One authoritative block, off states included: an absent model reads as a degraded search,
|
|
580
580
|
// not as an empty corpus.
|
|
581
581
|
if (!e) console.log('embed: off (no preset asks for vectors)');
|
|
582
582
|
else {
|
|
583
583
|
console.log("embed: ".concat(e.provider, " ").concat(e.model));
|
|
584
|
-
if (e.provider === 'static') console.log(" model: ".concat((0,
|
|
584
|
+
if (e.provider === 'static') console.log(" model: ".concat((0, _store.modelDir)(e.model), " (").concat(hasModel ? 'present' : "missing, ".concat((0, _store.isDownloadable)(e.model) ? "fetches when build, watch, or a vector query needs it; run `".concat(ctx.name, " download` to prefetch") : "no ".concat(_store.MODEL_FILENAMES, " in that directory")), ")"));
|
|
585
585
|
if (declaredLanguages && languagesSource === 'config') console.log(" languages: ".concat(declaredLanguages.join(', '), " (declared in embed.languages)"));
|
|
586
586
|
else if (declaredLanguages && languagesSource === 'card') console.log(" languages: ".concat(declaredLanguages.join(', '), " (declared by the model card)"));
|
|
587
587
|
else if (languagesState === 'none') console.log(' languages: none declared by the model card');
|
|
@@ -611,7 +611,7 @@ var status = function status(ctx) {
|
|
|
611
611
|
console.log('');
|
|
612
612
|
_iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
613
613
|
try {
|
|
614
|
-
for(_iterator = (0,
|
|
614
|
+
for(_iterator = (0, _output.presetsLines)(presets)[Symbol.iterator](); !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
615
615
|
line = _step.value;
|
|
616
616
|
console.log(line);
|
|
617
617
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/open-source/ai/sensemaking/src/cli/status.ts"],"sourcesContent":["import { dirname, join } from 'node:path';\nimport { presetCoverage } from '../commands/status.ts';\nimport { embedConfig, featureStates, STATE_DIR, SUPPORTED_CONFIG_VERSION } from '../config/index.ts';\nimport { languageDistribution } from '../embed/distribution.ts';\nimport { probeReachable } from '../embed/http.ts';\nimport { isDownloadable, MODEL_FILENAMES, modelDir, modelPresent, readLanguages } from '../embed/store.ts';\nimport { SenseError } from '../errors.ts';\nimport { featuresLine, presetsLines, stringifyJson } from '../output/output.ts';\nimport type { OpenResult } from '../store/index.ts';\nimport { docCount, getMeta, lexicalReadiness, openStore, storeFilename } from '../store/index.ts';\nimport type { Store } from '../store/types.ts';\nimport { readWatchClaim } from '../watch-claim.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, FORMAT, formatOf, parse, printWarnings } from './shared.ts';\nimport type { Command } from './types.ts';\n\n// status names what you cannot read off the config file: locations sense chose, values it derived, state it stored. Config content itself is not echoed, since duplicating its globs here would create two places that disagree after an edit.\n// The exception is the embed block's url and key, whose effect is remote and otherwise invisible.\n\n// A failed or interrupted vector preparation can leave core and lexical state usable. Status is\n// observational, so it reports that pending capability instead of repairing it.\nasync function vectorState(store: Store): Promise<{ embedded: number; pending: number } | null> {\n try {\n const stmt = await store.prepare('SELECT COUNT(vector) AS embedded, COUNT(*) - COUNT(vector) AS pending FROM embeddings');\n return (await stmt.get()) as { embedded: number; pending: number };\n } catch {\n return null;\n }\n}\n\nasync function parseErrorCount(store: Store): Promise<number> {\n const stmt = await store.prepare(`SELECT COUNT(*) AS n FROM frontmatter WHERE \"_parse_error\" IS NOT NULL`);\n return ((await stmt.get()) as { n: number }).n;\n}\n\n// A URL can carry credentials in its userinfo (https://user:pass@host/v1). status output gets\n// pasted into issues and transcripts, so it is always safe to paste.\nexport function redactUrl(url: string): string {\n try {\n const parsed = new URL(url);\n if (!parsed.username && !parsed.password) return url;\n parsed.username = '';\n parsed.password = '';\n return `${parsed.toString().replace(/\\/$/, '')} (credentials redacted)`;\n } catch {\n return url;\n }\n}\n\n// A stopped Ollama/LM Studio/Cohere endpoint prints identically to a running one otherwise; any\n// HTTP response counts as reachable (probeReachable), so this only distinguishes up from down.\nasync function embedReachable(e: { provider: string; url?: string }): Promise<boolean | null> {\n if (e.provider === 'static' || (e.provider === 'openai' && !e.url)) return null;\n const base = (e.url ?? 'https://api.cohere.com').replace(/\\/+$/, '');\n return probeReachable(e.provider === 'openai' ? `${base}/models` : base);\n}\n\ntype LanguagesState = 'declared' | 'none' | 'unresolved' | null;\n\n// Config-declared languages win over the model card, for every provider, as registry.ts does.\n// A local-path model has no card by design, so it is never \"unresolved\": that means an HF id.\nfunction languagesInfo(e: NonNullable<ReturnType<typeof embedConfig>>): { languages: string[] | null; state: LanguagesState; source: 'config' | 'card' | null } {\n if (e.languages) return { languages: e.languages, state: 'declared', source: 'config' };\n if (e.provider !== 'static' || !isDownloadable(e.model)) return { languages: null, state: null, source: null };\n const cardLanguages = readLanguages(e.model);\n if (cardLanguages === undefined) return { languages: null, state: 'unresolved', source: null };\n if (cardLanguages.length === 0) return { languages: null, state: 'none', source: null };\n return { languages: cardLanguages, state: 'declared', source: 'card' };\n}\n\nconst status: Command = async (ctx) => {\n const { values } = parse(ctx.argv, `usage: ${ctx.name} ${USAGE.status}`, { ...FORMAT, ...CONFIG });\n const format = formatOf(values);\n const cfg = ctx.resolveConfig(values.config as string | undefined, { writeMigration: false });\n const lexical = await lexicalReadiness(cfg);\n let opened: OpenResult;\n try {\n opened = await openStore(cfg, { build: false });\n } catch (err) {\n if (!(err instanceof SenseError) || err.code !== 'INDEX_NOT_READY') throw err;\n const configDir = cfg.configDir ?? cfg.rootDir ?? cfg.baseDir;\n const dbPath = join(configDir, STATE_DIR, storeFilename(cfg));\n const watcher = readWatchClaim(configDir);\n const result = {\n config: cfg.configPath,\n configVersion: SUPPORTED_CONFIG_VERSION,\n migratedFrom: cfg.migratedFrom ?? null,\n unknownConfigKeys: cfg.unknownKeys ?? null,\n tree: cfg.rootDir ?? cfg.baseDir,\n treeRoot: cfg.rootDir ?? cfg.baseDir,\n configDir,\n cache: dirname(dbPath),\n db: dbPath,\n indexReady: false,\n indexError: err.message,\n lexicalReady: lexical.ready,\n lexicalError: lexical.error,\n watcherPid: watcher ? String(watcher.pid) : null,\n watcherHeartbeatSecondsAgo: watcher ? Math.round((Date.now() - watcher.heartbeatMs) / 1000) : null,\n };\n if (format === 'json') {\n console.log(stringifyJson(result, 2));\n } else {\n const migrated = cfg.migratedFrom !== undefined ? `, migration from v${cfg.migratedFrom} pending` : '';\n console.log(`config: ${result.config} (v${SUPPORTED_CONFIG_VERSION}${migrated})`);\n console.log(`tree root: ${result.treeRoot}`);\n console.log(`configDir: ${result.configDir}`);\n console.log(`cache: ${result.cache}`);\n console.log(`index: not ready (${result.indexError})`);\n console.log(`lexical: ${result.lexicalReady ? 'ready' : `not ready (${result.lexicalError})`}`);\n const pid = result.watcherPid ? `pid ${result.watcherPid}, ` : '';\n console.log(result.watcherHeartbeatSecondsAgo === null ? 'watcher: none' : `watcher: ${pid}last heartbeat ${result.watcherHeartbeatSecondsAgo}s ago`);\n }\n return;\n }\n const { store, dbPath, warnings } = opened;\n try {\n printWarnings(warnings);\n\n const features = featureStates(cfg);\n const e = embedConfig(cfg);\n const hasModel = e ? modelPresent(cfg) : false;\n const reachable = e ? await embedReachable(e) : null;\n const vectors = e ? await vectorState(store) : null;\n const presets = await presetCoverage(store, cfg);\n const { languages: declaredLanguages, state: languagesState, source: languagesSource } = e ? languagesInfo(e) : { languages: null, state: null, source: null };\n const detectedLanguages = (await languageDistribution(store)) ?? null;\n // This is the compatible cache's stored version. Observational open refuses a mismatch rather\n // than rebuilding it before this read.\n const cacheSchema = await getMeta(store, 'schema_version');\n // Each store owns what it reports and how it is worded (Store.engineStatus); this command\n // prints entries generically, without branching on any store's name.\n const engine = await store.engineStatus();\n const watcher = readWatchClaim(cfg.configDir ?? cfg.rootDir ?? cfg.baseDir);\n // The env var holds the token; only its name and whether it is set are ever reported.\n const keyEnv = e?.key ? { name: e.key, set: (process.env[e.key] ?? '') !== '' } : null;\n const result = {\n config: cfg.configPath,\n configVersion: SUPPORTED_CONFIG_VERSION,\n migratedFrom: cfg.migratedFrom ?? null,\n unknownConfigKeys: cfg.unknownKeys ?? null,\n tree: cfg.rootDir ?? cfg.baseDir,\n treeRoot: cfg.rootDir ?? cfg.baseDir,\n configDir: cfg.configDir ?? cfg.baseDir,\n cache: dirname(dbPath),\n db: dbPath,\n indexReady: true,\n indexError: null,\n lexicalReady: lexical.ready,\n lexicalError: lexical.error,\n cacheSchema,\n docs: await docCount(store),\n unparseableFrontmatter: await parseErrorCount(store),\n features: features.on,\n featuresOff: features.off,\n embed: e ? { provider: e.provider, model: e.model, dir: e.provider === 'static' ? modelDir(e.model) : null, url: e.url ? redactUrl(e.url) : null, reachable, keyEnv, downloaded: hasModel, languages: declaredLanguages, languagesState, detectedLanguages, ...(vectors ?? {}) } : null,\n presets,\n queries: Object.keys(cfg.queries ?? {}).length,\n watcherPid: watcher ? String(watcher.pid) : null,\n watcherHeartbeatSecondsAgo: watcher ? Math.round((Date.now() - watcher.heartbeatMs) / 1000) : null,\n engine,\n };\n\n if (format === 'json') {\n console.log(stringifyJson(result, 2));\n } else {\n const migrated = cfg.migratedFrom !== undefined ? `, migration from v${cfg.migratedFrom} applied in memory` : '';\n console.log(`config: ${result.config} (v${SUPPORTED_CONFIG_VERSION}${migrated})`);\n // A load-time stderr warning has scrolled away by the time anyone looks here.\n if (cfg.unknownKeys) console.log(` unknown keys, ignored: ${cfg.unknownKeys.join(', ')}`);\n console.log(`tree root: ${result.treeRoot}`);\n console.log(`configDir: ${result.configDir}`);\n console.log(`cache: ${result.cache} (schema ${result.cacheSchema}; ${ctx.name} build --force to recreate)`);\n console.log(`lexical: ${result.lexicalReady ? 'ready' : `not ready (${result.lexicalError})`}`);\n console.log(`docs: ${result.docs}${result.unparseableFrontmatter > 0 ? ` (${result.unparseableFrontmatter} with unparseable frontmatter: WHERE _parse_error IS NOT NULL)` : ''}`);\n console.log('');\n console.log(featuresLine(features));\n // One authoritative block, off states included: an absent model reads as a degraded search,\n // not as an empty corpus.\n if (!e) console.log('embed: off (no preset asks for vectors)');\n else {\n console.log(`embed: ${e.provider} ${e.model}`);\n if (e.provider === 'static') console.log(` model: ${modelDir(e.model)} (${hasModel ? 'present' : `missing, ${isDownloadable(e.model) ? `fetches when build, watch, or a vector query needs it; run \\`${ctx.name} download\\` to prefetch` : `no ${MODEL_FILENAMES} in that directory`}`})`);\n if (declaredLanguages && languagesSource === 'config') console.log(` languages: ${declaredLanguages.join(', ')} (declared in embed.languages)`);\n else if (declaredLanguages && languagesSource === 'card') console.log(` languages: ${declaredLanguages.join(', ')} (declared by the model card)`);\n else if (languagesState === 'none') console.log(' languages: none declared by the model card');\n else if (languagesState === 'unresolved') console.log(` languages: unresolved (model card unreachable; run \\`${ctx.name} download\\`)`);\n // Cohere defaults to api.cohere.com with no url in the config; show it anyway so the\n // reachability probe below has something to name.\n if (e.url || reachable !== null) {\n const shown = e.url ? redactUrl(e.url) : 'https://api.cohere.com (default)';\n console.log(` url: ${shown}${reachable === null ? '' : reachable ? ' (reachable)' : ' (unreachable)'}`);\n }\n if (keyEnv) console.log(` key: env ${keyEnv.name} (${keyEnv.set ? 'set' : 'NOT SET'})`);\n if (!hasModel) console.log(' vectors: unavailable until the model is present; semantic queries fail, while lexical-only presets remain usable');\n else if (vectors) console.log(` vectors: ${vectors.embedded} embedded, ${vectors.pending} pending${vectors.pending > 0 ? ` (run \\`${ctx.name} build\\` to prepare all configured vectors)` : ''}`);\n if (detectedLanguages) {\n const total = Object.values(detectedLanguages).reduce((a, b) => a + b, 0);\n const breakdown = Object.entries(detectedLanguages)\n .sort((a, b) => b[1] - a[1])\n .map(([code, n]) => `${code} ${Math.round((n / total) * 100)}%`)\n .join(', ');\n console.log(` detected: ${breakdown} (${total} chunks classified)`);\n }\n }\n console.log('');\n for (const line of presetsLines(presets)) console.log(line);\n console.log('');\n console.log(`queries: ${result.queries} saved (${ctx.name} --list)`);\n const pid = result.watcherPid ? `pid ${result.watcherPid}, ` : '';\n console.log(result.watcherHeartbeatSecondsAgo === null ? 'watcher: none' : `watcher: ${pid}last heartbeat ${result.watcherHeartbeatSecondsAgo}s ago`);\n for (const [key, value] of Object.entries(result.engine)) console.log(`${`${store.name}:`.padEnd(10)}${key} ${value}`);\n }\n } finally {\n await store.close();\n }\n};\nexport default status;\n"],"names":["redactUrl","vectorState","store","stmt","prepare","get","parseErrorCount","n","url","parsed","URL","username","password","toString","replace","embedReachable","e","base","provider","probeReachable","languagesInfo","languages","state","source","isDownloadable","model","cardLanguages","readLanguages","undefined","length","status","ctx","values","format","cfg","lexical","opened","err","configDir","dbPath","watcher","result","migrated","pid","warnings","process","features","hasModel","reachable","vectors","presets","declaredLanguages","languagesState","languagesSource","detectedLanguages","cacheSchema","engine","keyEnv","shown","total","breakdown","line","key","value","parse","argv","USAGE","name","FORMAT","CONFIG","formatOf","resolveConfig","config","writeMigration","lexicalReadiness","openStore","build","SenseError","code","rootDir","baseDir","join","STATE_DIR","storeFilename","readWatchClaim","configPath","configVersion","SUPPORTED_CONFIG_VERSION","migratedFrom","unknownConfigKeys","unknownKeys","tree","treeRoot","cache","dirname","db","indexReady","indexError","message","lexicalReady","ready","lexicalError","error","watcherPid","String","watcherHeartbeatSecondsAgo","Math","round","Date","now","heartbeatMs","console","log","stringifyJson","printWarnings","featureStates","embedConfig","modelPresent","presetCoverage","languageDistribution","getMeta","engineStatus","set","env","docCount","docs","unparseableFrontmatter","on","featuresOff","off","embed","dir","modelDir","downloaded","queries","Object","keys","featuresLine","MODEL_FILENAMES","embedded","pending","reduce","a","b","entries","sort","map","presetsLines","padEnd","close"],"mappings":";;;;;;;;;;;QAyNA;eAAA;;QApLgBA;eAAAA;;;wBArCc;wBACC;uBACiD;8BAC3C;sBACN;uBACwD;wBAC5D;wBAC+B;wBAEoB;4BAE/C;wBACT;wBACyC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAG/D,+OAA+O;AAC/O,kGAAkG;AAElG,gGAAgG;AAChG,gFAAgF;AAChF,SAAeC,YAAYC,KAAY;;YAE7BC;;;;;;;;;;oBAAO;;wBAAMD,MAAME,OAAO,CAAC;;;oBAA3BD,OAAO;oBACL;;wBAAMA,KAAKE,GAAG;;;oBAAtB;;wBAAQ;;;;oBAER;;wBAAO;;;;;;;;IAEX;;AAEA,SAAeC,gBAAgBJ,KAAY;;YACnCC;;;;oBAAO;;wBAAMD,MAAME,OAAO,CAAC;;;oBAA3BD,OAAO;oBACJ;;wBAAMA,KAAKE,GAAG;;;oBAAvB;;wBAAS,cAAoCE,CAAC;;;;IAChD;;AAIO,SAASP,UAAUQ,GAAW;IACnC,IAAI;QACF,IAAMC,SAAS,IAAIC,IAAIF;QACvB,IAAI,CAACC,OAAOE,QAAQ,IA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/kevin/Dev/open-source/ai/sensemaking/src/cli/status.ts"],"sourcesContent":["import { dirname, join } from 'node:path';\nimport { presetCoverage } from '../commands/status.ts';\nimport { embedConfig, featureStates, STATE_DIR, SUPPORTED_CONFIG_VERSION } from '../config/index.ts';\nimport { languageDistribution } from '../embed/distribution.ts';\nimport { probeReachable } from '../embed/http.ts';\nimport { isDownloadable, MODEL_FILENAMES, modelDir, modelPresent, readLanguages } from '../embed/store.ts';\nimport { SenseError } from '../errors.ts';\nimport { featuresLine, presetsLines, stringifyJson } from '../output/output.ts';\nimport type { OpenResult } from '../store/index.ts';\nimport { docCount, getMeta, lexicalReadiness, openStore, storeFilename } from '../store/index.ts';\nimport type { Store } from '../store/types.ts';\nimport { readWatchClaim } from '../watch-claim.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, FORMAT, formatOf, parse, printWarnings } from './shared.ts';\nimport type { Command } from './types.ts';\n\n// status names what you cannot read off the config file: locations sense chose, values it derived, state it stored. Config content itself is not echoed, since duplicating its globs here would create two places that disagree after an edit.\n// The exception is the embed block's url and key, whose effect is remote and otherwise invisible.\n\n// A failed or interrupted vector preparation can leave core and lexical state usable. Status is\n// observational, so it reports that pending capability instead of repairing it.\nasync function vectorState(store: Store): Promise<{ embedded: number; pending: number } | null> {\n try {\n const stmt = await store.prepare('SELECT COUNT(vector) AS embedded, COUNT(*) - COUNT(vector) AS pending FROM embeddings');\n return (await stmt.get()) as { embedded: number; pending: number };\n } catch {\n return null;\n }\n}\n\nasync function parseErrorCount(store: Store): Promise<number> {\n const stmt = await store.prepare(`SELECT COUNT(*) AS n FROM frontmatter WHERE \"_parse_error\" IS NOT NULL`);\n return ((await stmt.get()) as { n: number }).n;\n}\n\n// A URL can carry credentials in its userinfo (https://user:pass@host/v1). status output gets\n// pasted into issues and transcripts, so it is always safe to paste.\nexport function redactUrl(url: string): string {\n try {\n const parsed = new URL(url);\n if (!parsed.username && !parsed.password) return url;\n parsed.username = '';\n parsed.password = '';\n return `${parsed.toString().replace(/\\/$/, '')} (credentials redacted)`;\n } catch {\n return url;\n }\n}\n\n// A stopped Ollama/LM Studio/Cohere endpoint prints identically to a running one otherwise; any\n// HTTP response counts as reachable (probeReachable), so this only distinguishes up from down.\nasync function embedReachable(e: { provider: string; url?: string }): Promise<boolean | null> {\n if (e.provider === 'static' || (e.provider === 'openai' && !e.url)) return null;\n const base = (e.url ?? 'https://api.cohere.com').replace(/\\/+$/, '');\n return probeReachable(e.provider === 'openai' ? `${base}/models` : base);\n}\n\ntype LanguagesState = 'declared' | 'none' | 'unresolved' | null;\n\n// Config-declared languages win over the model card, for every provider, as registry.ts does.\n// A local-path model has no card by design, so it is never \"unresolved\": that means an HF id.\nfunction languagesInfo(e: NonNullable<ReturnType<typeof embedConfig>>): { languages: string[] | null; state: LanguagesState; source: 'config' | 'card' | null } {\n if (e.languages) return { languages: e.languages, state: 'declared', source: 'config' };\n if (e.provider !== 'static' || !isDownloadable(e.model)) return { languages: null, state: null, source: null };\n const cardLanguages = readLanguages(e.model);\n if (cardLanguages === undefined) return { languages: null, state: 'unresolved', source: null };\n if (cardLanguages.length === 0) return { languages: null, state: 'none', source: null };\n return { languages: cardLanguages, state: 'declared', source: 'card' };\n}\n\nconst status: Command = async (ctx) => {\n const { values } = parse(ctx.argv, `usage: ${ctx.name} ${USAGE.status}`, { ...FORMAT, ...CONFIG });\n const format = formatOf(values);\n const cfg = ctx.resolveConfig(values.config as string | undefined, { writeMigration: false });\n const lexical = await lexicalReadiness(cfg);\n let opened: OpenResult;\n try {\n opened = await openStore(cfg, { build: false });\n } catch (err) {\n if (!(err instanceof SenseError) || err.code !== 'INDEX_NOT_READY') throw err;\n const configDir = cfg.configDir ?? cfg.rootDir ?? cfg.baseDir;\n const dbPath = join(configDir, STATE_DIR, storeFilename(cfg));\n const watcher = readWatchClaim(configDir);\n const result = {\n config: cfg.configPath,\n configVersion: SUPPORTED_CONFIG_VERSION,\n migratedFrom: cfg.migratedFrom ?? null,\n unknownConfigKeys: cfg.unknownKeys ?? null,\n tree: cfg.rootDir ?? cfg.baseDir,\n treeRoot: cfg.rootDir ?? cfg.baseDir,\n configDir,\n cache: dirname(dbPath),\n db: dbPath,\n indexReady: false,\n indexError: err.message,\n lexicalReady: lexical.ready,\n lexicalError: lexical.error,\n watcherPid: watcher ? String(watcher.pid) : null,\n watcherHeartbeatSecondsAgo: watcher ? Math.round((Date.now() - watcher.heartbeatMs) / 1000) : null,\n };\n if (format === 'json') {\n console.log(stringifyJson(result, 2));\n } else {\n const migrated = cfg.migratedFrom !== undefined ? `, migration from v${cfg.migratedFrom} pending` : '';\n console.log(`config: ${result.config} (v${SUPPORTED_CONFIG_VERSION}${migrated})`);\n console.log(`tree root: ${result.treeRoot}`);\n console.log(`configDir: ${result.configDir}`);\n console.log(`cache: ${result.cache}`);\n console.log(`index: not ready (${result.indexError})`);\n console.log(`lexical: ${result.lexicalReady ? 'ready' : `not ready (${result.lexicalError})`}`);\n const pid = result.watcherPid ? `pid ${result.watcherPid}, ` : '';\n console.log(result.watcherHeartbeatSecondsAgo === null ? 'watcher: none' : `watcher: ${pid}last heartbeat ${result.watcherHeartbeatSecondsAgo}s ago`);\n }\n return;\n }\n const { store, dbPath, warnings } = opened;\n try {\n printWarnings(warnings);\n\n const features = featureStates(cfg);\n const e = embedConfig(cfg);\n const hasModel = e ? modelPresent(cfg) : false;\n const reachable = e ? await embedReachable(e) : null;\n const vectors = e ? await vectorState(store) : null;\n const presets = await presetCoverage(store, cfg);\n const { languages: declaredLanguages, state: languagesState, source: languagesSource } = e ? languagesInfo(e) : { languages: null, state: null, source: null };\n const detectedLanguages = (await languageDistribution(store)) ?? null;\n // This is the compatible cache's stored version. Observational open refuses a mismatch rather\n // than rebuilding it before this read.\n const cacheSchema = await getMeta(store, 'schema_version');\n // Each store owns what it reports and how it is worded (Store.engineStatus); this command\n // prints entries generically, without branching on any store's name.\n const engine = await store.engineStatus();\n const watcher = readWatchClaim(cfg.configDir ?? cfg.rootDir ?? cfg.baseDir);\n // The env var holds the token; only its name and whether it is set are ever reported.\n const keyEnv = e?.key ? { name: e.key, set: (process.env[e.key] ?? '') !== '' } : null;\n const result = {\n config: cfg.configPath,\n configVersion: SUPPORTED_CONFIG_VERSION,\n migratedFrom: cfg.migratedFrom ?? null,\n unknownConfigKeys: cfg.unknownKeys ?? null,\n tree: cfg.rootDir ?? cfg.baseDir,\n treeRoot: cfg.rootDir ?? cfg.baseDir,\n configDir: cfg.configDir ?? cfg.baseDir,\n cache: dirname(dbPath),\n db: dbPath,\n indexReady: true,\n indexError: null,\n lexicalReady: lexical.ready,\n lexicalError: lexical.error,\n cacheSchema,\n docs: await docCount(store),\n unparseableFrontmatter: await parseErrorCount(store),\n features: features.on,\n featuresOff: features.off,\n embed: e ? { provider: e.provider, model: e.model, dir: e.provider === 'static' ? modelDir(e.model) : null, url: e.url ? redactUrl(e.url) : null, reachable, keyEnv, downloaded: hasModel, languages: declaredLanguages, languagesState, detectedLanguages, ...(vectors ?? {}) } : null,\n presets,\n queries: Object.keys(cfg.queries ?? {}).length,\n watcherPid: watcher ? String(watcher.pid) : null,\n watcherHeartbeatSecondsAgo: watcher ? Math.round((Date.now() - watcher.heartbeatMs) / 1000) : null,\n engine,\n };\n\n if (format === 'json') {\n console.log(stringifyJson(result, 2));\n } else {\n const migrated = cfg.migratedFrom !== undefined ? `, migration from v${cfg.migratedFrom} applied in memory` : '';\n console.log(`config: ${result.config} (v${SUPPORTED_CONFIG_VERSION}${migrated})`);\n // A load-time stderr warning has scrolled away by the time anyone looks here.\n if (cfg.unknownKeys) console.log(` unknown keys, ignored: ${cfg.unknownKeys.join(', ')}`);\n console.log(`tree root: ${result.treeRoot}`);\n console.log(`configDir: ${result.configDir}`);\n console.log(`cache: ${result.cache} (schema ${result.cacheSchema}; ${ctx.name} build --force to recreate)`);\n console.log(`lexical: ${result.lexicalReady ? 'ready' : `not ready (${result.lexicalError})`}`);\n console.log(`docs: ${result.docs}${result.unparseableFrontmatter > 0 ? ` (${result.unparseableFrontmatter} with unparseable frontmatter: WHERE _parse_error IS NOT NULL)` : ''}`);\n console.log('');\n console.log(featuresLine(features));\n // One authoritative block, off states included: an absent model reads as a degraded search,\n // not as an empty corpus.\n if (!e) console.log('embed: off (no preset asks for vectors)');\n else {\n console.log(`embed: ${e.provider} ${e.model}`);\n if (e.provider === 'static') console.log(` model: ${modelDir(e.model)} (${hasModel ? 'present' : `missing, ${isDownloadable(e.model) ? `fetches when build, watch, or a vector query needs it; run \\`${ctx.name} download\\` to prefetch` : `no ${MODEL_FILENAMES} in that directory`}`})`);\n if (declaredLanguages && languagesSource === 'config') console.log(` languages: ${declaredLanguages.join(', ')} (declared in embed.languages)`);\n else if (declaredLanguages && languagesSource === 'card') console.log(` languages: ${declaredLanguages.join(', ')} (declared by the model card)`);\n else if (languagesState === 'none') console.log(' languages: none declared by the model card');\n else if (languagesState === 'unresolved') console.log(` languages: unresolved (model card unreachable; run \\`${ctx.name} download\\`)`);\n // Cohere defaults to api.cohere.com with no url in the config; show it anyway so the\n // reachability probe below has something to name.\n if (e.url || reachable !== null) {\n const shown = e.url ? redactUrl(e.url) : 'https://api.cohere.com (default)';\n console.log(` url: ${shown}${reachable === null ? '' : reachable ? ' (reachable)' : ' (unreachable)'}`);\n }\n if (keyEnv) console.log(` key: env ${keyEnv.name} (${keyEnv.set ? 'set' : 'NOT SET'})`);\n if (!hasModel) console.log(' vectors: unavailable until the model is present; semantic queries fail, while lexical-only presets remain usable');\n else if (vectors) console.log(` vectors: ${vectors.embedded} embedded, ${vectors.pending} pending${vectors.pending > 0 ? ` (run \\`${ctx.name} build\\` to prepare all configured vectors)` : ''}`);\n if (detectedLanguages) {\n const total = Object.values(detectedLanguages).reduce((a, b) => a + b, 0);\n const breakdown = Object.entries(detectedLanguages)\n .sort((a, b) => b[1] - a[1])\n .map(([code, n]) => `${code} ${Math.round((n / total) * 100)}%`)\n .join(', ');\n console.log(` detected: ${breakdown} (${total} chunks classified)`);\n }\n }\n console.log('');\n for (const line of presetsLines(presets)) console.log(line);\n console.log('');\n console.log(`queries: ${result.queries} saved (${ctx.name} --list)`);\n const pid = result.watcherPid ? `pid ${result.watcherPid}, ` : '';\n console.log(result.watcherHeartbeatSecondsAgo === null ? 'watcher: none' : `watcher: ${pid}last heartbeat ${result.watcherHeartbeatSecondsAgo}s ago`);\n for (const [key, value] of Object.entries(result.engine)) console.log(`${`${store.name}:`.padEnd(10)}${key} ${value}`);\n }\n } finally {\n await store.close();\n }\n};\nexport default status;\n"],"names":["redactUrl","vectorState","store","stmt","prepare","get","parseErrorCount","n","url","parsed","URL","username","password","toString","replace","embedReachable","e","base","provider","probeReachable","languagesInfo","languages","state","source","isDownloadable","model","cardLanguages","readLanguages","undefined","length","status","ctx","values","format","cfg","lexical","opened","err","configDir","dbPath","watcher","result","migrated","pid","warnings","process","features","hasModel","reachable","vectors","presets","declaredLanguages","languagesState","languagesSource","detectedLanguages","cacheSchema","engine","keyEnv","shown","total","breakdown","line","key","value","parse","argv","USAGE","name","FORMAT","CONFIG","formatOf","resolveConfig","config","writeMigration","lexicalReadiness","openStore","build","SenseError","code","rootDir","baseDir","join","STATE_DIR","storeFilename","readWatchClaim","configPath","configVersion","SUPPORTED_CONFIG_VERSION","migratedFrom","unknownConfigKeys","unknownKeys","tree","treeRoot","cache","dirname","db","indexReady","indexError","message","lexicalReady","ready","lexicalError","error","watcherPid","String","watcherHeartbeatSecondsAgo","Math","round","Date","now","heartbeatMs","console","log","stringifyJson","printWarnings","featureStates","embedConfig","modelPresent","presetCoverage","languageDistribution","getMeta","engineStatus","set","env","docCount","docs","unparseableFrontmatter","on","featuresOff","off","embed","dir","modelDir","downloaded","queries","Object","keys","featuresLine","MODEL_FILENAMES","embedded","pending","reduce","a","b","entries","sort","map","presetsLines","padEnd","close"],"mappings":";;;;;;;;;;;QAyNA;eAAA;;QApLgBA;eAAAA;;;gBArCc,QAAA;cACC,QAAA;aACiD,QAAA;oBAC3C,QAAA;YACN,QAAA;aACwD,QAAA;cAC5D,QAA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D,QAAQC,GAAG,CAAC;wBACZD,QAAQC,GAAG,CAAC,AAAC,aAAqCjF,OAAzBU,QAAO6F,OAAO,EAAC,YAAmB,OAATvG,IAAIoC,IAAI,EAAC;wBACrDxB,OAAMF,QAAO8D,UAAU,GAAG,AAAC,OAAwB,OAAlB9D,QAAO8D,UAAU,EAAC,QAAM;wBAC/DQ,QAAQC,GAAG,CAACvE,QAAOgE,0BAA0B,KAAK,OAAO,mBAAmB,AAAC,aAAiChE,OAArBE,MAAI,mBAAmD,OAAlCF,QAAOgE,0BAA0B,EAAC;wBAC3I,mCAAA,4BAAA;;4BAAL,IAAK,aAAsB8B,OAAOS,OAAO,CAACvG,QAAOe,MAAM,wBAAlD,8BAAA,SAAA,0BAAA;+DAAA,kBAAOM,sBAAKC;gCAAyCgD,QAAQC,GAAG,CAAC,AAAC,GAAgClD,OAA9B,AAAC,GAAa,OAAX5D,MAAMiE,IAAI,EAAC,KAAGiF,MAAM,CAAC,KAAarF,OAAPD,KAAI,KAAS,OAANC;;;4BAAzG;4BAAA;;;qCAAA,8BAAA;oCAAA;;;oCAAA;0CAAA;;;;oBACP;;;;;;oBAEA;;wBAAM7D,MAAMmJ,KAAK;;;oBAAjB;;;;;;;;;;IAEJ;;IACA,WAAevH"}
|
package/dist/cjs/cli/watch.js
CHANGED
|
@@ -8,9 +8,9 @@ Object.defineProperty(exports, "default", {
|
|
|
8
8
|
return _default;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
var
|
|
12
|
-
var
|
|
13
|
-
var
|
|
11
|
+
var _watch = require("../watch.js");
|
|
12
|
+
var _index = require("./index.js");
|
|
13
|
+
var _shared = require("./shared.js");
|
|
14
14
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
15
15
|
try {
|
|
16
16
|
var info = gen[key](arg);
|
|
@@ -168,22 +168,22 @@ var watch = function watch(ctx) {
|
|
|
168
168
|
return _ts_generator(this, function(_state) {
|
|
169
169
|
switch(_state.label){
|
|
170
170
|
case 0:
|
|
171
|
-
values = (0,
|
|
171
|
+
values = (0, _shared.parse)(ctx.argv, "usage: ".concat(ctx.name, " ").concat(_index.USAGE.watch), _object_spread({
|
|
172
172
|
force: {
|
|
173
173
|
type: 'boolean',
|
|
174
174
|
default: false
|
|
175
175
|
}
|
|
176
|
-
},
|
|
176
|
+
}, _shared.CONFIG)).values;
|
|
177
177
|
return [
|
|
178
178
|
4,
|
|
179
|
-
(0,
|
|
179
|
+
(0, _watch.runWatch)(ctx.resolveConfig(values.config), {
|
|
180
180
|
force: values.force,
|
|
181
181
|
onEvent: function onEvent(event) {
|
|
182
182
|
if (event.type === 'started') {
|
|
183
183
|
console.log("".concat(ctx.name, " watch: watching ").concat(event.rootDir));
|
|
184
184
|
console.log("".concat(ctx.name, " watch: db ").concat(event.dbPath));
|
|
185
185
|
} else if (event.type === 'reconciled') {
|
|
186
|
-
(0,
|
|
186
|
+
(0, _shared.printWarnings)(event.warnings);
|
|
187
187
|
if (event.parsed > 0) console.log("".concat(ctx.name, " watch: reconciled, ").concat(event.parsed, " file(s) reparsed (").concat(event.total, " total)"));
|
|
188
188
|
} else {
|
|
189
189
|
console.error("".concat(ctx.name, " watch: reconcile error: ").concat(event.message));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/open-source/ai/sensemaking/src/cli/watch.ts"],"sourcesContent":["import type { WatchEvent } from '../watch.ts';\nimport { runWatch } from '../watch.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, parse, printWarnings } from './shared.ts';\nimport type { Command } from './types.ts';\n\nconst watch: Command = async (ctx) => {\n const { values } = parse(ctx.argv, `usage: ${ctx.name} ${USAGE.watch}`, { force: { type: 'boolean', default: false }, ...CONFIG });\n await runWatch(ctx.resolveConfig(values.config as string | undefined), {\n force: values.force as boolean,\n onEvent: (event: WatchEvent) => {\n if (event.type === 'started') {\n console.log(`${ctx.name} watch: watching ${event.rootDir}`);\n console.log(`${ctx.name} watch: db ${event.dbPath}`);\n } else if (event.type === 'reconciled') {\n printWarnings(event.warnings);\n if (event.parsed > 0) console.log(`${ctx.name} watch: reconciled, ${event.parsed} file(s) reparsed (${event.total} total)`);\n } else {\n console.error(`${ctx.name} watch: reconcile error: ${event.message}`);\n }\n },\n });\n};\nexport default watch;\n"],"names":["watch","ctx","values","parse","argv","USAGE","name","force","type","default","CONFIG","runWatch","resolveConfig","config","onEvent","event","console","log","rootDir","dbPath","printWarnings","warnings","parsed","total","error","message"],"mappings":";;;;+BAuBA;;;eAAA;;;
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/open-source/ai/sensemaking/src/cli/watch.ts"],"sourcesContent":["import type { WatchEvent } from '../watch.ts';\nimport { runWatch } from '../watch.ts';\nimport { USAGE } from './index.ts';\nimport { CONFIG, parse, printWarnings } from './shared.ts';\nimport type { Command } from './types.ts';\n\nconst watch: Command = async (ctx) => {\n const { values } = parse(ctx.argv, `usage: ${ctx.name} ${USAGE.watch}`, { force: { type: 'boolean', default: false }, ...CONFIG });\n await runWatch(ctx.resolveConfig(values.config as string | undefined), {\n force: values.force as boolean,\n onEvent: (event: WatchEvent) => {\n if (event.type === 'started') {\n console.log(`${ctx.name} watch: watching ${event.rootDir}`);\n console.log(`${ctx.name} watch: db ${event.dbPath}`);\n } else if (event.type === 'reconciled') {\n printWarnings(event.warnings);\n if (event.parsed > 0) console.log(`${ctx.name} watch: reconciled, ${event.parsed} file(s) reparsed (${event.total} total)`);\n } else {\n console.error(`${ctx.name} watch: reconcile error: ${event.message}`);\n }\n },\n });\n};\nexport default watch;\n"],"names":["watch","ctx","values","parse","argv","USAGE","name","force","type","default","CONFIG","runWatch","resolveConfig","config","onEvent","event","console","log","rootDir","dbPath","printWarnings","warnings","parsed","total","error","message"],"mappings":";;;;+BAuBA;;;eAAA;;;aAtByB,QAAA;aACH,QAAA;cACuB,QAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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rown errors exit with ERROR_CODE and the mes
|
|
|
11
11
|
});
|
|
12
12
|
var _nodemodule = require("node:module");
|
|
13
13
|
var _nodeutil = require("node:util");
|
|
14
|
-
var
|
|
15
|
-
var
|
|
16
|
-
var
|
|
14
|
+
var _constants = require("./cli/constants.js");
|
|
15
|
+
var _index = require("./cli/index.js");
|
|
16
|
+
var _index1 = require("./config/index.js");
|
|
17
17
|
function _array_like_to_array(arr, len) {
|
|
18
18
|
if (len == null || len > arr.length) len = arr.length;
|
|
19
19
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
@@ -193,7 +193,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
193
193
|
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
194
194
|
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
195
195
|
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
196
|
-
if (n === "Map" || n === "Set") return Array.from(
|
|
196
|
+
if (n === "Map" || n === "Set") return Array.from(o);
|
|
197
197
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
198
198
|
}
|
|
199
199
|
// Parsing and dispatch only; commands lazy-load from src/cli/, so nothing heavy is imported
|
|
@@ -215,7 +215,7 @@ function packageVersion() {
|
|
|
215
215
|
return 'unknown';
|
|
216
216
|
}
|
|
217
217
|
function usage(name) {
|
|
218
|
-
var lines = Object.values(
|
|
218
|
+
var lines = Object.values(_index.USAGE).map(function(u) {
|
|
219
219
|
return " ".concat(name, " ").concat(u);
|
|
220
220
|
});
|
|
221
221
|
return [
|
|
@@ -228,13 +228,13 @@ function usage(name) {
|
|
|
228
228
|
function resolveConfigFor(name, configPath) {
|
|
229
229
|
var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
|
|
230
230
|
// Read the query policy before allowing a migration to write configuration state.
|
|
231
|
-
var cfg = (0,
|
|
231
|
+
var cfg = (0, _index1.loadConfig)(configPath, options.query ? {
|
|
232
232
|
writeMigration: false
|
|
233
233
|
} : options);
|
|
234
234
|
var writeMigration = options.writeMigration !== false && (!options.query || cfg.build !== false);
|
|
235
|
-
if (options.query && writeMigration && cfg.migratedFrom !== undefined) cfg = (0,
|
|
235
|
+
if (options.query && writeMigration && cfg.migratedFrom !== undefined) cfg = (0, _index1.loadConfig)(configPath);
|
|
236
236
|
if (cfg.migratedFrom !== undefined) {
|
|
237
|
-
console.warn(!writeMigration ? "".concat(name, ": ").concat(cfg.configPath, " needs migration from config version ").concat(cfg.migratedFrom, " to ").concat(
|
|
237
|
+
console.warn(!writeMigration ? "".concat(name, ": ").concat(cfg.configPath, " needs migration from config version ").concat(cfg.migratedFrom, " to ").concat(_index1.SUPPORTED_CONFIG_VERSION, "; using the migrated form in memory only (run ").concat(name, " build to update the file)") : "".concat(name, ": migrated ").concat(cfg.configPath, " from config version ").concat(cfg.migratedFrom, " to ").concat(_index1.SUPPORTED_CONFIG_VERSION));
|
|
238
238
|
}
|
|
239
239
|
if (cfg.unknownKeys !== undefined) {
|
|
240
240
|
console.warn("".concat(name, ": ").concat(cfg.configPath, " sets ").concat(cfg.unknownKeys.join(', '), ", which this build does not read (no effect); see schema.json for the keys it does"));
|
|
@@ -252,7 +252,7 @@ function cli(argv, name) {
|
|
|
252
252
|
process.stdout.on('error', function(err) {
|
|
253
253
|
if (err.code === 'EPIPE') return;
|
|
254
254
|
console.error("sense: ".concat(err.message));
|
|
255
|
-
process.exitCode =
|
|
255
|
+
process.exitCode = _constants.ERROR_CODE;
|
|
256
256
|
});
|
|
257
257
|
first = argv[0];
|
|
258
258
|
// No command word, or the first token looks like a flag: the only flags this level knows.
|
|
@@ -285,7 +285,7 @@ function cli(argv, name) {
|
|
|
285
285
|
} catch (err) {
|
|
286
286
|
console.error(err.message);
|
|
287
287
|
console.error(usage(name));
|
|
288
|
-
process.exit(
|
|
288
|
+
process.exit(_constants.USAGE_CODE);
|
|
289
289
|
}
|
|
290
290
|
try {
|
|
291
291
|
if (values.version) {
|
|
@@ -330,10 +330,10 @@ function cli(argv, name) {
|
|
|
330
330
|
}
|
|
331
331
|
} catch (err) {
|
|
332
332
|
console.error(err.message);
|
|
333
|
-
process.exit(
|
|
333
|
+
process.exit(_constants.ERROR_CODE);
|
|
334
334
|
}
|
|
335
335
|
console.error(usage(name));
|
|
336
|
-
process.exit(
|
|
336
|
+
process.exit(_constants.USAGE_CODE);
|
|
337
337
|
}
|
|
338
338
|
// Renamed verbs get a pointer to their current name instead of the unknown-entry error: find ->
|
|
339
339
|
// search, and query -> sql (which took its name back from the search sense of "query").
|
|
@@ -344,7 +344,7 @@ function cli(argv, name) {
|
|
|
344
344
|
if (RENAMED[first]) {
|
|
345
345
|
console.error("".concat(name, ": ").concat(first, " is now ").concat(RENAMED[first]));
|
|
346
346
|
console.error(usage(name));
|
|
347
|
-
process.exit(
|
|
347
|
+
process.exit(_constants.USAGE_CODE);
|
|
348
348
|
}
|
|
349
349
|
ctx = {
|
|
350
350
|
name: name,
|
|
@@ -354,7 +354,7 @@ function cli(argv, name) {
|
|
|
354
354
|
},
|
|
355
355
|
usageError: function usageError(message) {
|
|
356
356
|
console.error(message);
|
|
357
|
-
process.exit(
|
|
357
|
+
process.exit(_constants.USAGE_CODE);
|
|
358
358
|
}
|
|
359
359
|
};
|
|
360
360
|
_state.label = 1;
|
|
@@ -365,7 +365,7 @@ function cli(argv, name) {
|
|
|
365
365
|
,
|
|
366
366
|
9
|
|
367
367
|
]);
|
|
368
|
-
load =
|
|
368
|
+
load = _index.COMMANDS[first];
|
|
369
369
|
if (!load) return [
|
|
370
370
|
3,
|
|
371
371
|
4
|
|
@@ -408,7 +408,7 @@ function cli(argv, name) {
|
|
|
408
408
|
case 8:
|
|
409
409
|
err = _state.sent();
|
|
410
410
|
console.error(err.message);
|
|
411
|
-
process.exit(
|
|
411
|
+
process.exit(_constants.ERROR_CODE);
|
|
412
412
|
return [
|
|
413
413
|
3,
|
|
414
414
|
9
|
package/dist/cjs/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/open-source/ai/sensemaking/src/cli.ts"],"sourcesContent":["import { createRequire } from 'node:module';\nimport { parseArgs } from 'node:util';\nimport { ERROR_CODE, USAGE_CODE } from './cli/constants.ts';\nimport { COMMANDS, USAGE } from './cli/index.ts';\nimport type { Ctx } from './cli/types.ts';\nimport type { LoadConfigOptions } from './config/index.ts';\nimport { loadConfig, SUPPORTED_CONFIG_VERSION } from './config/index.ts';\n\n// Parsing and dispatch only; commands lazy-load from src/cli/, so nothing heavy is imported\n// here. Flags parse per command -- this file handles only --version/--help/--list/--config.\n\n// Works from dist/cjs and dist/esm alike: walk up past the dist type-marker package.json.\nfunction packageVersion(): string {\n const load = createRequire(import.meta.url);\n for (const rel of ['../package.json', '../../package.json', '../../../package.json']) {\n try {\n const pkg = load(rel) as { name?: string; version?: string };\n if (pkg.name === 'sensemaking' && pkg.version) return pkg.version;\n } catch {}\n }\n return 'unknown';\n}\n\nfunction usage(name: string): string {\n const lines = Object.values(USAGE).map((u) => ` ${name} ${u}`);\n return [`usage: ${name} <name> [params...] [--format table|json|csv] [--config path]`, ...lines, ` ${name} --list`, ` ${name} --version`].join('\\n');\n}\n\nfunction resolveConfigFor(name: string, configPath: string | undefined, options: LoadConfigOptions & { query?: boolean } = {}) {\n // Read the query policy before allowing a migration to write configuration state.\n let cfg = loadConfig(configPath, options.query ? { writeMigration: false } : options);\n const writeMigration = options.writeMigration !== false && (!options.query || cfg.build !== false);\n if (options.query && writeMigration && cfg.migratedFrom !== undefined) cfg = loadConfig(configPath);\n if (cfg.migratedFrom !== undefined) {\n console.warn(\n !writeMigration\n ? `${name}: ${cfg.configPath} needs migration from config version ${cfg.migratedFrom} to ${SUPPORTED_CONFIG_VERSION}; using the migrated form in memory only (run ${name} build to update the file)`\n : `${name}: migrated ${cfg.configPath} from config version ${cfg.migratedFrom} to ${SUPPORTED_CONFIG_VERSION}`\n );\n }\n if (cfg.unknownKeys !== undefined) {\n console.warn(`${name}: ${cfg.configPath} sets ${cfg.unknownKeys.join(', ')}, which this build does not read (no effect); see schema.json for the keys it does`);\n }\n return cfg;\n}\n\n// Thrown errors exit with ERROR_CODE and the message verbatim; usage errors exit with USAGE_CODE.\nexport default async function cli(argv: string[], name: string): Promise<void> {\n // A closed pipe reader's EPIPE arrives async, after the write loop returns: console.log absorbs it, process.stdout.write (streaming formats) does not, so an unhandled listener kills the process.\n // A throw here is uncaught (async); process.exit() would skip `sense watch`'s cleanup, leaving a heartbeat behind that makes a dead watcher look alive.\n process.stdout.on('error', (err: NodeJS.ErrnoException) => {\n if (err.code === 'EPIPE') return;\n console.error(`sense: ${err.message}`);\n process.exitCode = ERROR_CODE;\n });\n\n const first = argv[0];\n\n // No command word, or the first token looks like a flag: the only flags this level knows.\n if (!first || first.startsWith('-')) {\n let values: Record<string, string | boolean | undefined>;\n try {\n ({ values } = parseArgs({\n args: argv,\n options: {\n version: { type: 'boolean', default: false, short: 'v' },\n help: { type: 'boolean', default: false, short: 'h' },\n list: { type: 'boolean', default: false },\n config: { type: 'string' },\n },\n allowPositionals: true,\n }));\n } catch (err) {\n console.error((err as Error).message);\n console.error(usage(name));\n process.exit(USAGE_CODE);\n }\n\n try {\n if (values.version) {\n console.log(packageVersion());\n return;\n }\n if (values.help) {\n console.log(usage(name));\n return;\n }\n if (values.list) {\n const queries = resolveConfigFor(name, values.config as string | undefined).queries;\n for (const queryName of Object.keys(queries).sort()) {\n // Every entry names its verb, so --list can label both kinds rather than only\n // marking the exception.\n console.log(`${queryName} (${'search' in queries[queryName] ? 'search' : 'sql'})`);\n }\n return;\n }\n } catch (err) {\n console.error((err as Error).message);\n process.exit(ERROR_CODE);\n }\n\n console.error(usage(name));\n process.exit(USAGE_CODE);\n }\n\n // Renamed verbs get a pointer to their current name instead of the unknown-entry error: find ->\n // search, and query -> sql (which took its name back from the search sense of \"query\").\n const RENAMED: Record<string, string> = { find: 'search', query: 'sql' };\n if (RENAMED[first]) {\n console.error(`${name}: ${first} is now ${RENAMED[first]}`);\n console.error(usage(name));\n process.exit(USAGE_CODE);\n }\n\n const ctx: Ctx = {\n name,\n argv: argv.slice(1),\n resolveConfig: (configPath, options) => resolveConfigFor(name, configPath, options),\n usageError(message) {\n console.error(message);\n process.exit(USAGE_CODE);\n },\n };\n\n try {\n const load = COMMANDS[first];\n if (load) await (await load()).default(ctx);\n else await (await import('./cli/named.ts')).default(ctx, first);\n } catch (err) {\n console.error((err as Error).message);\n process.exit(ERROR_CODE);\n }\n}\n"],"names":["cli","packageVersion","load","createRequire","rel","pkg","name","version","usage","lines","Object","values","USAGE","map","u","join","resolveConfigFor","configPath","options","cfg","loadConfig","query","writeMigration","build","migratedFrom","undefined","console","warn","SUPPORTED_CONFIG_VERSION","unknownKeys","argv","first","queries","queryName","RENAMED","ctx","err","process","stdout","on","code","error","message","exitCode","ERROR_CODE","startsWith","parseArgs","args","type","default","short","help","list","config","allowPositionals","exit","USAGE_CODE","log","keys","sort","find","slice","resolveConfig","usageError","COMMANDS"],"mappings":";;;;+BA8CA,kGAAkG;AAClG;;;eAA8BA;;;0BA/CA;wBACJ;2BACa;uBACP;wBAGqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAErD,4FAA4F;AAC5F,4FAA4F;AAE5F,0FAA0F;AAC1F,SAASC;IACP,IAAMC,OAAOC,IAAAA,yBAAa,EAAC;IAC3B,gBAAkB,QAAA;QAAC;QAAmB;QAAsB;KAAwB,OAAlE,mBAAoE;YAA3EC,MAAO;QAChB,IAAI;YACF,IAAMC,MAAMH,KAAKE;YACjB,IAAIC,IAAIC,IAAI,KAAK,iBAAi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;4BACdL,QAAQkB,IAAI,CAACC,uBAAU;wBACzB;oBACF;;;;;;;;;oBAGQtD,OAAO8D,iBAAQ,CAACjC,MAAM;yBACxB7B,MAAAA;;;;oBAAa;;wBAAMA;;;oBAAb;;wBAAO,cAAc+C,OAAO,CAACd;;;oBAA7B;;;;;;oBACE;;wBAAM;2EAAA,QAAO;;;;oBAApB;;wBAAO,cAAgCc,OAAO,CAACd,KAAKJ;;;oBAApD;;;;;;;;oBACEK;oBACPV,QAAQe,KAAK,CAAC,AAACL,IAAcM,OAAO;oBACpCL,QAAQkB,IAAI,CAACX,uBAAU;;;;;;;;;;;IAE3B"}
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/open-source/ai/sensemaking/src/cli.ts"],"sourcesContent":["import { createRequire } from 'node:module';\nimport { parseArgs } from 'node:util';\nimport { ERROR_CODE, USAGE_CODE } from './cli/constants.ts';\nimport { COMMANDS, USAGE } from './cli/index.ts';\nimport type { Ctx } from './cli/types.ts';\nimport type { LoadConfigOptions } from './config/index.ts';\nimport { loadConfig, SUPPORTED_CONFIG_VERSION } from './config/index.ts';\n\n// Parsing and dispatch only; commands lazy-load from src/cli/, so nothing heavy is imported\n// here. Flags parse per command -- this file handles only --version/--help/--list/--config.\n\n// Works from dist/cjs and dist/esm alike: walk up past the dist type-marker package.json.\nfunction packageVersion(): string {\n const load = createRequire(import.meta.url);\n for (const rel of ['../package.json', '../../package.json', '../../../package.json']) {\n try {\n const pkg = load(rel) as { name?: string; version?: string };\n if (pkg.name === 'sensemaking' && pkg.version) return pkg.version;\n } catch {}\n }\n return 'unknown';\n}\n\nfunction usage(name: string): string {\n const lines = Object.values(USAGE).map((u) => ` ${name} ${u}`);\n return [`usage: ${name} <name> [params...] [--format table|json|csv] [--config path]`, ...lines, ` ${name} --list`, ` ${name} --version`].join('\\n');\n}\n\nfunction resolveConfigFor(name: string, configPath: string | undefined, options: LoadConfigOptions & { query?: boolean } = {}) {\n // Read the query policy before allowing a migration to write configuration state.\n let cfg = loadConfig(configPath, options.query ? { writeMigration: false } : options);\n const writeMigration = options.writeMigration !== false && (!options.query || cfg.build !== false);\n if (options.query && writeMigration && cfg.migratedFrom !== undefined) cfg = loadConfig(configPath);\n if (cfg.migratedFrom !== undefined) {\n console.warn(\n !writeMigration\n ? `${name}: ${cfg.configPath} needs migration from config version ${cfg.migratedFrom} to ${SUPPORTED_CONFIG_VERSION}; using the migrated form in memory only (run ${name} build to update the file)`\n : `${name}: migrated ${cfg.configPath} from config version ${cfg.migratedFrom} to ${SUPPORTED_CONFIG_VERSION}`\n );\n }\n if (cfg.unknownKeys !== undefined) {\n console.warn(`${name}: ${cfg.configPath} sets ${cfg.unknownKeys.join(', ')}, which this build does not read (no effect); see schema.json for the keys it does`);\n }\n return cfg;\n}\n\n// Thrown errors exit with ERROR_CODE and the message verbatim; usage errors exit with USAGE_CODE.\nexport default async function cli(argv: string[], name: string): Promise<void> {\n // A closed pipe reader's EPIPE arrives async, after the write loop returns: console.log absorbs it, process.stdout.write (streaming formats) does not, so an unhandled listener kills the process.\n // A throw here is uncaught (async); process.exit() would skip `sense watch`'s cleanup, leaving a heartbeat behind that makes a dead watcher look alive.\n process.stdout.on('error', (err: NodeJS.ErrnoException) => {\n if (err.code === 'EPIPE') return;\n console.error(`sense: ${err.message}`);\n process.exitCode = ERROR_CODE;\n });\n\n const first = argv[0];\n\n // No command word, or the first token looks like a flag: the only flags this level knows.\n if (!first || first.startsWith('-')) {\n let values: Record<string, string | boolean | undefined>;\n try {\n ({ values } = parseArgs({\n args: argv,\n options: {\n version: { type: 'boolean', default: false, short: 'v' },\n help: { type: 'boolean', default: false, short: 'h' },\n list: { type: 'boolean', default: false },\n config: { type: 'string' },\n },\n allowPositionals: true,\n }));\n } catch (err) {\n console.error((err as Error).message);\n console.error(usage(name));\n process.exit(USAGE_CODE);\n }\n\n try {\n if (values.version) {\n console.log(packageVersion());\n return;\n }\n if (values.help) {\n console.log(usage(name));\n return;\n }\n if (values.list) {\n const queries = resolveConfigFor(name, values.config as string | undefined).queries;\n for (const queryName of Object.keys(queries).sort()) {\n // Every entry names its verb, so --list can label both kinds rather than only\n // marking the exception.\n console.log(`${queryName} (${'search' in queries[queryName] ? 'search' : 'sql'})`);\n }\n return;\n }\n } catch (err) {\n console.error((err as Error).message);\n process.exit(ERROR_CODE);\n }\n\n console.error(usage(name));\n process.exit(USAGE_CODE);\n }\n\n // Renamed verbs get a pointer to their current name instead of the unknown-entry error: find ->\n // search, and query -> sql (which took its name back from the search sense of \"query\").\n const RENAMED: Record<string, string> = { find: 'search', query: 'sql' };\n if (RENAMED[first]) {\n console.error(`${name}: ${first} is now ${RENAMED[first]}`);\n console.error(usage(name));\n process.exit(USAGE_CODE);\n }\n\n const ctx: Ctx = {\n name,\n argv: argv.slice(1),\n resolveConfig: (configPath, options) => resolveConfigFor(name, configPath, options),\n usageError(message) {\n console.error(message);\n process.exit(USAGE_CODE);\n },\n };\n\n try {\n const load = COMMANDS[first];\n if (load) await (await load()).default(ctx);\n else await (await import('./cli/named.ts')).default(ctx, first);\n } catch (err) {\n console.error((err as Error).message);\n process.exit(ERROR_CODE);\n }\n}\n"],"names":["cli","packageVersion","load","createRequire","rel","pkg","name","version","usage","lines","Object","values","USAGE","map","u","join","resolveConfigFor","configPath","options","cfg","loadConfig","query","writeMigration","build","migratedFrom","undefined","console","warn","SUPPORTED_CONFIG_VERSION","unknownKeys","argv","first","queries","queryName","RENAMED","ctx","err","process","stdout","on","code","error","message","exitCode","ERROR_CODE","startsWith","parseArgs","args","type","default","short","help","list","config","allowPositionals","exit","USAGE_CODE","log","keys","sort","find","slice","resolveConfig","usageError","COMMANDS"],"mappings":";;;;+BA8CA,kGAAkG;AAClG;;;eAA8BA;;;kBA/CA,QAAA;gBACJ,QAAA;iBACa,QAAA;aACP,QAAA;cAGqB,QAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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