@xh/hoist-docs 0.0.0-stage → 0.0.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.
Files changed (62) hide show
  1. package/LICENSE.md +190 -0
  2. package/README.md +145 -2
  3. package/bin/hoist-docs.mjs +16 -0
  4. package/dist/IndexStore.d.ts +78 -0
  5. package/dist/IndexStore.js +249 -0
  6. package/dist/cli.d.ts +11 -0
  7. package/dist/cli.js +258 -0
  8. package/dist/config.d.ts +17 -0
  9. package/dist/config.js +18 -0
  10. package/dist/docs/index.d.ts +70 -0
  11. package/dist/docs/index.js +101 -0
  12. package/dist/index/DocEntry.d.ts +16 -0
  13. package/dist/index/DocEntry.js +32 -0
  14. package/dist/index/DocIdResolver.d.ts +31 -0
  15. package/dist/index/DocIdResolver.js +159 -0
  16. package/dist/index/DocSearch.d.ts +41 -0
  17. package/dist/index/DocSearch.js +180 -0
  18. package/dist/index/LibraryIndex.d.ts +62 -0
  19. package/dist/index/LibraryIndex.js +153 -0
  20. package/dist/index/SymbolSearch.d.ts +52 -0
  21. package/dist/index/SymbolSearch.js +249 -0
  22. package/dist/index/doc-sections.d.ts +94 -0
  23. package/dist/index/doc-sections.js +260 -0
  24. package/dist/index/search-text.d.ts +78 -0
  25. package/dist/index/search-text.js +140 -0
  26. package/dist/index/types.d.ts +115 -0
  27. package/dist/index/types.js +11 -0
  28. package/dist/libraries.d.ts +57 -0
  29. package/dist/libraries.js +38 -0
  30. package/dist/local/cache.d.ts +25 -0
  31. package/dist/local/cache.js +62 -0
  32. package/dist/local/checkout.d.ts +6 -0
  33. package/dist/local/checkout.js +178 -0
  34. package/dist/local/installed.d.ts +22 -0
  35. package/dist/local/installed.js +99 -0
  36. package/dist/local/maven.d.ts +49 -0
  37. package/dist/local/maven.js +184 -0
  38. package/dist/local/npm.d.ts +24 -0
  39. package/dist/local/npm.js +66 -0
  40. package/dist/local/project.d.ts +26 -0
  41. package/dist/local/project.js +103 -0
  42. package/dist/local/registry.d.ts +15 -0
  43. package/dist/local/registry.js +67 -0
  44. package/dist/local/sources.d.ts +30 -0
  45. package/dist/local/sources.js +50 -0
  46. package/dist/local/tar.d.ts +6 -0
  47. package/dist/local/tar.js +31 -0
  48. package/dist/log.d.ts +10 -0
  49. package/dist/log.js +31 -0
  50. package/dist/mcp.d.ts +23 -0
  51. package/dist/mcp.js +396 -0
  52. package/dist/server.d.ts +15 -0
  53. package/dist/server.js +88 -0
  54. package/dist/tools/DocTools.d.ts +19 -0
  55. package/dist/tools/DocTools.js +245 -0
  56. package/dist/tools/SymbolTools.d.ts +27 -0
  57. package/dist/tools/SymbolTools.js +572 -0
  58. package/dist/tools/types.d.ts +6 -0
  59. package/dist/tools/types.js +7 -0
  60. package/dist/usage.d.ts +10 -0
  61. package/dist/usage.js +11 -0
  62. package/package.json +62 -4
package/LICENSE.md ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2014-2025 Extremely Heavy Industries, Inc.
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,146 @@
1
- # Temporary Holding Version
1
+ # Hoist Docs
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ Hoist framework documentation and API reference for AI coding agents, over MCP. One tool serves
4
+ hoist-react, hoist-core and hoist-chat-kit, replacing the stdio MCP servers those libraries used to bundle, with
5
+ the same tools: `hoist-search-docs`, `hoist-list-docs`, `hoist-read-doc`, `hoist-search-symbols`,
6
+ `hoist-get-symbol`, `hoist-get-members`, `hoist-ping`. Built on the MCP TypeScript SDK v2
7
+ (`@modelcontextprotocol/server`): the 2026-07-28 MCP spec, and the 2025 handshake older clients
8
+ use.
9
+
10
+ This repo also holds the builders that make the index files the tool reads. Each library runs
11
+ the builder in its own publish job and ships its index the way it ships itself: inside its npm
12
+ package for hoist-react and the other TypeScript libraries, and as a `docs-index` Maven artifact
13
+ beside the jar for hoist-core. XH's libraries are listed in [`src/libraries.ts`](src/libraries.ts).
14
+ See [`docs/design.md`](docs/design.md) for the design and
15
+ [`docs/index-schema.md`](docs/index-schema.md) for the index format.
16
+
17
+ ## In a Hoist app
18
+
19
+ Add the tool as a dev dependency of the app's client:
20
+
21
+ ```bash
22
+ cd client-app && pnpm add -D @xh/hoist-docs
23
+ ```
24
+
25
+ and point the agent at it in `.mcp.json`, at the project root:
26
+
27
+ ```json
28
+ {
29
+ "mcpServers": {
30
+ "hoist": {"command": "node", "args": ["client-app/node_modules/@xh/hoist-docs/bin/hoist-docs.mjs"]}
31
+ }
32
+ }
33
+ ```
34
+
35
+ The agent launches it over stdio. On start it:
36
+
37
+ - reads the index inside each installed package that declares one (`hoistDocs` in its
38
+ `package.json`): `@xh/hoist`, `@xh/hoist-chat-kit` if the app uses it, and any other library
39
+ that ships an index;
40
+ - fetches hoist-core's index for `hoistCoreVersion` in `gradle.properties` from Maven - Maven
41
+ Central for releases, Sonatype's snapshot repository for snapshots, or an organization's mirror
42
+ (`HOIST_DOCS_MAVEN_REPO`, `HOIST_DOCS_MAVEN_SNAPSHOT_REPO`, with `HOIST_DOCS_MAVEN_USER` and
43
+ `HOIST_DOCS_MAVEN_PASSWORD` if needed) - and caches it in
44
+ `~/.cache/hoist-docs`;
45
+ - serves them.
46
+
47
+ Every index is exactly the installed build, snapshots included. After a Hoist upgrade, restart the
48
+ agent.
49
+
50
+ To try it without adding a dependency: `npx @xh/hoist-docs` from the project root.
51
+
52
+ ## Behind an MCP gateway
53
+
54
+ `hoist-docs --http` serves MCP over Streamable HTTP at `/mcp` (port 8081, or `PORT`). It fetches
55
+ each library's index from the library's own channel as agents ask for it: a TypeScript library's
56
+ npm package (through the server's own `.npmrc`), keeping only its index, or hoist-core's Maven
57
+ artifact. It serves the newest release by default, or the release an agent names with `library`
58
+ and `version`. Fetched indexes are cached in `HOIST_DOCS_CACHE`. Without registry access, give it a directory of index files
59
+ instead (`--index-dir`, or `INDEX_DIR`), which may hold several versions of each library.
60
+ `GET /health` reports what is loaded. Browser requests are checked against allowed origins
61
+ (localhost, plus `ALLOWED_ORIGINS`, comma-separated); agents and gateways send no `Origin` and
62
+ pass. The `Dockerfile` runs the same; to serve a directory instead, set `INDEX_DIR` and mount it.
63
+
64
+ ## Docs viewers
65
+
66
+ `@xh/hoist-docs/docs` is a browser-safe library for docs viewers such as Toolbox's: registry,
67
+ content and ranked search, with the same ranking as the MCP tools. Feed it docs payloads written
68
+ by:
69
+
70
+ ```bash
71
+ hoist-docs export-docs --out <dir> # <dir>/<library>.json for each library, plus <dir>/index.json
72
+
73
+ # For doc authors: straight from checkouts, in well under a second, so edits show up live.
74
+ hoist-docs export-docs --out <dir> --from-checkout ../hoist-react --from-checkout ../hoist-core
75
+ ```
76
+
77
+ ```ts
78
+ import {DocsCatalog} from '@xh/hoist-docs/docs';
79
+ const catalog = new DocsCatalog([reactPayload, corePayload]);
80
+ catalog.search('grid column renderer');
81
+ ```
82
+
83
+ ## Development
84
+
85
+ Requires Node 24 and pnpm. Node runs the TypeScript source directly; the published package is
86
+ compiled (`pnpm build`, run automatically on pack).
87
+
88
+ ```bash
89
+ pnpm install
90
+ pnpm build:react --root ../hoist-react # build indexes from sibling checkouts into ./indexes
91
+ pnpm build:core --root ../hoist-core
92
+ pnpm build:react --root ../hoist-chat-kit --library chat-kit
93
+ pnpm dev # HTTP on 8081 from ./indexes, restarting on changes
94
+ pnpm mcp --index-dir indexes # stdio, as an agent would run it
95
+ ```
96
+
97
+ Rebuilt or added index files are picked up within a few seconds, without a restart.
98
+
99
+ - `pnpm test` - unit tests; golden-set retrieval checks for each library (`test/golden/`, `VERBOSE=1` prints every query's top 3); and a parity spec that checks search
100
+ ranks exactly as hoist-react's original search did.
101
+ - `HOIST_REACT_ROOT=../hoist-react pnpm test` - also runs the hoist-react builder's schema
102
+ conformance spec against that checkout.
103
+ - `pnpm typecheck`, `pnpm lint`, `pnpm format`.
104
+
105
+ ## Building indexes
106
+
107
+ The builders live in `builders/`: `builders/react/` (Node, ts-morph), for hoist-react and the other
108
+ TypeScript libraries, and `builders/core/` (a Java program written in Groovy, built with Gradle;
109
+ needs a JDK 17 or later). Each takes a library checkout and writes `<library>-<version>.json` to
110
+ `./indexes` (`--out` to change, `--gzip` to compress):
111
+
112
+ ```bash
113
+ pnpm build:react --root <hoist-react checkout> [--version 91.0.0]
114
+ pnpm build:react --root <hoist-chat-kit checkout> --library chat-kit [--version 2.0.0]
115
+ pnpm build:core --root <hoist-core checkout> [--version 45.0.0]
116
+ ```
117
+
118
+ A TypeScript library's checkout needs its dependencies installed first, for type resolution.
119
+
120
+ ## Shipping an index with a library
121
+
122
+ Each library builds its index in its own publish job, on the commit it is publishing, with the
123
+ version it is about to publish, for releases and snapshots alike.
124
+
125
+ - **TypeScript libraries:** add `@xh/hoist-docs-builder` as a dev dependency, run it before
126
+ `npm publish` to write the gzipped index into the package, list it in `files`, and declare it in
127
+ `package.json`:
128
+ ```json
129
+ "hoistDocs": {"id": "react", "index": "hoist-docs/index.json.gz"}
130
+ ```
131
+ An organization's own library does the same and is found the same way. Agent instructions in an
132
+ index are used only from `@xh` packages.
133
+ - **hoist-core**, and any Grails library: depend on `io.xh:hoist-docs-builder` in a
134
+ `docsBuilder` configuration, run it from a `JavaExec` task, and attach its output to the Maven
135
+ publication with classifier `docs-index` and extension `json.gz` (see `buildDocsIndex` in
136
+ hoist-core's `build.gradle`).
137
+
138
+ The library also needs its docs and a `docs/doc-registry.json`. An XH library gets a row in
139
+ `src/libraries.ts` and a golden set in `test/golden/`.
140
+
141
+ ## Publishing
142
+
143
+ - **The tool** (`@xh/hoist-docs`): push a `vX.Y.Z` tag matching `package.json`; the `Release`
144
+ workflow tests and publishes it.
145
+ - **The builders**, `@xh/hoist-docs-builder` on npm and `io.xh:hoist-docs-builder` on Maven
146
+ Central, publish from the same tag and workflow, at the same version.
@@ -0,0 +1,16 @@
1
+ #!/usr/bin/env node
2
+ /*
3
+ * This file belongs to Hoist, an application development toolkit
4
+ * developed by Extremely Heavy Industries (www.xh.io | info@xh.io)
5
+ *
6
+ * Copyright © 2026 Extremely Heavy Industries Inc.
7
+ */
8
+
9
+ // Launcher for the published package, a stable path for .mcp.json:
10
+ // {"command": "node", "args": ["client-app/node_modules/@xh/hoist-docs/bin/hoist-docs.mjs"]}
11
+ // Runs the compiled CLI. During development, run the source directly: node src/cli.ts
12
+ import process from 'node:process';
13
+
14
+ import {run} from '../dist/cli.js';
15
+
16
+ await run(process.argv.slice(2));
@@ -0,0 +1,78 @@
1
+ import { LibraryIndex } from './index/LibraryIndex.ts';
2
+ import type { LibrarySource } from './local/sources.ts';
3
+ /** Thrown for a library or version with no index file. */
4
+ export declare class NotFoundError extends Error {
5
+ }
6
+ /** One index file named explicitly, rather than found by scanning a directory. */
7
+ export interface IndexFileSpec {
8
+ libraryId: string;
9
+ version: string;
10
+ path: string;
11
+ /**
12
+ * False for an index from outside the `@xh` scope, whose agent instructions are dropped, so a
13
+ * dependency cannot steer the agent. Default true.
14
+ */
15
+ trusted?: boolean;
16
+ }
17
+ /** Fetch the built-in libraries' indexes from their own channels as they are asked for. */
18
+ export interface OnDemandSource {
19
+ source: LibrarySource;
20
+ }
21
+ /**
22
+ * The index files the tool serves, from one of three sources:
23
+ *
24
+ * - **A directory** of `<libraryId>-<version>.json[.gz]` files (see docs/index-schema.md), for
25
+ * HTTP deployments without registry access, and development. It may hold several versions of
26
+ * each library.
27
+ * - **Explicit files**, for the local tool: one per library, for the project's own versions.
28
+ * - **On demand**, for HTTP deployments: the built-in libraries' indexes, fetched from each
29
+ * library's own channel (its npm package, or its Maven `docs-index` artifact) and cached as
30
+ * calls ask for each library and version (see {@link ensure}), the newest release of each by
31
+ * default.
32
+ *
33
+ * Each file is parsed on first use and held in memory. Sources are rechecked at most every few
34
+ * seconds, and a file that changed on disk is reloaded, so freshly built indexes are picked up
35
+ * without a restart.
36
+ */
37
+ export declare class IndexStore {
38
+ /** The directory scanned, or null for explicit files. */
39
+ readonly dir: string | null;
40
+ /** True when indexes are fetched as they are asked for. */
41
+ readonly onDemand: boolean;
42
+ private readonly specs;
43
+ private readonly source;
44
+ /** On demand: `<libraryId>@<version or 'latest'>` -> the fetch, finished or in flight. */
45
+ private readonly fetches;
46
+ /** libraryId -> version -> file */
47
+ private files;
48
+ private loaded;
49
+ private lastScan;
50
+ private missingDirWarned;
51
+ constructor(source: string | IndexFileSpec[] | OnDemandSource);
52
+ /**
53
+ * On demand, fetch what a call needs: `version` of `libraryId`, else the newest release of
54
+ * `libraryId`, else the newest release of every built-in library. A no-op for the other
55
+ * sources. A library with nothing published is skipped with a warning when not asked for by
56
+ * name; asked for by name, it fails with a {@link NotFoundError}.
57
+ */
58
+ ensure(libraryId?: string | null, version?: string | null): Promise<void>;
59
+ /** Scan the directory and load the newest version of every library. */
60
+ init(): void;
61
+ /** Library ids with at least one index file, in display order. */
62
+ libraryIds(): string[];
63
+ /** Available versions of a library, newest first. */
64
+ versions(libraryId: string): string[];
65
+ /** The index for a library at a version - the newest when no version is given. */
66
+ get(libraryId: string, version?: string | null): LibraryIndex;
67
+ /** Path of the index file for a library version - the newest when no version is given. */
68
+ filePath(libraryId: string, version?: string | null): string;
69
+ /** The newest index of every library, in display order. */
70
+ latest(): LibraryIndex[];
71
+ private fetch;
72
+ /** Resolve and register one index file, returning its path, or the error with a warning. */
73
+ private resolve;
74
+ private maybeRescan;
75
+ private scan;
76
+ }
77
+ /** Orders versions numerically by segment; a SNAPSHOT sorts before its release. */
78
+ export declare function compareVersions(a: string, b: string): number;