sensemaking 0.16.0 → 0.17.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 +1 -1
- package/dist/cjs/chunk/extract.d.cts +2 -0
- package/dist/cjs/chunk/extract.d.ts +2 -0
- package/dist/cjs/chunk/extract.js +139 -0
- package/dist/cjs/chunk/extract.js.map +1 -0
- package/dist/cjs/chunk/group.d.cts +4 -0
- package/dist/cjs/chunk/group.d.ts +4 -0
- package/dist/cjs/chunk/group.js +489 -0
- package/dist/cjs/chunk/group.js.map +1 -0
- package/dist/cjs/chunk/index.d.cts +8 -0
- package/dist/cjs/chunk/index.d.ts +8 -0
- package/dist/cjs/chunk/index.js +44 -0
- package/dist/cjs/chunk/index.js.map +1 -0
- package/dist/cjs/chunk/parse.d.cts +2 -0
- package/dist/cjs/chunk/parse.d.ts +2 -0
- package/dist/cjs/chunk/parse.js +71 -0
- package/dist/cjs/chunk/parse.js.map +1 -0
- package/dist/cjs/chunk/types.d.cts +19 -0
- package/dist/cjs/chunk/types.d.ts +19 -0
- package/dist/cjs/chunk/types.js +5 -0
- package/dist/cjs/chunk/types.js.map +1 -0
- package/dist/cjs/chunk/version.d.cts +1 -0
- package/dist/cjs/chunk/version.d.ts +1 -0
- package/dist/cjs/chunk/version.js +14 -0
- package/dist/cjs/chunk/version.js.map +1 -0
- package/dist/cjs/cli/map.js +1 -1
- package/dist/cjs/cli/map.js.map +1 -1
- package/dist/cjs/cli/named.js +1 -1
- package/dist/cjs/cli/named.js.map +1 -1
- package/dist/cjs/cli/path.js +2 -2
- package/dist/cjs/cli/path.js.map +1 -1
- package/dist/cjs/cli/peek.js +1 -1
- package/dist/cjs/cli/peek.js.map +1 -1
- package/dist/cjs/cli/related.js +1 -1
- package/dist/cjs/cli/related.js.map +1 -1
- package/dist/cjs/cli/search.js +1 -1
- package/dist/cjs/cli/search.js.map +1 -1
- package/dist/cjs/cli/shared.d.cts +1 -1
- package/dist/cjs/cli/shared.d.ts +1 -1
- package/dist/cjs/cli/shared.js +3 -3
- package/dist/cjs/cli/shared.js.map +1 -1
- package/dist/cjs/cli/status.js +1 -1
- package/dist/cjs/cli/status.js.map +1 -1
- package/dist/cjs/commands/map.d.cts +1 -1
- package/dist/cjs/commands/map.d.ts +1 -1
- package/dist/cjs/commands/map.js.map +1 -1
- package/dist/cjs/commands/peek.d.cts +1 -1
- package/dist/cjs/commands/peek.d.ts +1 -1
- package/dist/cjs/commands/peek.js +13 -6
- package/dist/cjs/commands/peek.js.map +1 -1
- package/dist/cjs/commands/scope.js +1 -1
- package/dist/cjs/commands/scope.js.map +1 -1
- package/dist/cjs/commands/search.d.cts +1 -1
- package/dist/cjs/commands/search.d.ts +1 -1
- package/dist/cjs/commands/search.js +3 -3
- package/dist/cjs/commands/search.js.map +1 -1
- package/dist/cjs/commands/signals.js +1 -1
- package/dist/cjs/commands/signals.js.map +1 -1
- package/dist/cjs/config/access.d.cts +3 -1
- package/dist/cjs/config/access.d.ts +3 -1
- package/dist/cjs/config/access.js +11 -11
- package/dist/cjs/config/access.js.map +1 -1
- package/dist/cjs/config/index.d.cts +1 -0
- package/dist/cjs/config/index.d.ts +1 -0
- package/dist/cjs/config/index.js +4 -0
- package/dist/cjs/config/index.js.map +1 -1
- package/dist/cjs/config/types.d.cts +1 -0
- package/dist/cjs/config/types.d.ts +1 -0
- package/dist/cjs/config/types.js.map +1 -1
- package/dist/cjs/config/validate.d.cts +1 -0
- package/dist/cjs/config/validate.d.ts +1 -0
- package/dist/cjs/config/validate.js +8 -1
- 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 +4 -4
- package/dist/cjs/db/open.js.map +1 -1
- package/dist/cjs/db/reconcile.js +8 -8
- package/dist/cjs/db/reconcile.js.map +1 -1
- package/dist/cjs/{sql-functions.js → db/sql-functions.js} +1 -1
- package/dist/cjs/db/sql-functions.js.map +1 -0
- package/dist/cjs/embed/langfit.js +45 -85
- package/dist/cjs/embed/langfit.js.map +1 -1
- package/dist/cjs/embed/languages.js.map +1 -1
- package/dist/cjs/embed/query.js +6 -6
- package/dist/cjs/embed/query.js.map +1 -1
- package/dist/cjs/embed/static.js +3 -40
- package/dist/cjs/embed/static.js.map +1 -1
- package/dist/cjs/features/embed.d.cts +2 -5
- package/dist/cjs/features/embed.d.ts +2 -5
- package/dist/cjs/features/embed.js +36 -58
- package/dist/cjs/features/embed.js.map +1 -1
- package/dist/cjs/{fences.js → features/fences.js} +1 -1
- package/dist/cjs/features/fences.js.map +1 -0
- package/dist/cjs/features/links.js +1 -1
- package/dist/cjs/features/links.js.map +1 -1
- package/dist/cjs/features/rank.js +1 -1
- package/dist/cjs/features/rank.js.map +1 -1
- package/dist/cjs/features/sections.js +4 -3
- package/dist/cjs/features/sections.js.map +1 -1
- package/dist/cjs/features/tags.js +1 -1
- package/dist/cjs/features/tags.js.map +1 -1
- package/dist/cjs/features/types.d.cts +4 -2
- package/dist/cjs/features/types.d.ts +4 -2
- package/dist/cjs/graph/graph.js.map +1 -0
- package/dist/cjs/graph/traverse.js.map +1 -0
- package/dist/cjs/index.d.cts +4 -4
- package/dist/cjs/index.d.ts +4 -4
- package/dist/cjs/index.js +4 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/output/column-hint.js.map +1 -0
- package/dist/cjs/output/output.js.map +1 -0
- package/dist/cjs/output/progress.js.map +1 -0
- package/dist/cjs/{search-error.js → output/search-error.js} +1 -1
- package/dist/cjs/output/search-error.js.map +1 -0
- package/dist/cjs/scan/frontmatter.d.cts +13 -0
- package/dist/cjs/scan/frontmatter.d.ts +13 -0
- package/dist/cjs/scan/frontmatter.js +229 -0
- package/dist/cjs/scan/frontmatter.js.map +1 -0
- package/dist/cjs/scan/index.d.cts +25 -0
- package/dist/cjs/scan/index.d.ts +25 -0
- package/dist/cjs/scan/index.js +107 -0
- package/dist/cjs/scan/index.js.map +1 -0
- package/dist/cjs/scan/list.d.cts +12 -0
- package/dist/cjs/scan/list.d.ts +12 -0
- package/dist/cjs/scan/list.js +154 -0
- package/dist/cjs/scan/list.js.map +1 -0
- package/dist/cjs/text/segment.d.cts +3 -0
- package/dist/cjs/text/segment.d.ts +3 -0
- package/dist/cjs/{segment.js → text/segment.js} +17 -14
- package/dist/cjs/text/segment.js.map +1 -0
- package/dist/cjs/text/strip.d.cts +3 -0
- package/dist/cjs/text/strip.d.ts +3 -0
- package/dist/cjs/text/strip.js +32 -0
- package/dist/cjs/text/strip.js.map +1 -0
- package/dist/esm/chunk/extract.d.ts +2 -0
- package/dist/esm/chunk/extract.js +114 -0
- package/dist/esm/chunk/extract.js.map +1 -0
- package/dist/esm/chunk/group.d.ts +4 -0
- package/dist/esm/chunk/group.js +253 -0
- package/dist/esm/chunk/group.js.map +1 -0
- package/dist/esm/chunk/index.d.ts +8 -0
- package/dist/esm/chunk/index.js +16 -0
- package/dist/esm/chunk/index.js.map +1 -0
- package/dist/esm/chunk/parse.d.ts +2 -0
- package/dist/esm/chunk/parse.js +63 -0
- package/dist/esm/chunk/parse.js.map +1 -0
- package/dist/esm/chunk/types.d.ts +19 -0
- package/dist/esm/chunk/types.js +2 -0
- package/dist/esm/chunk/types.js.map +1 -0
- package/dist/esm/chunk/version.d.ts +1 -0
- package/dist/esm/chunk/version.js +3 -0
- package/dist/esm/chunk/version.js.map +1 -0
- package/dist/esm/cli/map.js +1 -1
- package/dist/esm/cli/map.js.map +1 -1
- package/dist/esm/cli/named.js +1 -1
- package/dist/esm/cli/named.js.map +1 -1
- package/dist/esm/cli/path.js +2 -2
- package/dist/esm/cli/path.js.map +1 -1
- package/dist/esm/cli/peek.js +1 -1
- package/dist/esm/cli/peek.js.map +1 -1
- package/dist/esm/cli/related.js +1 -1
- package/dist/esm/cli/related.js.map +1 -1
- package/dist/esm/cli/search.js +1 -1
- package/dist/esm/cli/search.js.map +1 -1
- package/dist/esm/cli/shared.d.ts +1 -1
- package/dist/esm/cli/shared.js +3 -3
- package/dist/esm/cli/shared.js.map +1 -1
- package/dist/esm/cli/status.js +1 -1
- package/dist/esm/cli/status.js.map +1 -1
- package/dist/esm/commands/map.d.ts +1 -1
- package/dist/esm/commands/map.js.map +1 -1
- package/dist/esm/commands/peek.d.ts +1 -1
- package/dist/esm/commands/peek.js +8 -1
- package/dist/esm/commands/peek.js.map +1 -1
- package/dist/esm/commands/scope.js +1 -1
- package/dist/esm/commands/scope.js.map +1 -1
- package/dist/esm/commands/search.d.ts +1 -1
- package/dist/esm/commands/search.js +3 -3
- package/dist/esm/commands/search.js.map +1 -1
- package/dist/esm/commands/signals.js +1 -1
- package/dist/esm/commands/signals.js.map +1 -1
- package/dist/esm/config/access.d.ts +3 -1
- package/dist/esm/config/access.js +9 -9
- package/dist/esm/config/access.js.map +1 -1
- package/dist/esm/config/index.d.ts +1 -0
- package/dist/esm/config/index.js +1 -0
- package/dist/esm/config/index.js.map +1 -1
- package/dist/esm/config/types.d.ts +1 -0
- package/dist/esm/config/types.js.map +1 -1
- package/dist/esm/config/validate.d.ts +1 -0
- package/dist/esm/config/validate.js +8 -2
- package/dist/esm/config/validate.js.map +1 -1
- package/dist/esm/db/open.d.ts +1 -1
- package/dist/esm/db/open.js +5 -5
- package/dist/esm/db/open.js.map +1 -1
- package/dist/esm/db/reconcile.js +4 -4
- package/dist/esm/db/reconcile.js.map +1 -1
- package/dist/esm/{sql-functions.js → db/sql-functions.js} +1 -1
- package/dist/esm/db/sql-functions.js.map +1 -0
- package/dist/esm/embed/langfit.js +3 -3
- package/dist/esm/embed/langfit.js.map +1 -1
- package/dist/esm/embed/languages.js.map +1 -1
- package/dist/esm/embed/query.js +5 -5
- package/dist/esm/embed/query.js.map +1 -1
- package/dist/esm/embed/static.js +1 -2
- package/dist/esm/embed/static.js.map +1 -1
- package/dist/esm/features/embed.d.ts +2 -5
- package/dist/esm/features/embed.js +34 -32
- package/dist/esm/features/embed.js.map +1 -1
- package/dist/esm/{fences.js → features/fences.js} +1 -1
- package/dist/esm/features/fences.js.map +1 -0
- package/dist/esm/features/links.js +1 -1
- package/dist/esm/features/links.js.map +1 -1
- package/dist/esm/features/rank.js +1 -1
- package/dist/esm/features/rank.js.map +1 -1
- package/dist/esm/features/sections.js +4 -3
- package/dist/esm/features/sections.js.map +1 -1
- package/dist/esm/features/tags.js +1 -1
- package/dist/esm/features/tags.js.map +1 -1
- package/dist/esm/features/types.d.ts +4 -2
- package/dist/esm/features/types.js.map +1 -1
- package/dist/esm/graph/graph.js.map +1 -0
- package/dist/esm/graph/traverse.js.map +1 -0
- package/dist/esm/index.d.ts +4 -4
- package/dist/esm/index.js +2 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/output/column-hint.js.map +1 -0
- package/dist/esm/output/output.js.map +1 -0
- package/dist/esm/output/progress.js.map +1 -0
- package/dist/esm/{search-error.js → output/search-error.js} +1 -1
- package/dist/esm/output/search-error.js.map +1 -0
- package/dist/esm/scan/frontmatter.d.ts +13 -0
- package/dist/esm/{scan.js → scan/frontmatter.js} +4 -123
- package/dist/esm/scan/frontmatter.js.map +1 -0
- package/dist/esm/scan/index.d.ts +25 -0
- package/dist/esm/scan/index.js +58 -0
- package/dist/esm/scan/index.js.map +1 -0
- package/dist/esm/scan/list.d.ts +12 -0
- package/dist/esm/scan/list.js +58 -0
- package/dist/esm/scan/list.js.map +1 -0
- package/dist/esm/text/segment.d.ts +3 -0
- package/dist/esm/{segment.js → text/segment.js} +3 -3
- package/dist/esm/text/segment.js.map +1 -0
- package/dist/esm/text/strip.d.ts +3 -0
- package/dist/esm/text/strip.js +12 -0
- package/dist/esm/text/strip.js.map +1 -0
- package/package.json +15 -2
- package/schema.json +8 -1
- package/skills/sense/SKILL.md +1 -1
- package/skills/sense-setup/SKILL.md +3 -3
- package/dist/cjs/column-hint.js.map +0 -1
- package/dist/cjs/fences.js.map +0 -1
- package/dist/cjs/graph.js.map +0 -1
- package/dist/cjs/output.js.map +0 -1
- package/dist/cjs/progress.js.map +0 -1
- package/dist/cjs/scan.d.cts +0 -35
- package/dist/cjs/scan.d.ts +0 -35
- package/dist/cjs/scan.js +0 -436
- package/dist/cjs/scan.js.map +0 -1
- package/dist/cjs/search-error.js.map +0 -1
- package/dist/cjs/segment.d.cts +0 -2
- package/dist/cjs/segment.d.ts +0 -2
- package/dist/cjs/segment.js.map +0 -1
- package/dist/cjs/sql-functions.js.map +0 -1
- package/dist/cjs/traverse.js.map +0 -1
- package/dist/esm/column-hint.js.map +0 -1
- package/dist/esm/fences.js.map +0 -1
- package/dist/esm/graph.js.map +0 -1
- package/dist/esm/output.js.map +0 -1
- package/dist/esm/progress.js.map +0 -1
- package/dist/esm/scan.d.ts +0 -35
- package/dist/esm/scan.js.map +0 -1
- package/dist/esm/search-error.js.map +0 -1
- package/dist/esm/segment.d.ts +0 -2
- package/dist/esm/segment.js.map +0 -1
- package/dist/esm/sql-functions.js.map +0 -1
- package/dist/esm/traverse.js.map +0 -1
- /package/dist/cjs/{sql-functions.d.cts → db/sql-functions.d.cts} +0 -0
- /package/dist/cjs/{sql-functions.d.ts → db/sql-functions.d.ts} +0 -0
- /package/dist/cjs/{fences.d.cts → features/fences.d.cts} +0 -0
- /package/dist/cjs/{fences.d.ts → features/fences.d.ts} +0 -0
- /package/dist/cjs/{graph.d.cts → graph/graph.d.cts} +0 -0
- /package/dist/cjs/{graph.d.ts → graph/graph.d.ts} +0 -0
- /package/dist/cjs/{graph.js → graph/graph.js} +0 -0
- /package/dist/cjs/{traverse.d.cts → graph/traverse.d.cts} +0 -0
- /package/dist/cjs/{traverse.d.ts → graph/traverse.d.ts} +0 -0
- /package/dist/cjs/{traverse.js → graph/traverse.js} +0 -0
- /package/dist/cjs/{column-hint.d.cts → output/column-hint.d.cts} +0 -0
- /package/dist/cjs/{column-hint.d.ts → output/column-hint.d.ts} +0 -0
- /package/dist/cjs/{column-hint.js → output/column-hint.js} +0 -0
- /package/dist/cjs/{output.d.cts → output/output.d.cts} +0 -0
- /package/dist/cjs/{output.d.ts → output/output.d.ts} +0 -0
- /package/dist/cjs/{output.js → output/output.js} +0 -0
- /package/dist/cjs/{progress.d.cts → output/progress.d.cts} +0 -0
- /package/dist/cjs/{progress.d.ts → output/progress.d.ts} +0 -0
- /package/dist/cjs/{progress.js → output/progress.js} +0 -0
- /package/dist/cjs/{search-error.d.cts → output/search-error.d.cts} +0 -0
- /package/dist/cjs/{search-error.d.ts → output/search-error.d.ts} +0 -0
- /package/dist/esm/{sql-functions.d.ts → db/sql-functions.d.ts} +0 -0
- /package/dist/esm/{fences.d.ts → features/fences.d.ts} +0 -0
- /package/dist/esm/{graph.d.ts → graph/graph.d.ts} +0 -0
- /package/dist/esm/{graph.js → graph/graph.js} +0 -0
- /package/dist/esm/{traverse.d.ts → graph/traverse.d.ts} +0 -0
- /package/dist/esm/{traverse.js → graph/traverse.js} +0 -0
- /package/dist/esm/{column-hint.d.ts → output/column-hint.d.ts} +0 -0
- /package/dist/esm/{column-hint.js → output/column-hint.js} +0 -0
- /package/dist/esm/{output.d.ts → output/output.d.ts} +0 -0
- /package/dist/esm/{output.js → output/output.js} +0 -0
- /package/dist/esm/{progress.d.ts → output/progress.d.ts} +0 -0
- /package/dist/esm/{progress.js → output/progress.js} +0 -0
- /package/dist/esm/{search-error.d.ts → output/search-error.d.ts} +0 -0
|
@@ -8,7 +8,7 @@ Object.defineProperty(exports, "searchError", {
|
|
|
8
8
|
return searchError;
|
|
9
9
|
}
|
|
10
10
|
});
|
|
11
|
-
var _errorsts = require("
|
|
11
|
+
var _errorsts = require("../errors.js");
|
|
12
12
|
// FTS5 reads punctuation as syntax, so `end-to-end` parses as a filter on column `to` and
|
|
13
13
|
// errors `no such column: to` -- true about the parse, misleading about the input. Matched as
|
|
14
14
|
// "not a bareword": an operator list is a list to keep current, and missing a character costs
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/output/search-error.ts"],"sourcesContent":["import { SenseError } from '../errors.ts';\n\n// FTS5 reads punctuation as syntax, so `end-to-end` parses as a filter on column `to` and\n// errors `no such column: to` -- true about the parse, misleading about the input. Matched as\n// \"not a bareword\": an operator list is a list to keep current, and missing a character costs\n// the remedy, not the error.\nconst FTS5_PUNCTUATION = /[^\\p{L}\\p{N}_\\s]/u;\n\nexport function searchError(err: Error, terms: string, scope?: string): Error {\n const message = err.message;\n if (!/no such column|fts5: syntax error|malformed MATCH/.test(message)) return err;\n const suspects = (terms.match(/\\S+/g) ?? []).filter((t) => !t.startsWith('\"') && FTS5_PUNCTUATION.test(t));\n // Blame the terms only when the failing token actually came from one -- a typo'd column\n // in --where (or the tree's default scope) raises \"no such column\" through this same\n // statement, and naming a term for it would state a false fact about the input.\n const col = /no such column: (\\S+)/.exec(message)?.[1];\n const fromTerms = col === undefined ? suspects.length > 0 : suspects.some((t) => t.split(/[^\\p{L}\\p{N}]+/u).includes(col));\n if (fromTerms && suspects.length > 0) {\n return new SenseError('SEARCH_SYNTAX', `${message} -- the punctuation in ${suspects.map((t) => `\\`${t}\\``).join(', ')} is FTS5 syntax, not literal text; search for it literally by double-quoting: '\"${suspects[0]}\"'. Searchable columns are title, summary, text.`);\n }\n if (col !== undefined && scope !== undefined) {\n return new SenseError('SEARCH_SYNTAX', `${message} -- the where condition (${scope}) references it; frontmatter columns are listed by sense sql \"SELECT name FROM pragma_table_info('frontmatter')\".`);\n }\n return new SenseError('SEARCH_SYNTAX', `${message} -- searchable columns are title, summary, text; frontmatter fields are queried with --where or sense sql (list them with pragma_table_info('frontmatter')).`);\n}\n"],"names":["searchError","FTS5_PUNCTUATION","err","terms","scope","message","test","suspects","match","filter","t","startsWith","col","exec","fromTerms","undefined","length","some","split","includes","SenseError","map","join"],"mappings":";;;;+BAQgBA;;;eAAAA;;;wBARW;AAE3B,0FAA0F;AAC1F,8FAA8F;AAC9F,8FAA8F;AAC9F,6BAA6B;AAC7B,IAAMC,mBAAmB;AAElB,SAASD,YAAYE,GAAU,EAAEC,KAAa,EAAEC,KAAc;QAGjDD;QAIN;IANZ,IAAME,UAAUH,IAAIG,OAAO;IAC3B,IAAI,CAAC,oDAAoDC,IAAI,CAACD,UAAU,OAAOH;IAC/E,IAAMK,WAAW,EAACJ,eAAAA,MAAMK,KAAK,CAAC,qBAAZL,0BAAAA,eAAuB,EAAE,EAAEM,MAAM,CAAC,SAACC;eAAM,CAACA,EAAEC,UAAU,CAAC,QAAQV,iBAAiBK,IAAI,CAACI;;IACvG,wFAAwF;IACxF,qFAAqF;IACrF,gFAAgF;IAChF,IAAME,OAAM,QAAA,wBAAwBC,IAAI,CAACR,sBAA7B,4BAAA,KAAuC,CAAC,EAAE;IACtD,IAAMS,YAAYF,QAAQG,YAAYR,SAASS,MAAM,GAAG,IAAIT,SAASU,IAAI,CAAC,SAACP;eAAMA,EAAEQ,KAAK,CAAC,8maAAmBC,QAAQ,CAACP;;IACrH,IAAIE,aAAaP,SAASS,MAAM,GAAG,GAAG;QACpC,OAAO,IAAII,oBAAU,CAAC,iBAAiB,AAAC,GAAmCb,OAAjCF,SAAQ,2BAAsJE,OAA7HA,SAASc,GAAG,CAAC,SAACX;mBAAM,AAAC,IAAM,OAAFA,GAAE;WAAKY,IAAI,CAAC,OAAM,qFAA8F,OAAZf,QAAQ,CAAC,EAAE,EAAC;IACtN;IACA,IAAIK,QAAQG,aAAaX,UAAUW,WAAW;QAC5C,OAAO,IAAIK,oBAAU,CAAC,iBAAiB,AAAC,GAAqChB,OAAnCC,SAAQ,6BAAiC,OAAND,OAAM;IACrF;IACA,OAAO,IAAIgB,oBAAU,CAAC,iBAAiB,AAAC,GAAU,OAARf,SAAQ;AACpD"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const RESERVED_COLUMNS: Set<string>;
|
|
2
|
+
export declare function normalizeText(value: unknown): string;
|
|
3
|
+
export declare function looksLikeDatetime(value: string): boolean;
|
|
4
|
+
export declare function normalizeDate(value: string): string;
|
|
5
|
+
export declare function mapValue(value: unknown): string | number | bigint | null;
|
|
6
|
+
export declare function splitFrontmatter(raw: string): {
|
|
7
|
+
fm: string | null;
|
|
8
|
+
body: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function parseFrontmatter(relPath: string, fm: string, warnings: string[]): {
|
|
11
|
+
data: Record<string, unknown>;
|
|
12
|
+
parseError: string | null;
|
|
13
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const RESERVED_COLUMNS: Set<string>;
|
|
2
|
+
export declare function normalizeText(value: unknown): string;
|
|
3
|
+
export declare function looksLikeDatetime(value: string): boolean;
|
|
4
|
+
export declare function normalizeDate(value: string): string;
|
|
5
|
+
export declare function mapValue(value: unknown): string | number | bigint | null;
|
|
6
|
+
export declare function splitFrontmatter(raw: string): {
|
|
7
|
+
fm: string | null;
|
|
8
|
+
body: string;
|
|
9
|
+
};
|
|
10
|
+
export declare function parseFrontmatter(relPath: string, fm: string, warnings: string[]): {
|
|
11
|
+
data: Record<string, unknown>;
|
|
12
|
+
parseError: string | null;
|
|
13
|
+
};
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get RESERVED_COLUMNS () {
|
|
13
|
+
return RESERVED_COLUMNS;
|
|
14
|
+
},
|
|
15
|
+
get looksLikeDatetime () {
|
|
16
|
+
return looksLikeDatetime;
|
|
17
|
+
},
|
|
18
|
+
get mapValue () {
|
|
19
|
+
return mapValue;
|
|
20
|
+
},
|
|
21
|
+
get normalizeDate () {
|
|
22
|
+
return normalizeDate;
|
|
23
|
+
},
|
|
24
|
+
get normalizeText () {
|
|
25
|
+
return normalizeText;
|
|
26
|
+
},
|
|
27
|
+
get parseFrontmatter () {
|
|
28
|
+
return parseFrontmatter;
|
|
29
|
+
},
|
|
30
|
+
get splitFrontmatter () {
|
|
31
|
+
return splitFrontmatter;
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
var _yaml = require("yaml");
|
|
35
|
+
function _array_like_to_array(arr, len) {
|
|
36
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
37
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
38
|
+
return arr2;
|
|
39
|
+
}
|
|
40
|
+
function _array_with_holes(arr) {
|
|
41
|
+
if (Array.isArray(arr)) return arr;
|
|
42
|
+
}
|
|
43
|
+
function _iterable_to_array_limit(arr, i) {
|
|
44
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
45
|
+
if (_i == null) return;
|
|
46
|
+
var _arr = [];
|
|
47
|
+
var _n = true;
|
|
48
|
+
var _d = false;
|
|
49
|
+
var _s, _e;
|
|
50
|
+
try {
|
|
51
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
52
|
+
_arr.push(_s.value);
|
|
53
|
+
if (i && _arr.length === i) break;
|
|
54
|
+
}
|
|
55
|
+
} catch (err) {
|
|
56
|
+
_d = true;
|
|
57
|
+
_e = err;
|
|
58
|
+
} finally{
|
|
59
|
+
try {
|
|
60
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
61
|
+
} finally{
|
|
62
|
+
if (_d) throw _e;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return _arr;
|
|
66
|
+
}
|
|
67
|
+
function _non_iterable_rest() {
|
|
68
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
69
|
+
}
|
|
70
|
+
function _sliced_to_array(arr, i) {
|
|
71
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
72
|
+
}
|
|
73
|
+
function _type_of(obj) {
|
|
74
|
+
"@swc/helpers - typeof";
|
|
75
|
+
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
76
|
+
}
|
|
77
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
78
|
+
if (!o) return;
|
|
79
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
80
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
81
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
82
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
83
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
84
|
+
}
|
|
85
|
+
var RESERVED_COLUMNS = new Set([
|
|
86
|
+
'path',
|
|
87
|
+
'_mtime',
|
|
88
|
+
'_ctime',
|
|
89
|
+
'_size',
|
|
90
|
+
'_rank',
|
|
91
|
+
'_parse_error',
|
|
92
|
+
'content',
|
|
93
|
+
'links',
|
|
94
|
+
'sections'
|
|
95
|
+
]);
|
|
96
|
+
// YAML error codes whose recovery is unambiguous, so the parse is accepted rather than
|
|
97
|
+
// quarantined. Only one qualifies: YAML 1.2 reserves `@` and `` ` `` at the start of a plain
|
|
98
|
+
// scalar for future use, so they can never be valid and the text can only be what was typed
|
|
99
|
+
// (`aliases: [@handle]` -> ["@handle"]). Every other code has a second reading -- an unquoted
|
|
100
|
+
// `:` swallows the keys after it, an unquoted `[..](..)` drops the URL, a duplicate key picks
|
|
101
|
+
// one value in silence -- so it writes values nobody wrote.
|
|
102
|
+
var ACCEPTED_YAML_CODES = new Set([
|
|
103
|
+
'BAD_SCALAR_START'
|
|
104
|
+
]);
|
|
105
|
+
function normalizeText(value) {
|
|
106
|
+
if (value === null || value === undefined) return '';
|
|
107
|
+
return String(value).replace(/\s+/g, ' ').trim();
|
|
108
|
+
}
|
|
109
|
+
// SQLite's datetime() rejects a colonless offset (`-0800`) and a space separator, which ISO 8601
|
|
110
|
+
// allows and producers emit. A rejected date is invisible, not excluded: every comparison is NULL.
|
|
111
|
+
var ISO_DATETIME = /^(\d{4}-\d{2}-\d{2})[T ](\d{2}:\d{2}(?::\d{2})?(?:\.\d+)?)(Z|[+-]\d{2}(?::?\d{2})?)?$/;
|
|
112
|
+
// A value opening `YYYY-MM-DDT` was meant to be a datetime; prose never is. Reported when it
|
|
113
|
+
// cannot be normalized, so a typo surfaces on the next crawl instead of at some later audit.
|
|
114
|
+
var MEANT_AS_DATETIME = /^\d{4}-\d{2}-\d{2}[T ]\d/;
|
|
115
|
+
function looksLikeDatetime(value) {
|
|
116
|
+
return MEANT_AS_DATETIME.test(value);
|
|
117
|
+
}
|
|
118
|
+
function normalizeDate(value) {
|
|
119
|
+
var m = ISO_DATETIME.exec(value);
|
|
120
|
+
if (m === null) return value;
|
|
121
|
+
var _m = _sliced_to_array(m, 4), date = _m[1], time = _m[2], zone = _m[3];
|
|
122
|
+
var digits = zone === undefined || zone === 'Z' ? '' : zone.replace(':', '');
|
|
123
|
+
var offset = digits === '' ? zone !== null && zone !== void 0 ? zone : '' : digits.length === 3 ? "".concat(digits, ":00") : "".concat(digits.slice(0, 3), ":").concat(digits.slice(3));
|
|
124
|
+
var normalized = "".concat(date, "T").concat(time).concat(offset);
|
|
125
|
+
return Number.isNaN(Date.parse(normalized)) ? value : normalized;
|
|
126
|
+
}
|
|
127
|
+
function mapValue(value) {
|
|
128
|
+
if (value === null || value === undefined) return null;
|
|
129
|
+
if (typeof value === 'boolean') return BigInt(value ? 1 : 0);
|
|
130
|
+
if (typeof value === 'number') return Number.isSafeInteger(value) ? BigInt(value) : value;
|
|
131
|
+
if (typeof value === 'string') return normalizeDate(value);
|
|
132
|
+
return JSON.stringify(value);
|
|
133
|
+
}
|
|
134
|
+
function splitFrontmatter(raw) {
|
|
135
|
+
var open = raw.match(/^---\r?\n/);
|
|
136
|
+
if (!open) return {
|
|
137
|
+
fm: null,
|
|
138
|
+
body: raw
|
|
139
|
+
};
|
|
140
|
+
var rest = raw.slice(open[0].length);
|
|
141
|
+
var close = rest.match(/^---\r?(\n|$)/m);
|
|
142
|
+
if (!close || close.index === undefined) return {
|
|
143
|
+
fm: null,
|
|
144
|
+
body: raw
|
|
145
|
+
};
|
|
146
|
+
return {
|
|
147
|
+
fm: rest.slice(0, close.index),
|
|
148
|
+
body: rest.slice(close.index + close[0].length)
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
// A well-formed document can still hold a value nobody meant: `created: {{date}}` is valid
|
|
152
|
+
// YAML for a flow map used as a mapping key, so it raises no error and stores
|
|
153
|
+
// {"{ date }": null}. No error code can catch that, but yaml notices the stringified key, so
|
|
154
|
+
// this reports it with the path instead (yaml's own warning has none, fires once per document,
|
|
155
|
+
// and is what trains readers to discard stderr).
|
|
156
|
+
function warnStringifiedKeys(relPath, doc, warnings) {
|
|
157
|
+
var found = false;
|
|
158
|
+
// Nested, not top level: `created: {{date}}` puts the collection key one level down, inside
|
|
159
|
+
// the flow map that `{{...}}` parses as.
|
|
160
|
+
(0, _yaml.visit)(doc, {
|
|
161
|
+
Pair: function Pair(_key, pair) {
|
|
162
|
+
if (!(0, _yaml.isCollection)(pair.key)) return undefined;
|
|
163
|
+
found = true;
|
|
164
|
+
return _yaml.visit.BREAK;
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
// One per file: a template repeats the same mistake on every field it stamps.
|
|
168
|
+
if (found) warnings.push("warning: ".concat(relPath, " frontmatter has a key that is itself a list or mapping, stored as text; this is usually an unrendered template placeholder like {{date}}"));
|
|
169
|
+
}
|
|
170
|
+
// Accept a clean parse, and one whose every error is unambiguous (ACCEPTED_YAML_CODES).
|
|
171
|
+
// Anything else is quarantined: no frontmatter columns at all, and `_parse_error` carries the
|
|
172
|
+
// reason. Recovering it would write values nobody wrote, which is worse than absence because
|
|
173
|
+
// no query can see it. The file is still indexed -- content, links and sections never touch
|
|
174
|
+
// frontmatter -- so a broken note stays searchable while it is being hunted for.
|
|
175
|
+
// yaml's message continues onto a source excerpt, so the first line is the sentence -- minus
|
|
176
|
+
// the colon that introduced the part being dropped.
|
|
177
|
+
function firstLine(message) {
|
|
178
|
+
return message.split('\n')[0].replace(/:\s*$/, '');
|
|
179
|
+
}
|
|
180
|
+
function parseFrontmatter(relPath, fm, warnings) {
|
|
181
|
+
// logLevel silences yaml's own pathless warnings; warnStringifiedKeys re-reports the one
|
|
182
|
+
// that carries information, with the file it came from.
|
|
183
|
+
var doc = (0, _yaml.parseDocument)(fm, {
|
|
184
|
+
logLevel: 'silent'
|
|
185
|
+
});
|
|
186
|
+
var refused = doc.errors.filter(function(err) {
|
|
187
|
+
return !ACCEPTED_YAML_CODES.has(err.code);
|
|
188
|
+
});
|
|
189
|
+
if (refused.length > 0) {
|
|
190
|
+
var detail = refused.length > 1 ? " (and ".concat(refused.length - 1, " more)") : '';
|
|
191
|
+
var parseError = "".concat(firstLine(refused[0].message)).concat(detail);
|
|
192
|
+
warnings.push("warning: ".concat(relPath, " frontmatter did not parse, so none of it is indexed: ").concat(parseError));
|
|
193
|
+
return {
|
|
194
|
+
data: {},
|
|
195
|
+
parseError: parseError
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
var data;
|
|
199
|
+
try {
|
|
200
|
+
data = doc.toJS();
|
|
201
|
+
} catch (err) {
|
|
202
|
+
// Reaches here with doc.errors empty: `title: **Bold**` parses, then opens an alias on
|
|
203
|
+
// materialisation. An empty error list is not a successful parse.
|
|
204
|
+
var parseError1 = firstLine(err.message);
|
|
205
|
+
warnings.push("warning: ".concat(relPath, " frontmatter did not parse, so none of it is indexed: ").concat(parseError1));
|
|
206
|
+
return {
|
|
207
|
+
data: {},
|
|
208
|
+
parseError: parseError1
|
|
209
|
+
};
|
|
210
|
+
}
|
|
211
|
+
if (data === null || data === undefined) return {
|
|
212
|
+
data: {},
|
|
213
|
+
parseError: null
|
|
214
|
+
};
|
|
215
|
+
if ((typeof data === "undefined" ? "undefined" : _type_of(data)) !== 'object' || Array.isArray(data)) {
|
|
216
|
+
var parseError2 = 'frontmatter is not a key-value mapping';
|
|
217
|
+
warnings.push("warning: ".concat(relPath, " ").concat(parseError2, "; none of it is indexed"));
|
|
218
|
+
return {
|
|
219
|
+
data: {},
|
|
220
|
+
parseError: parseError2
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
warnStringifiedKeys(relPath, doc, warnings);
|
|
224
|
+
return {
|
|
225
|
+
data: data,
|
|
226
|
+
parseError: null
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/scan/frontmatter.ts"],"sourcesContent":["import { isCollection, parseDocument, visit } from 'yaml';\n\n// Frontmatter keys that would collide with table columns. Exported so db.ts's upsert can tell\n// a feature-owned column (`_rank`) from a parsed one and leave it alone on reparse.\nexport const RESERVED_COLUMNS = new Set(['path', '_mtime', '_ctime', '_size', '_rank', '_parse_error', 'content', 'links', 'sections']);\n\n// YAML error codes whose recovery is unambiguous, so the parse is accepted rather than\n// quarantined. Only one qualifies: YAML 1.2 reserves `@` and `` ` `` at the start of a plain\n// scalar for future use, so they can never be valid and the text can only be what was typed\n// (`aliases: [@handle]` -> [\"@handle\"]). Every other code has a second reading -- an unquoted\n// `:` swallows the keys after it, an unquoted `[..](..)` drops the URL, a duplicate key picks\n// one value in silence -- so it writes values nobody wrote.\nconst ACCEPTED_YAML_CODES = new Set(['BAD_SCALAR_START']);\n\nexport function normalizeText(value: unknown): string {\n if (value === null || value === undefined) return '';\n return String(value).replace(/\\s+/g, ' ').trim();\n}\n\n// SQLite's datetime() rejects a colonless offset (`-0800`) and a space separator, which ISO 8601\n// allows and producers emit. A rejected date is invisible, not excluded: every comparison is NULL.\nconst ISO_DATETIME = /^(\\d{4}-\\d{2}-\\d{2})[T ](\\d{2}:\\d{2}(?::\\d{2})?(?:\\.\\d+)?)(Z|[+-]\\d{2}(?::?\\d{2})?)?$/;\n\n// A value opening `YYYY-MM-DDT` was meant to be a datetime; prose never is. Reported when it\n// cannot be normalized, so a typo surfaces on the next crawl instead of at some later audit.\nconst MEANT_AS_DATETIME = /^\\d{4}-\\d{2}-\\d{2}[T ]\\d/;\n\nexport function looksLikeDatetime(value: string): boolean {\n return MEANT_AS_DATETIME.test(value);\n}\n\n// Punctuation only, never a timezone conversion: the offset survives, so substr(d,1,10) is still\n// the local date. A shape that is not a real instant is left as written, and stays auditable.\nexport function normalizeDate(value: string): string {\n const m = ISO_DATETIME.exec(value);\n if (m === null) return value;\n const [, date, time, zone] = m;\n const digits = zone === undefined || zone === 'Z' ? '' : zone.replace(':', '');\n const offset = digits === '' ? (zone ?? '') : digits.length === 3 ? `${digits}:00` : `${digits.slice(0, 3)}:${digits.slice(3)}`;\n const normalized = `${date}T${time}${offset}`;\n return Number.isNaN(Date.parse(normalized)) ? value : normalized;\n}\n\n// Storage class follows the YAML scalar. Booleans store as 1/0, so `WHERE flag = 1` matches\n// and `WHERE flag = 'true'` cannot; `map` prints observed types so the mismatch is visible.\nexport function mapValue(value: unknown): string | number | bigint | null {\n if (value === null || value === undefined) return null;\n if (typeof value === 'boolean') return BigInt(value ? 1 : 0);\n if (typeof value === 'number') return Number.isSafeInteger(value) ? BigInt(value) : value;\n if (typeof value === 'string') return normalizeDate(value);\n return JSON.stringify(value);\n}\n\n// The delimiter split is all this package used gray-matter for.\nexport function splitFrontmatter(raw: string): { fm: string | null; body: string } {\n const open = raw.match(/^---\\r?\\n/);\n if (!open) return { fm: null, body: raw };\n const rest = raw.slice(open[0].length);\n const close = rest.match(/^---\\r?(\\n|$)/m);\n if (!close || close.index === undefined) return { fm: null, body: raw };\n return { fm: rest.slice(0, close.index), body: rest.slice(close.index + close[0].length) };\n}\n\n// A well-formed document can still hold a value nobody meant: `created: {{date}}` is valid\n// YAML for a flow map used as a mapping key, so it raises no error and stores\n// {\"{ date }\": null}. No error code can catch that, but yaml notices the stringified key, so\n// this reports it with the path instead (yaml's own warning has none, fires once per document,\n// and is what trains readers to discard stderr).\nfunction warnStringifiedKeys(relPath: string, doc: ReturnType<typeof parseDocument>, warnings: string[]): void {\n let found = false;\n // Nested, not top level: `created: {{date}}` puts the collection key one level down, inside\n // the flow map that `{{...}}` parses as.\n visit(doc, {\n Pair(_key, pair) {\n if (!isCollection(pair.key)) return undefined;\n found = true;\n return visit.BREAK;\n },\n });\n // One per file: a template repeats the same mistake on every field it stamps.\n if (found) warnings.push(`warning: ${relPath} frontmatter has a key that is itself a list or mapping, stored as text; this is usually an unrendered template placeholder like {{date}}`);\n}\n\n// Accept a clean parse, and one whose every error is unambiguous (ACCEPTED_YAML_CODES).\n// Anything else is quarantined: no frontmatter columns at all, and `_parse_error` carries the\n// reason. Recovering it would write values nobody wrote, which is worse than absence because\n// no query can see it. The file is still indexed -- content, links and sections never touch\n// frontmatter -- so a broken note stays searchable while it is being hunted for.\n// yaml's message continues onto a source excerpt, so the first line is the sentence -- minus\n// the colon that introduced the part being dropped.\nfunction firstLine(message: string): string {\n return message.split('\\n')[0].replace(/:\\s*$/, '');\n}\n\nexport function parseFrontmatter(relPath: string, fm: string, warnings: string[]): { data: Record<string, unknown>; parseError: string | null } {\n // logLevel silences yaml's own pathless warnings; warnStringifiedKeys re-reports the one\n // that carries information, with the file it came from.\n const doc = parseDocument(fm, { logLevel: 'silent' });\n const refused = doc.errors.filter((err) => !ACCEPTED_YAML_CODES.has(err.code));\n if (refused.length > 0) {\n const detail = refused.length > 1 ? ` (and ${refused.length - 1} more)` : '';\n const parseError = `${firstLine(refused[0].message)}${detail}`;\n warnings.push(`warning: ${relPath} frontmatter did not parse, so none of it is indexed: ${parseError}`);\n return { data: {}, parseError };\n }\n\n let data: unknown;\n try {\n data = doc.toJS();\n } catch (err) {\n // Reaches here with doc.errors empty: `title: **Bold**` parses, then opens an alias on\n // materialisation. An empty error list is not a successful parse.\n const parseError = firstLine((err as Error).message);\n warnings.push(`warning: ${relPath} frontmatter did not parse, so none of it is indexed: ${parseError}`);\n return { data: {}, parseError };\n }\n\n if (data === null || data === undefined) return { data: {}, parseError: null };\n if (typeof data !== 'object' || Array.isArray(data)) {\n const parseError = 'frontmatter is not a key-value mapping';\n warnings.push(`warning: ${relPath} ${parseError}; none of it is indexed`);\n return { data: {}, parseError };\n }\n warnStringifiedKeys(relPath, doc, warnings);\n return { data: data as Record<string, unknown>, parseError: null };\n}\n"],"names":["RESERVED_COLUMNS","looksLikeDatetime","mapValue","normalizeDate","normalizeText","parseFrontmatter","splitFrontmatter","Set","ACCEPTED_YAML_CODES","value","undefined","String","replace","trim","ISO_DATETIME","MEANT_AS_DATETIME","test","m","exec","date","time","zone","digits","offset","length","slice","normalized","Number","isNaN","Date","parse","BigInt","isSafeInteger","JSON","stringify","raw","open","match","fm","body","rest","close","index","warnStringifiedKeys","relPath","doc","warnings","found","visit","Pair","_key","pair","isCollection","key","BREAK","push","firstLine","message","split","parseDocument","logLevel","refused","errors","filter","err","has","code","detail","parseError","data","toJS","Array","isArray"],"mappings":";;;;;;;;;;;QAIaA;eAAAA;;QAuBGC;eAAAA;;QAkBAC;eAAAA;;QAZAC;eAAAA;;QAnBAC;eAAAA;;QAgFAC;eAAAA;;QAxCAC;eAAAA;;;oBAtDmC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAI5C,IAAMN,mBAAmB,IAAIO,IAAI;IAAC;IAAQ;IAAU;IAAU;IAAS;IAAS;IAAgB;IAAW;IAAS;CAAW;AAEtI,uFAAuF;AACvF,6FAA6F;AAC7F,4FAA4F;AAC5F,8FAA8F;AAC9F,8FAA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,MAAM,CAAC;YAAGD,YAAAA;QAAW;IAChC;IACAzB,oBAAoBC,SAASC,KAAKC;IAClC,OAAO;QAAEuB,MAAMA;QAAiCD,YAAY;IAAK;AACnE"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Config } from '../config/index.js';
|
|
2
|
+
import type { Feature } from '../features/types.js';
|
|
3
|
+
import type { FileStat } from './list.js';
|
|
4
|
+
export { looksLikeDatetime, normalizeDate, RESERVED_COLUMNS } from './frontmatter.js';
|
|
5
|
+
export type { FileStat } from './list.js';
|
|
6
|
+
export { listFiles, toPosixPath } from './list.js';
|
|
7
|
+
export interface ParsedDoc {
|
|
8
|
+
relPath: string;
|
|
9
|
+
mtimeMs: number;
|
|
10
|
+
ctimeMs: number;
|
|
11
|
+
size: number;
|
|
12
|
+
presets: string[];
|
|
13
|
+
data: Record<string, string | number | bigint | null>;
|
|
14
|
+
parseError: string | null;
|
|
15
|
+
search: {
|
|
16
|
+
title: string;
|
|
17
|
+
summary: string;
|
|
18
|
+
text: string;
|
|
19
|
+
};
|
|
20
|
+
extracted: Record<string, unknown>;
|
|
21
|
+
}
|
|
22
|
+
export declare function parseFile(file: FileStat, extractors?: Feature[], cfg?: Config): {
|
|
23
|
+
doc: ParsedDoc;
|
|
24
|
+
warnings: string[];
|
|
25
|
+
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { Config } from '../config/index.js';
|
|
2
|
+
import type { Feature } from '../features/types.js';
|
|
3
|
+
import type { FileStat } from './list.js';
|
|
4
|
+
export { looksLikeDatetime, normalizeDate, RESERVED_COLUMNS } from './frontmatter.js';
|
|
5
|
+
export type { FileStat } from './list.js';
|
|
6
|
+
export { listFiles, toPosixPath } from './list.js';
|
|
7
|
+
export interface ParsedDoc {
|
|
8
|
+
relPath: string;
|
|
9
|
+
mtimeMs: number;
|
|
10
|
+
ctimeMs: number;
|
|
11
|
+
size: number;
|
|
12
|
+
presets: string[];
|
|
13
|
+
data: Record<string, string | number | bigint | null>;
|
|
14
|
+
parseError: string | null;
|
|
15
|
+
search: {
|
|
16
|
+
title: string;
|
|
17
|
+
summary: string;
|
|
18
|
+
text: string;
|
|
19
|
+
};
|
|
20
|
+
extracted: Record<string, unknown>;
|
|
21
|
+
}
|
|
22
|
+
export declare function parseFile(file: FileStat, extractors?: Feature[], cfg?: Config): {
|
|
23
|
+
doc: ParsedDoc;
|
|
24
|
+
warnings: string[];
|
|
25
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
get RESERVED_COLUMNS () {
|
|
13
|
+
return _frontmatterts.RESERVED_COLUMNS;
|
|
14
|
+
},
|
|
15
|
+
get listFiles () {
|
|
16
|
+
return _listts.listFiles;
|
|
17
|
+
},
|
|
18
|
+
get looksLikeDatetime () {
|
|
19
|
+
return _frontmatterts.looksLikeDatetime;
|
|
20
|
+
},
|
|
21
|
+
get normalizeDate () {
|
|
22
|
+
return _frontmatterts.normalizeDate;
|
|
23
|
+
},
|
|
24
|
+
get parseFile () {
|
|
25
|
+
return parseFile;
|
|
26
|
+
},
|
|
27
|
+
get toPosixPath () {
|
|
28
|
+
return _listts.toPosixPath;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
var _nodefs = require("node:fs");
|
|
32
|
+
var _indexts = require("../chunk/index.js");
|
|
33
|
+
var _stripts = require("../text/strip.js");
|
|
34
|
+
var _frontmatterts = require("./frontmatter.js");
|
|
35
|
+
var _listts = require("./list.js");
|
|
36
|
+
function parseFile(file) {
|
|
37
|
+
var extractors = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [], cfg = arguments.length > 2 ? arguments[2] : void 0;
|
|
38
|
+
var raw = (0, _nodefs.readFileSync)(file.absPath, 'utf8');
|
|
39
|
+
var warnings = [];
|
|
40
|
+
var _splitFrontmatter = (0, _frontmatterts.splitFrontmatter)(raw), fm = _splitFrontmatter.fm, content = _splitFrontmatter.body;
|
|
41
|
+
var _ref = fm === null ? {
|
|
42
|
+
data: {},
|
|
43
|
+
parseError: null
|
|
44
|
+
} : (0, _frontmatterts.parseFrontmatter)(file.relPath, fm, warnings), data = _ref.data, parseError = _ref.parseError;
|
|
45
|
+
var mapped = {};
|
|
46
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = undefined;
|
|
47
|
+
try {
|
|
48
|
+
for(var _iterator = Object.keys(data)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
49
|
+
var key = _step.value;
|
|
50
|
+
if (_frontmatterts.RESERVED_COLUMNS.has(key)) {
|
|
51
|
+
warnings.push("warning: ".concat(file.relPath, ' has a frontmatter key named "').concat(key, '", which is reserved; ignoring it'));
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
var value = (0, _frontmatterts.mapValue)(data[key]);
|
|
55
|
+
if (typeof value === 'string' && (0, _frontmatterts.looksLikeDatetime)(value) && Number.isNaN(Date.parse(value))) {
|
|
56
|
+
warnings.push("warning: ".concat(file.relPath, ": ").concat(key, " is not a valid date (").concat(value, "), so it is invisible to every date comparison"));
|
|
57
|
+
}
|
|
58
|
+
mapped[key] = value;
|
|
59
|
+
}
|
|
60
|
+
} catch (err) {
|
|
61
|
+
_didIteratorError = true;
|
|
62
|
+
_iteratorError = err;
|
|
63
|
+
} finally{
|
|
64
|
+
try {
|
|
65
|
+
if (!_iteratorNormalCompletion && _iterator.return != null) {
|
|
66
|
+
_iterator.return();
|
|
67
|
+
}
|
|
68
|
+
} finally{
|
|
69
|
+
if (_didIteratorError) {
|
|
70
|
+
throw _iteratorError;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
// Parsed once and shared: the FTS text path (textFromBlocks, ~ strip.ts) and any feature
|
|
75
|
+
// that needs a parse tree (embed's chunker) both read this same block list.
|
|
76
|
+
var blocks = (0, _indexts.parse)(content);
|
|
77
|
+
// title/summary are plain YAML strings -- whitespace-collapse only;
|
|
78
|
+
// the prose gets the full markdown strip.
|
|
79
|
+
var search = {
|
|
80
|
+
title: (0, _frontmatterts.normalizeText)(data.title),
|
|
81
|
+
summary: (0, _frontmatterts.normalizeText)(data.summary),
|
|
82
|
+
text: (0, _stripts.textFromBlocks)(blocks)
|
|
83
|
+
};
|
|
84
|
+
return {
|
|
85
|
+
doc: {
|
|
86
|
+
relPath: file.relPath,
|
|
87
|
+
mtimeMs: file.mtimeMs,
|
|
88
|
+
ctimeMs: file.ctimeMs,
|
|
89
|
+
size: file.size,
|
|
90
|
+
presets: file.presets,
|
|
91
|
+
data: mapped,
|
|
92
|
+
parseError: parseError,
|
|
93
|
+
search: search,
|
|
94
|
+
extracted: Object.fromEntries(extractors.filter(function(f) {
|
|
95
|
+
return f.extract;
|
|
96
|
+
}).map(function(f) {
|
|
97
|
+
var _f_extract;
|
|
98
|
+
return [
|
|
99
|
+
f.name,
|
|
100
|
+
(_f_extract = f.extract) === null || _f_extract === void 0 ? void 0 : _f_extract.call(f, raw, content, search, data, cfg, blocks)
|
|
101
|
+
];
|
|
102
|
+
}))
|
|
103
|
+
},
|
|
104
|
+
warnings: warnings
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/scan/index.ts"],"sourcesContent":["import { readFileSync } from 'node:fs';\nimport { parse } from '../chunk/index.ts';\nimport type { Config } from '../config/index.ts';\nimport type { Feature } from '../features/types.ts';\nimport { textFromBlocks } from '../text/strip.ts';\nimport { looksLikeDatetime, mapValue, normalizeText, parseFrontmatter, RESERVED_COLUMNS, splitFrontmatter } from './frontmatter.ts';\nimport type { FileStat } from './list.ts';\n\n// Filesystem -> rows. Pure data in, data + warnings out; db.ts does the SQL.\n\nexport { looksLikeDatetime, normalizeDate, RESERVED_COLUMNS } from './frontmatter.ts';\nexport type { FileStat } from './list.ts';\nexport { listFiles, toPosixPath } from './list.ts';\n\nexport interface ParsedDoc {\n relPath: string;\n mtimeMs: number;\n ctimeMs: number;\n size: number;\n presets: string[];\n data: Record<string, string | number | bigint | null>;\n // NULL when the frontmatter parsed, the first YAML message otherwise. In the row rather than\n // a side table so `SELECT *` and any `IS NULL` investigation trip over it without being asked.\n parseError: string | null;\n // title/summary are duplicated from frontmatter so bm25() can weight them above the body text.\n search: { title: string; summary: string; text: string };\n // Per-feature extraction results, keyed by feature name; features store them at reconcile.\n extracted: Record<string, unknown>;\n}\n\nexport function parseFile(file: FileStat, extractors: Feature[] = [], cfg?: Config): { doc: ParsedDoc; warnings: string[] } {\n const raw = readFileSync(file.absPath, 'utf8');\n const warnings: string[] = [];\n\n const { fm, body: content } = splitFrontmatter(raw);\n const { data, parseError } = fm === null ? { data: {} as Record<string, unknown>, parseError: null } : parseFrontmatter(file.relPath, fm, warnings);\n const mapped: Record<string, string | number | bigint | null> = {};\n\n for (const key of Object.keys(data)) {\n if (RESERVED_COLUMNS.has(key)) {\n warnings.push(`warning: ${file.relPath} has a frontmatter key named \"${key}\", which is reserved; ignoring it`);\n continue;\n }\n const value = mapValue(data[key]);\n if (typeof value === 'string' && looksLikeDatetime(value) && Number.isNaN(Date.parse(value))) {\n warnings.push(`warning: ${file.relPath}: ${key} is not a valid date (${value}), so it is invisible to every date comparison`);\n }\n mapped[key] = value;\n }\n\n // Parsed once and shared: the FTS text path (textFromBlocks, ~ strip.ts) and any feature\n // that needs a parse tree (embed's chunker) both read this same block list.\n const blocks = parse(content);\n\n // title/summary are plain YAML strings -- whitespace-collapse only;\n // the prose gets the full markdown strip.\n const search = { title: normalizeText(data.title), summary: normalizeText(data.summary), text: textFromBlocks(blocks) };\n\n return {\n doc: {\n relPath: file.relPath,\n mtimeMs: file.mtimeMs,\n ctimeMs: file.ctimeMs,\n size: file.size,\n presets: file.presets,\n data: mapped,\n parseError,\n search,\n extracted: Object.fromEntries(extractors.filter((f) => f.extract).map((f) => [f.name, f.extract?.(raw, content, search, data, cfg, blocks)])),\n },\n warnings,\n };\n}\n"],"names":["RESERVED_COLUMNS","listFiles","looksLikeDatetime","normalizeDate","parseFile","toPosixPath","file","extractors","cfg","raw","readFileSync","absPath","warnings","splitFrontmatter","fm","body","content","data","parseError","parseFrontmatter","relPath","mapped","Object","keys","key","has","push","value","mapValue","Number","isNaN","Date","parse","blocks","search","title","normalizeText","summary","text","textFromBlocks","doc","mtimeMs","ctimeMs","size","presets","extracted","fromEntries","filter","f","extract","map","name"],"mappings":";;;;;;;;;;;QAU2CA;eAAAA,+BAAgB;;QAElDC;eAAAA,iBAAS;;QAFTC;eAAAA,gCAAiB;;QAAEC;eAAAA,4BAAa;;QAoBzBC;eAAAA;;QAlBIC;eAAAA,mBAAW;;;sBAZF;uBACP;uBAGS;6BACkF;sBAO1E;AAkBhC,SAASD,UAAUE,IAAc;QAAEC,aAAAA,iEAAwB,EAAE,EAAEC;IACpE,IAAMC,MAAMC,IAAAA,oBAAY,EAACJ,KAAKK,OAAO,EAAE;IACvC,IAAMC,WAAqB,EAAE;IAE7B,IAA8BC,oBAAAA,IAAAA,+BAAgB,EAACJ,MAAvCK,KAAsBD,kBAAtBC,IAAIC,AAAMC,UAAYH,kBAAlBE;IACZ,IAA6BD,OAAAA,OAAO,OAAO;QAAEG,MAAM,CAAC;QAA8BC,YAAY;IAAK,IAAIC,IAAAA,+BAAgB,EAACb,KAAKc,OAAO,EAAEN,IA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AOwB,WAAW,CAACvC,WAAWwC,MAAM,CAAC,SAACC;uBAAMA,EAAEC,OAAO;eAAEC,GAAG,CAAC,SAACF;oBAAeA;uBAAT;oBAACA,EAAEG,IAAI;qBAAEH,aAAAA,EAAEC,OAAO,cAATD,iCAAAA,gBAAAA,GAAYvC,KAAKO,SAASkB,QAAQjB,MAAMT,KAAKyB;iBAAQ;;QAC7I;QACArB,UAAAA;IACF;AACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Config } from '../config/index.js';
|
|
2
|
+
export interface FileStat {
|
|
3
|
+
relPath: string;
|
|
4
|
+
absPath: string;
|
|
5
|
+
mtimeMs: number;
|
|
6
|
+
ctimeMs: number;
|
|
7
|
+
size: number;
|
|
8
|
+
presets: string[];
|
|
9
|
+
embed: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function toPosixPath(relPath: string, separator?: string): string;
|
|
12
|
+
export declare function listFiles(cfg: Config, baseDir: string): FileStat[];
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Config } from '../config/index.js';
|
|
2
|
+
export interface FileStat {
|
|
3
|
+
relPath: string;
|
|
4
|
+
absPath: string;
|
|
5
|
+
mtimeMs: number;
|
|
6
|
+
ctimeMs: number;
|
|
7
|
+
size: number;
|
|
8
|
+
presets: string[];
|
|
9
|
+
embed: boolean;
|
|
10
|
+
}
|
|
11
|
+
export declare function toPosixPath(relPath: string, separator?: string): string;
|
|
12
|
+
export declare function listFiles(cfg: Config, baseDir: string): FileStat[];
|