@neuledge/context 1.4.0 → 1.4.1

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 CHANGED
@@ -310,44 +310,13 @@ replacement leaves the previous package available. Temporary files are excluded
310
310
  from package discovery. If the operating system blocks replacement of an open
311
311
  file (for example, on Windows), close the reader and retry the install.
312
312
 
313
- Builds print an ingestion summary: discovered documentation files, selected files,
314
- indexed documents and sections, plus exclusions, duplicates, read/parse failures,
315
- and empty documents. To inspect paths and reasons, write a JSON report:
316
-
317
- ```bash
318
- context add ./my-project --diagnostics ingestion.json
319
- context add ./my-project --strict --diagnostics ingestion.json
320
- ```
321
-
322
- `--strict` rejects unreadable files/directories, failed linked-page downloads,
323
- parser failures, and documents
324
- that produce no sections before changing the installed package. Intentional
325
- exclusions and duplicate content remain acceptable. The JSON report is also
326
- written when strict validation fails. These options apply to documentation
327
- builds, not installation of prebuilt `.db` files.
328
-
329
- Report parent directories are created automatically. Successful builds save the
330
- requested report before replacing the installed package; a report-write failure
331
- leaves the installed package unchanged. If reporting also fails after a build
332
- error, the CLI preserves the original error and reports both failures.
333
-
334
- The report has `schemaVersion`, `summary`, and per-path `entries`. Discovered
335
- files are documentation candidates actually visited within the selected source;
336
- selected files exclude intentional exclusions and duplicates. Indexed sections
337
- count only sections stored after deduplication. Pruned directories appear once
338
- with their exclusion reason; their contents are not scanned or counted. Hidden
339
- and tooling directories and unrelated source-code files are omitted. Git/local
340
- paths are relative to the repository root, including an explicit docs path.
341
-
342
- `buildPackage` always returns a report as `BuildResult.diagnostics`. The property
343
- is optional in the public type so existing result objects and builder mocks
344
- remain compatible. The existing `skippedFiles` field still counts only split/parse
345
- failures. To include source
346
- selection and read outcomes, pass the same `IngestionDiagnostic[]` to
347
- `readLocalDocsFiles(..., { diagnostics })` and
348
- `buildPackage(..., { name, version, diagnostics, strict })`. Strict failures throw
349
- `IngestionError`, whose `diagnostics` property contains the report. Library code
350
- does not log diagnostics.
313
+ Builds print a one-line ingestion summary (discovered, selected, and indexed
314
+ documents and sections), listing only the problem kinds that actually occurred —
315
+ exclusions, duplicates, unreadable files/directories, parse failures, and empty
316
+ documents. Use `--diagnostics ingestion.json` for a per-path JSON report and
317
+ `--strict` to reject read/parse errors and empty documents before installing.
318
+ See the [ingestion reporting guide](docs/ingestion-report.md) for the report
319
+ schema, strict-failure behavior, and library use.
351
320
 
352
321
  ---
353
322
 
package/dist/index.d.ts CHANGED
@@ -4,8 +4,7 @@ export { type DatabaseConnection, initDatabase, openDatabase, type Statement, }
4
4
  export { downloadPackage, type SearchResultEntry, searchPackages, } from "./download.js";
5
5
  export { cloneRepository, detectLocalDocsFolder, extractRepoName, extractVersion, type GitCloneResult, isGitUrl, isMissingRefError, type LocalDocsResult, parseGitUrl, readLocalDocsFiles, } from "./git.js";
6
6
  export { parseHtml } from "./html.js";
7
- export { createIngestionReport, formatIngestionSummary, type IngestionDiagnostic, IngestionError, type IngestionReport, ingestionErrorReason, validateIngestion, } from "./ingestion.js";
8
- export { writeIngestionReport } from "./ingestion-report.js";
7
+ export { type IngestionDiagnostic, IngestionError, type IngestionReport, } from "./ingestion.js";
9
8
  export { type BuildResult, buildPackage, type MarkdownFile, type PackageBuildOptions, } from "./package-builder.js";
10
9
  export type { DocSnippet, SearchResult } from "./search.js";
11
10
  export { ContextServer } from "./server.js";
package/dist/index.js CHANGED
@@ -10,8 +10,7 @@ export { downloadPackage, searchPackages, } from "./download.js";
10
10
  // Git utilities
11
11
  export { cloneRepository, detectLocalDocsFolder, extractRepoName, extractVersion, isGitUrl, isMissingRefError, parseGitUrl, readLocalDocsFiles, } from "./git.js";
12
12
  export { parseHtml } from "./html.js";
13
- export { createIngestionReport, formatIngestionSummary, IngestionError, ingestionErrorReason, validateIngestion, } from "./ingestion.js";
14
- export { writeIngestionReport } from "./ingestion-report.js";
13
+ export { IngestionError, } from "./ingestion.js";
15
14
  export { buildPackage, } from "./package-builder.js";
16
15
  export { ContextServer } from "./server.js";
17
16
  export { PackageStore, readPackageInfo, } from "./store.js";
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,aAAa;AAEb,kBAAkB;AAClB,OAAO,EAGL,aAAa,EACb,aAAa,EACb,aAAa,EACb,qBAAqB,GACtB,MAAM,YAAY,CAAC;AACpB,SAAS;AACT,OAAO,EAEL,mBAAmB,EACnB,YAAY,EACZ,UAAU,EAEV,UAAU,GACX,MAAM,aAAa,CAAC;AACrB,WAAW;AACX,OAAO,EAEL,YAAY,EACZ,YAAY,GAEb,MAAM,eAAe,CAAC;AACvB,WAAW;AACX,OAAO,EACL,eAAe,EAEf,cAAc,GACf,MAAM,eAAe,CAAC;AACvB,gBAAgB;AAChB,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,cAAc,EAEd,QAAQ,EACR,iBAAiB,EAEjB,WAAW,EACX,kBAAkB,GACnB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EACL,qBAAqB,EACrB,sBAAsB,EAEtB,cAAc,EAEd,oBAAoB,EACpB,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,oBAAoB,EAAE,MAAM,uBAAuB,CAAC;AAC7D,OAAO,EAEL,YAAY,GAGb,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAGL,YAAY,EACZ,eAAe,GAChB,MAAM,YAAY,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,aAAa;AAEb,kBAAkB;AAClB,OAAO,EAGL,aAAa,EACb,aAAa,EACb,aAAa,EACb,qBAAqB,GACtB,MAAM,YAAY,CAAC;AACpB,SAAS;AACT,OAAO,EAEL,mBAAmB,EACnB,YAAY,EACZ,UAAU,EAEV,UAAU,GACX,MAAM,aAAa,CAAC;AACrB,WAAW;AACX,OAAO,EAEL,YAAY,EACZ,YAAY,GAEb,MAAM,eAAe,CAAC;AACvB,WAAW;AACX,OAAO,EACL,eAAe,EAEf,cAAc,GACf,MAAM,eAAe,CAAC;AACvB,gBAAgB;AAChB,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,cAAc,EAEd,QAAQ,EACR,iBAAiB,EAEjB,WAAW,EACX,kBAAkB,GACnB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAEL,cAAc,GAEf,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAEL,YAAY,GAGb,MAAM,sBAAsB,CAAC;AAG9B,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,EAGL,YAAY,EACZ,eAAe,GAChB,MAAM,YAAY,CAAC"}
package/dist/ingestion.js CHANGED
@@ -63,7 +63,24 @@ export function ingestionErrorReason(error) {
63
63
  export function formatIngestionSummary(report) {
64
64
  const s = report.summary;
65
65
  const count = (value, singular, plural = `${singular}s`) => `${value} ${value === 1 ? singular : plural}`;
66
- return `Ingestion: ${count(s.discoveredFiles, "documentation file")} discovered, ${s.selectedFiles} selected, ${s.indexedDocuments} indexed, ${count(s.indexedSections, "section")}; excluded ${count(s.excludedFiles, "file")}/${count(s.excludedDirectories, "directory", "directories")}, ${count(s.duplicateFiles, "duplicate")}, unreadable ${count(s.unreadableFiles, "file")}/${count(s.unreadableDirectories, "directory", "directories")}, ${count(s.parseFailures, "parse failure")}, ${count(s.emptyFiles, "empty file")}`;
66
+ const base = `Ingestion: ${count(s.discoveredFiles, "documentation file")} discovered, ${s.selectedFiles} selected, ${s.indexedDocuments} indexed, ${count(s.indexedSections, "section")}`;
67
+ const problems = [];
68
+ if (s.excludedFiles + s.excludedDirectories > 0) {
69
+ problems.push(`excluded ${count(s.excludedFiles, "file")}/${count(s.excludedDirectories, "directory", "directories")}`);
70
+ }
71
+ if (s.duplicateFiles > 0) {
72
+ problems.push(`${count(s.duplicateFiles, "duplicate")}`);
73
+ }
74
+ if (s.unreadableFiles + s.unreadableDirectories > 0) {
75
+ problems.push(`unreadable ${count(s.unreadableFiles, "file")}/${count(s.unreadableDirectories, "directory", "directories")}`);
76
+ }
77
+ if (s.parseFailures > 0) {
78
+ problems.push(`${count(s.parseFailures, "parse failure")}`);
79
+ }
80
+ if (s.emptyFiles > 0) {
81
+ problems.push(`${count(s.emptyFiles, "empty file")}`);
82
+ }
83
+ return problems.length > 0 ? `${base}; ${problems.join(", ")}` : base;
67
84
  }
68
85
  export class IngestionError extends Error {
69
86
  diagnostics;
@@ -1 +1 @@
1
- {"version":3,"file":"ingestion.js","sourceRoot":"","sources":["../src/ingestion.ts"],"names":[],"mappings":"AAqCA,MAAM,UAAU,qBAAqB,CACnC,WAA2C;IAE3C,MAAM,OAAO,GAA+B;QAC1C,eAAe,EAAE,CAAC;QAClB,aAAa,EAAE,CAAC;QAChB,gBAAgB,EAAE,CAAC;QACnB,eAAe,EAAE,CAAC;QAClB,aAAa,EAAE,CAAC;QAChB,mBAAmB,EAAE,CAAC;QACtB,cAAc,EAAE,CAAC;QACjB,eAAe,EAAE,CAAC;QAClB,qBAAqB,EAAE,CAAC;QACxB,aAAa,EAAE,CAAC;QAChB,UAAU,EAAE,CAAC;KACd,CAAC;IACF,KAAK,MAAM,KAAK,IAAI,WAAW,EAAE,CAAC;QAChC,IAAI,KAAK,CAAC,IAAI,KAAK,WAAW,EAAE,CAAC;YAC/B,IAAI,KAAK,CAAC,OAAO,KAAK,UAAU;gBAAE,OAAO,CAAC,mBAAmB,EAAE,CAAC;YAChE,IAAI,KAAK,CAAC,OAAO,KAAK,YAAY;gBAAE,OAAO,CAAC,qBAAqB,EAAE,CAAC;YACpE,SAAS;QACX,CAAC;QACD,OAAO,CAAC,eAAe,EAAE,CAAC;QAC1B,IAAI,KAAK,CAAC,OAAO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documents what it discovered, selected, indexed, excluded, and
4
+ dropped while building a documentation package. This page covers the CLI summary,
5
+ the `--diagnostics` JSON report, strict validation, the report schema, and library
6
+ use. Registry builds publish the same report vocabulary; see the end of this page.
7
+
8
+ ## CLI summary
9
+
10
+ Builds print a one-line ingestion summary listing discovered documentation files,
11
+ selected files, indexed documents and sections, followed only by the problem kinds
12
+ that actually occurred: exclusions, duplicates, unreadable files/directories,
13
+ parse failures, and empty documents. A clean build prints just the
14
+ discovery/selection/indexing counts, with no problem list.
15
+
16
+ ## JSON report
17
+
18
+ To inspect paths and reasons, write a JSON report:
19
+
20
+ ```bash
21
+ context add ./my-project --diagnostics ingestion.json
22
+ context add ./my-project --strict --diagnostics ingestion.json
23
+ ```
24
+
25
+ Report parent directories are created automatically. Successful builds save the
26
+ requested report before replacing the installed package; a report-write failure
27
+ leaves the installed package unchanged. If reporting also fails after a build
28
+ error, the CLI preserves the original error and reports both failures.
29
+
30
+ ## Strict builds
31
+
32
+ `--strict` rejects unreadable files/directories, failed linked-page downloads,
33
+ parser failures, and documents that produce no sections before changing the
34
+ installed package. Intentional exclusions and duplicate content remain
35
+ acceptable. The JSON report is also written when strict validation fails. These
36
+ options apply to documentation builds, not installation of prebuilt `.db` files.
37
+
38
+ ## Report schema
39
+
40
+ The report has `schemaVersion`, `summary`, and per-path `entries`. Discovered
41
+ files are documentation candidates actually visited within the selected source;
42
+ selected files exclude intentional exclusions and duplicates. Indexed sections
43
+ count only sections stored after deduplication. Pruned directories appear once
44
+ with their exclusion reason; their contents are not scanned or counted. Hidden
45
+ and tooling directories and unrelated source-code files are omitted. Git/local
46
+ paths are relative to the repository root, including an explicit docs path.
47
+
48
+ Entries use the shared vocabulary `excluded`, `duplicate`, `read-error`,
49
+ `parse-error`, `empty`, and `indexed`. Entries name relative paths and give
50
+ reasons; duplicate documents identify the retained path when available. Directory
51
+ exclusions are reported without walking their descendants.
52
+
53
+ ## Library use
54
+
55
+ `buildPackage` always returns a report as `BuildResult.diagnostics`. The property
56
+ is optional in the public type so existing result objects and builder mocks
57
+ remain compatible. The existing `skippedFiles` field still counts only
58
+ split/parse failures. To include source selection and read outcomes, pass the
59
+ same `IngestionDiagnostic[]` to `readLocalDocsFiles(..., { diagnostics })` and
60
+ `buildPackage(..., { name, version, diagnostics, strict })`. Strict failures throw
61
+ `IngestionError`, whose `diagnostics` property contains the report. Library code
62
+ does not log diagnostics.
63
+
64
+ ## Registry builds
65
+
66
+ `registry build` uses the same report vocabulary through the registry publisher.
67
+ Git, ZIP, and HTML-index sources share the report vocabulary; Git paths are
68
+ relative to the checkout, ZIP paths to `docs_path`, and HTML paths to the pinned
69
+ index directory. Summary counts cover the selected source scope, not files
70
+ outside `docs_path` or links outside the pinned HTML directory. Failed source
71
+ downloads still abort the build; failure reports may contain only outcomes
72
+ collected before the abort.
73
+
74
+ `--strict` fails on read errors, parse errors, and documents producing no
75
+ sections. It does not reject exclusions or duplicates, and validation failures
76
+ leave any existing output package unchanged. The report is written on strict
77
+ failure too. A requested report is saved before replacing the output package, so
78
+ a report-write failure leaves the existing package unchanged. Reporting failures
79
+ do not mask an earlier build error. The default remains a tolerant build with
80
+ visible diagnostics. For library use, `buildFromDefinition` and `buildUnversioned`
81
+ accept an optional final `{ strict, diagnostics }` argument and return
82
+ `diagnostics` with the build result.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neuledge/context",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "mcpName": "io.github.neuledge/context",
5
5
  "description": "Context management for Neuledge packages",
6
6
  "keywords": [],
@@ -23,6 +23,7 @@
23
23
  },
24
24
  "files": [
25
25
  "dist/",
26
+ "docs/",
26
27
  "package.json",
27
28
  "README.md",
28
29
  "LICENSE"