@dereekb/dbx-cli 13.11.17 → 13.12.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.
Files changed (156) hide show
  1. package/firebase-api-manifest/main.js +70 -9
  2. package/firebase-api-manifest/package.json +1 -1
  3. package/firestore-indexes/src/firestore-indexes-generate.d.ts +125 -0
  4. package/firestore-indexes/src/firestore-model-identity-resolver.d.ts +93 -0
  5. package/firestore-indexes/src/firestore-query-helpers.d.ts +108 -0
  6. package/firestore-indexes/src/generate-firestore-indexes-cli.d.ts +94 -0
  7. package/firestore-indexes/src/index.d.ts +7 -0
  8. package/firestore-indexes/src/model-firebase-index-analyze.d.ts +68 -0
  9. package/firestore-indexes/src/model-firebase-index-build-manifest.d.ts +123 -0
  10. package/firestore-indexes/src/model-firebase-index-extract.d.ts +246 -0
  11. package/firestore-indexes/src/model-firebase-index-runtime.d.ts +126 -0
  12. package/firestore-indexes/src/model-firebase-index-scan-config-schema.d.ts +58 -0
  13. package/firestore-indexes/src/model-firebase-index-schema.d.ts +366 -0
  14. package/generate-firestore-indexes/main.js +1 -1
  15. package/generate-firestore-indexes/package.json +1 -1
  16. package/generate-mcp-manifest/src/generate-mcp-manifest/main.d.ts +26 -0
  17. package/generate-mcp-manifest/src/generate-mcp-manifest/render.d.ts +38 -0
  18. package/generated/firebase-models.generated.d.ts +3 -0
  19. package/index.cjs.js +45234 -640
  20. package/index.esm.js +44941 -643
  21. package/lint-cache/main.js +19 -19
  22. package/lint-cache/package.json +2 -2
  23. package/manifest-extract/index.cjs.js +169 -4
  24. package/manifest-extract/index.esm.js +169 -4
  25. package/manifest-extract/package.json +1 -1
  26. package/manifest-extract/src/lib/types.d.ts +26 -1
  27. package/package.json +14 -10
  28. package/src/lib/index.d.ts +3 -0
  29. package/src/lib/manifest/types.d.ts +155 -0
  30. package/src/lib/mcp-scan/config/config-schema.d.ts +226 -0
  31. package/src/lib/mcp-scan/config/load-config.d.ts +63 -0
  32. package/src/lib/mcp-scan/index.d.ts +16 -0
  33. package/src/lib/mcp-scan/manifest/actions-loader.d.ts +49 -0
  34. package/src/lib/mcp-scan/manifest/actions-schema.d.ts +328 -0
  35. package/src/lib/mcp-scan/manifest/core-topics.d.ts +38 -0
  36. package/src/lib/mcp-scan/manifest/css-utilities-loader.d.ts +55 -0
  37. package/src/lib/mcp-scan/manifest/css-utilities-schema.d.ts +168 -0
  38. package/src/lib/mcp-scan/manifest/dbx-docs-ui-examples-loader.d.ts +33 -0
  39. package/src/lib/mcp-scan/manifest/dbx-docs-ui-examples-schema.d.ts +133 -0
  40. package/src/lib/mcp-scan/manifest/filters-loader.d.ts +61 -0
  41. package/src/lib/mcp-scan/manifest/filters-schema.d.ts +190 -0
  42. package/src/lib/mcp-scan/manifest/forge-fields-loader.d.ts +53 -0
  43. package/src/lib/mcp-scan/manifest/forge-fields-schema.d.ts +170 -0
  44. package/src/lib/mcp-scan/manifest/index.d.ts +43 -0
  45. package/src/lib/mcp-scan/manifest/load-actions-registry.d.ts +38 -0
  46. package/src/lib/mcp-scan/manifest/load-auth-registry.d.ts +82 -0
  47. package/src/lib/mcp-scan/manifest/load-css-utilities-registry.d.ts +67 -0
  48. package/src/lib/mcp-scan/manifest/load-dbx-docs-ui-examples-registry.d.ts +45 -0
  49. package/src/lib/mcp-scan/manifest/load-filters-registry.d.ts +69 -0
  50. package/src/lib/mcp-scan/manifest/load-forge-fields-registry.d.ts +70 -0
  51. package/src/lib/mcp-scan/manifest/load-model-firebase-index-registry.d.ts +61 -0
  52. package/src/lib/mcp-scan/manifest/load-model-snapshot-fields-registry.d.ts +74 -0
  53. package/src/lib/mcp-scan/manifest/load-pipes-registry.d.ts +69 -0
  54. package/src/lib/mcp-scan/manifest/load-registry.d.ts +76 -0
  55. package/src/lib/mcp-scan/manifest/load-tokens-registry.d.ts +69 -0
  56. package/src/lib/mcp-scan/manifest/load-ui-components-registry.d.ts +70 -0
  57. package/src/lib/mcp-scan/manifest/load-utils-registry.d.ts +73 -0
  58. package/src/lib/mcp-scan/manifest/loader.d.ts +120 -0
  59. package/src/lib/mcp-scan/manifest/manifest-loader-base.d.ts +130 -0
  60. package/src/lib/mcp-scan/manifest/model-firebase-index-loader.d.ts +53 -0
  61. package/src/lib/mcp-scan/manifest/model-snapshot-fields-loader.d.ts +54 -0
  62. package/src/lib/mcp-scan/manifest/model-snapshot-fields-schema.d.ts +127 -0
  63. package/src/lib/mcp-scan/manifest/pipes-loader.d.ts +54 -0
  64. package/src/lib/mcp-scan/manifest/pipes-schema.d.ts +125 -0
  65. package/src/lib/mcp-scan/manifest/semantic-types-schema.d.ts +108 -0
  66. package/src/lib/mcp-scan/manifest/tokens-loader.d.ts +55 -0
  67. package/src/lib/mcp-scan/manifest/tokens-schema.d.ts +116 -0
  68. package/src/lib/mcp-scan/manifest/ui-components-loader.d.ts +54 -0
  69. package/src/lib/mcp-scan/manifest/ui-components-schema.d.ts +149 -0
  70. package/src/lib/mcp-scan/manifest/utils-loader.d.ts +54 -0
  71. package/src/lib/mcp-scan/manifest/utils-schema.d.ts +120 -0
  72. package/src/lib/mcp-scan/registry/actions-runtime.d.ts +173 -0
  73. package/src/lib/mcp-scan/registry/archetypes.d.ts +235 -0
  74. package/src/lib/mcp-scan/registry/auth-builtin.d.ts +59 -0
  75. package/src/lib/mcp-scan/registry/auth-runtime.d.ts +343 -0
  76. package/src/lib/mcp-scan/registry/css-utilities-runtime.d.ts +133 -0
  77. package/src/lib/mcp-scan/registry/dbx-docs-ui-examples-runtime.d.ts +58 -0
  78. package/src/lib/mcp-scan/registry/downstream-models-runtime.d.ts +93 -0
  79. package/src/lib/mcp-scan/registry/filters-runtime.d.ts +128 -0
  80. package/src/lib/mcp-scan/registry/firebase-models.d.ts +387 -0
  81. package/src/lib/mcp-scan/registry/forge-fields.d.ts +101 -0
  82. package/src/lib/mcp-scan/registry/form-fields.d.ts +203 -0
  83. package/src/lib/mcp-scan/registry/index.d.ts +165 -0
  84. package/src/lib/mcp-scan/registry/model-snapshot-fields-runtime.d.ts +138 -0
  85. package/src/lib/mcp-scan/registry/pipes-runtime.d.ts +136 -0
  86. package/src/lib/mcp-scan/registry/reserved-model-folders.d.ts +29 -0
  87. package/src/lib/mcp-scan/registry/semantic-types.d.ts +81 -0
  88. package/src/lib/mcp-scan/registry/tokens-runtime.d.ts +96 -0
  89. package/src/lib/mcp-scan/registry/ui-components-runtime.d.ts +90 -0
  90. package/src/lib/mcp-scan/registry/utils-runtime.d.ts +136 -0
  91. package/src/lib/mcp-scan/scan/_jsdoc-tagged-export/extract-base.d.ts +245 -0
  92. package/src/lib/mcp-scan/scan/actions-build-manifest.d.ts +58 -0
  93. package/src/lib/mcp-scan/scan/actions-cli.d.ts +38 -0
  94. package/src/lib/mcp-scan/scan/actions-extract.d.ts +99 -0
  95. package/src/lib/mcp-scan/scan/actions-scan-config-schema.d.ts +42 -0
  96. package/src/lib/mcp-scan/scan/auth-extract.d.ts +120 -0
  97. package/src/lib/mcp-scan/scan/build-manifest.d.ts +76 -0
  98. package/src/lib/mcp-scan/scan/cli.d.ts +60 -0
  99. package/src/lib/mcp-scan/scan/css-utilities-build-manifest.d.ts +76 -0
  100. package/src/lib/mcp-scan/scan/css-utilities-cli.d.ts +36 -0
  101. package/src/lib/mcp-scan/scan/css-utilities-extract.d.ts +187 -0
  102. package/src/lib/mcp-scan/scan/css-utilities-scan-config-schema.d.ts +57 -0
  103. package/src/lib/mcp-scan/scan/dbx-docs-ui-examples-build-manifest.d.ts +68 -0
  104. package/src/lib/mcp-scan/scan/dbx-docs-ui-examples-cli.d.ts +20 -0
  105. package/src/lib/mcp-scan/scan/dbx-docs-ui-examples-extract.d.ts +160 -0
  106. package/src/lib/mcp-scan/scan/dbx-docs-ui-examples-scan-config-schema.d.ts +56 -0
  107. package/src/lib/mcp-scan/scan/discover-downstream-packages.d.ts +76 -0
  108. package/src/lib/mcp-scan/scan/discover-firebase-packages.d.ts +58 -0
  109. package/src/lib/mcp-scan/scan/extract-models/assemble.d.ts +105 -0
  110. package/src/lib/mcp-scan/scan/extract-models/collect-inherited.d.ts +22 -0
  111. package/src/lib/mcp-scan/scan/extract-models/find-converters.d.ts +19 -0
  112. package/src/lib/mcp-scan/scan/extract-models/find-enums.d.ts +19 -0
  113. package/src/lib/mcp-scan/scan/extract-models/find-identities.d.ts +25 -0
  114. package/src/lib/mcp-scan/scan/extract-models/find-interfaces.d.ts +31 -0
  115. package/src/lib/mcp-scan/scan/extract-models/find-model-groups.d.ts +21 -0
  116. package/src/lib/mcp-scan/scan/extract-models/find-service-factories.d.ts +19 -0
  117. package/src/lib/mcp-scan/scan/extract-models/find-sub-object-consts.d.ts +20 -0
  118. package/src/lib/mcp-scan/scan/extract-models/index.d.ts +74 -0
  119. package/src/lib/mcp-scan/scan/extract-models/infer-collection-kind.d.ts +22 -0
  120. package/src/lib/mcp-scan/scan/extract-models/service-factory-constants.d.ts +6 -0
  121. package/src/lib/mcp-scan/scan/extract-models/types.d.ts +171 -0
  122. package/src/lib/mcp-scan/scan/extract.d.ts +82 -0
  123. package/src/lib/mcp-scan/scan/filters-build-manifest.d.ts +78 -0
  124. package/src/lib/mcp-scan/scan/filters-cli.d.ts +37 -0
  125. package/src/lib/mcp-scan/scan/filters-extract.d.ts +101 -0
  126. package/src/lib/mcp-scan/scan/filters-scan-config-schema.d.ts +56 -0
  127. package/src/lib/mcp-scan/scan/forge-fields-build-manifest.d.ts +78 -0
  128. package/src/lib/mcp-scan/scan/forge-fields-cli.d.ts +37 -0
  129. package/src/lib/mcp-scan/scan/forge-fields-extract.d.ts +165 -0
  130. package/src/lib/mcp-scan/scan/forge-fields-scan-config-schema.d.ts +61 -0
  131. package/src/lib/mcp-scan/scan/index.d.ts +60 -0
  132. package/src/lib/mcp-scan/scan/model-firebase-index-cli.d.ts +22 -0
  133. package/src/lib/mcp-scan/scan/model-firebase-index-dispatcher-credit.d.ts +47 -0
  134. package/src/lib/mcp-scan/scan/model-firebase-index-reference-scan.d.ts +100 -0
  135. package/src/lib/mcp-scan/scan/model-snapshot-fields-build-manifest.d.ts +79 -0
  136. package/src/lib/mcp-scan/scan/model-snapshot-fields-cli.d.ts +37 -0
  137. package/src/lib/mcp-scan/scan/model-snapshot-fields-extract.d.ts +115 -0
  138. package/src/lib/mcp-scan/scan/model-snapshot-fields-scan-config-schema.d.ts +59 -0
  139. package/src/lib/mcp-scan/scan/pipes-build-manifest.d.ts +78 -0
  140. package/src/lib/mcp-scan/scan/pipes-cli.d.ts +37 -0
  141. package/src/lib/mcp-scan/scan/pipes-extract.d.ts +90 -0
  142. package/src/lib/mcp-scan/scan/pipes-scan-config-schema.d.ts +56 -0
  143. package/src/lib/mcp-scan/scan/scan-angular-io.d.ts +89 -0
  144. package/src/lib/mcp-scan/scan/scan-cli-base.d.ts +162 -0
  145. package/src/lib/mcp-scan/scan/scan-config-schema.d.ts +44 -0
  146. package/src/lib/mcp-scan/scan/ui-components-build-manifest.d.ts +78 -0
  147. package/src/lib/mcp-scan/scan/ui-components-cli.d.ts +37 -0
  148. package/src/lib/mcp-scan/scan/ui-components-extract.d.ts +124 -0
  149. package/src/lib/mcp-scan/scan/ui-components-scan-config-schema.d.ts +62 -0
  150. package/src/lib/mcp-scan/scan/utils-build-manifest.d.ts +78 -0
  151. package/src/lib/mcp-scan/scan/utils-cli.d.ts +37 -0
  152. package/src/lib/mcp-scan/scan/utils-extract.d.ts +103 -0
  153. package/src/lib/mcp-scan/scan/utils-scan-config-schema.d.ts +57 -0
  154. package/test/package.json +9 -9
  155. package/index.cjs.default.js +0 -1
  156. package/index.cjs.mjs +0 -2
@@ -0,0 +1,69 @@
1
+ /**
2
+ * Server-side composition of {@link findAndLoadConfig},
3
+ * {@link loadTokenManifests}, and {@link createTokenRegistry}.
4
+ *
5
+ * Resolves the bundled token manifests that ship inside this package's
6
+ * `generated/` directory and merges them with any external sources
7
+ * declared in `dbx-mcp.config.json` under either `tokens.sources` (full
8
+ * manifest paths) or `tokens.scan[].out` (paths produced by a downstream
9
+ * app's own scan run).
10
+ *
11
+ * The resulting {@link TokenRegistry} is the data the
12
+ * `dbx_css_token_lookup` and `dbx_ui_smell_check` tools and the tokens
13
+ * resource read from. All I/O is injectable so unit tests can drive every
14
+ * branch without touching disk.
15
+ */
16
+ import type { Maybe } from '@dereekb/util';
17
+ import { type ConfigWarning } from '../config/load-config.js';
18
+ import { type TokenRegistry } from '../registry/tokens-runtime.js';
19
+ import { type TokenLoaderWarning, type TokenManifestReadFile } from './tokens-loader.js';
20
+ /**
21
+ * Function shape used by {@link loadTokenRegistry} to enumerate the
22
+ * bundled token manifest paths shipped with this package.
23
+ */
24
+ export type BundledTokenManifestPathsFactory = () => readonly string[];
25
+ /**
26
+ * Input to {@link loadTokenRegistry}.
27
+ */
28
+ export interface LoadTokenRegistryInput {
29
+ readonly cwd: string;
30
+ readonly bundledManifestPaths?: BundledTokenManifestPathsFactory;
31
+ readonly readFile?: TokenManifestReadFile;
32
+ }
33
+ /**
34
+ * Outcome from {@link loadTokenRegistry}. Surfaces both the registry and
35
+ * the loader warnings so callers (the server bootstrap) can log anything
36
+ * that fell through warn-and-skip.
37
+ */
38
+ export interface LoadTokenRegistryResult {
39
+ readonly registry: TokenRegistry;
40
+ readonly configPath: Maybe<string>;
41
+ readonly configWarnings: readonly ConfigWarning[];
42
+ readonly loaderWarnings: readonly TokenLoaderWarning[];
43
+ readonly externalSourceCount: number;
44
+ }
45
+ /**
46
+ * Loads the merged tokens registry for the current MCP server.
47
+ *
48
+ * Bundled manifests load as strict sources — a malformed or missing bundled
49
+ * file is a build-time bug, not a configuration problem. External manifests
50
+ * declared in `dbx-mcp.config.json` (`tokens.sources` plus `tokens.scan[].out`)
51
+ * load as non-strict sources so a single bad downstream manifest does not
52
+ * take the registry down.
53
+ *
54
+ * Returns an {@link EMPTY_TOKEN_REGISTRY} with surfaced warnings when neither
55
+ * bundled nor external manifests yield any successful load. The caller is
56
+ * responsible for deciding whether an empty registry is a fatal startup
57
+ * error.
58
+ *
59
+ * @param input - Cwd plus optional injected bundled-path factory and reader.
60
+ * @returns The registry, the resolved config path (if any), and any warnings.
61
+ */
62
+ export declare function loadTokenRegistry(input: LoadTokenRegistryInput): Promise<LoadTokenRegistryResult>;
63
+ /**
64
+ * Re-exported so callers can build a deterministic test fixture pointing at
65
+ * the package's bundled manifests without touching `import.meta.url`.
66
+ *
67
+ * @returns The absolute paths of the bundled token manifests.
68
+ */
69
+ export declare function getDefaultBundledTokenManifestPaths(): readonly string[];
@@ -0,0 +1,70 @@
1
+ /**
2
+ * Server-side composition of {@link findAndLoadConfig},
3
+ * {@link loadUiComponentManifests}, and {@link createUiComponentRegistry}.
4
+ *
5
+ * Resolves the bundled `@dereekb/*` ui-components manifests that ship inside
6
+ * this package's `generated/` directory and merges them with any external
7
+ * sources declared in `dbx-mcp.config.json` under `uiComponents.sources`.
8
+ * The resulting {@link UiComponentRegistry} is the data the lookup-ui /
9
+ * search-ui tools and the registry resource read from.
10
+ *
11
+ * All I/O is injectable so unit tests can drive every branch without touching
12
+ * disk. The default `bundledManifestPaths` factory uses `import.meta.url` to
13
+ * locate the package's `generated/` directory regardless of whether the
14
+ * caller imports the source or the bundled binary.
15
+ */
16
+ import type { Maybe } from '@dereekb/util';
17
+ import { type ConfigWarning } from '../config/load-config.js';
18
+ import { type UiComponentRegistry } from '../registry/ui-components-runtime.js';
19
+ import { type UiComponentLoaderWarning, type UiComponentManifestReadFile } from './ui-components-loader.js';
20
+ /**
21
+ * Function shape used by {@link loadUiComponentRegistry} to enumerate the
22
+ * bundled `@dereekb/*` manifest paths shipped with this package. Defaults to
23
+ * the JSON files inside the package's `generated/` directory.
24
+ */
25
+ export type BundledUiManifestPathsFactory = () => readonly string[];
26
+ /**
27
+ * Input to {@link loadUiComponentRegistry}.
28
+ */
29
+ export interface LoadUiComponentRegistryInput {
30
+ readonly cwd: string;
31
+ readonly bundledManifestPaths?: BundledUiManifestPathsFactory;
32
+ readonly readFile?: UiComponentManifestReadFile;
33
+ }
34
+ /**
35
+ * Outcome from {@link loadUiComponentRegistry}. Surfaces both the registry
36
+ * and the loader warnings so callers (the server bootstrap) can log anything
37
+ * that fell through warn-and-skip.
38
+ */
39
+ export interface LoadUiComponentRegistryResult {
40
+ readonly registry: UiComponentRegistry;
41
+ readonly configPath: Maybe<string>;
42
+ readonly configWarnings: readonly ConfigWarning[];
43
+ readonly loaderWarnings: readonly UiComponentLoaderWarning[];
44
+ readonly externalSourceCount: number;
45
+ }
46
+ /**
47
+ * Loads the merged ui-components registry for the current MCP server.
48
+ *
49
+ * Bundled `@dereekb/*` manifests load as strict sources — a malformed or
50
+ * missing bundled file is a build-time bug, not a configuration problem.
51
+ * External manifests declared in `dbx-mcp.config.json` load as non-strict
52
+ * sources so a single bad downstream manifest does not take the registry
53
+ * down.
54
+ *
55
+ * Returns an {@link EMPTY_UI_COMPONENT_REGISTRY} with surfaced warnings
56
+ * when neither bundled nor external manifests yield any successful load —
57
+ * the loader's "zero successful manifests" guard. The caller is responsible
58
+ * for deciding whether an empty registry is a fatal startup error.
59
+ *
60
+ * @param input - Cwd plus optional injected bundled-path factory and reader.
61
+ * @returns The registry, the resolved config path (if any), and any warnings.
62
+ */
63
+ export declare function loadUiComponentRegistry(input: LoadUiComponentRegistryInput): Promise<LoadUiComponentRegistryResult>;
64
+ /**
65
+ * Re-exported so callers can build a deterministic test fixture pointing at
66
+ * the package's bundled manifests without touching `import.meta.url`.
67
+ *
68
+ * @returns The absolute paths of the bundled `@dereekb/*` manifests.
69
+ */
70
+ export declare function getDefaultBundledUiManifestPaths(): readonly string[];
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Server-side composition of {@link findAndLoadConfig},
3
+ * {@link loadUtilManifests}, and {@link createUtilRegistry}.
4
+ *
5
+ * Resolves the bundled `@dereekb/*` utils manifests that ship inside this
6
+ * package's `generated/` directory and merges them with any external
7
+ * sources declared in `dbx-mcp.config.json` under `utils.sources`. The
8
+ * resulting {@link UtilRegistry} is the data the `dbx_util_lookup` and
9
+ * `dbx_util_search` tools read from.
10
+ *
11
+ * All I/O is injectable so unit tests can drive every branch without
12
+ * touching disk. The default `bundledManifestPaths` factory uses
13
+ * `import.meta.url` to locate the package's `generated/` directory
14
+ * regardless of whether the caller imports the source or the bundled
15
+ * binary.
16
+ */
17
+ import type { Maybe } from '@dereekb/util';
18
+ import { type ConfigWarning } from '../config/load-config.js';
19
+ import { type UtilRegistry } from '../registry/utils-runtime.js';
20
+ import { type UtilLoaderWarning, type UtilManifestReadFile } from './utils-loader.js';
21
+ /**
22
+ * Function shape used by {@link loadUtilRegistry} to enumerate the bundled
23
+ * `@dereekb/*` manifest paths shipped with this package. Defaults to the
24
+ * JSON files inside the package's `generated/` directory.
25
+ */
26
+ export type BundledUtilManifestPathsFactory = () => readonly string[];
27
+ /**
28
+ * Input to {@link loadUtilRegistry}.
29
+ */
30
+ export interface LoadUtilRegistryInput {
31
+ readonly cwd: string;
32
+ readonly bundledManifestPaths?: BundledUtilManifestPathsFactory;
33
+ readonly readFile?: UtilManifestReadFile;
34
+ }
35
+ /**
36
+ * Outcome from {@link loadUtilRegistry}. Surfaces both the registry and
37
+ * the loader warnings so callers (the server bootstrap) can log anything
38
+ * that fell through warn-and-skip.
39
+ */
40
+ export interface LoadUtilRegistryResult {
41
+ readonly registry: UtilRegistry;
42
+ readonly configPath: Maybe<string>;
43
+ readonly configWarnings: readonly ConfigWarning[];
44
+ readonly loaderWarnings: readonly UtilLoaderWarning[];
45
+ readonly externalSourceCount: number;
46
+ }
47
+ /**
48
+ * Loads the merged utils registry for the current MCP server.
49
+ *
50
+ * Bundled `@dereekb/*` manifests load as non-strict sources because not
51
+ * every package may have @dbxUtil-tagged exports yet — a missing bundled
52
+ * file should warn and skip rather than fail server startup. External
53
+ * manifests declared in `dbx-mcp.config.json` likewise load as non-strict
54
+ * sources so a single bad downstream manifest does not take the registry
55
+ * down.
56
+ *
57
+ * Returns an {@link EMPTY_UTIL_REGISTRY} with surfaced warnings when
58
+ * neither bundled nor external manifests yield any successful load — the
59
+ * loader's "zero successful manifests" guard is caught and translated
60
+ * into an empty registry so a workspace that hasn't run
61
+ * `generate-manifests` yet still boots.
62
+ *
63
+ * @param input - Cwd plus optional injected bundled-path factory and reader.
64
+ * @returns The registry, the resolved config path (if any), and any warnings.
65
+ */
66
+ export declare function loadUtilRegistry(input: LoadUtilRegistryInput): Promise<LoadUtilRegistryResult>;
67
+ /**
68
+ * Re-exported so callers can build a deterministic test fixture pointing
69
+ * at the package's bundled manifests without touching `import.meta.url`.
70
+ *
71
+ * @returns The absolute paths of the bundled `@dereekb/*` manifests.
72
+ */
73
+ export declare function getDefaultBundledUtilManifestPaths(): readonly string[];
@@ -0,0 +1,120 @@
1
+ /**
2
+ * Loader for semantic-types manifests.
3
+ *
4
+ * Reads one or more manifest files (bundled `@dereekb/*` registries plus any
5
+ * downstream-app manifests discovered via `dbx-mcp.config.json`), validates
6
+ * them against {@link SemanticTypeManifest}, and merges them into a single
7
+ * lookup-ready registry.
8
+ *
9
+ * The loader never performs file I/O directly inside the merge logic — all
10
+ * reads go through an injectable `readFile` so loader tests run entirely
11
+ * in-memory. Only `defaultReadFile` (and any caller-supplied alternative)
12
+ * touches the disk.
13
+ *
14
+ * Failure handling is split between *strict* and non-strict sources:
15
+ * - **Strict** sources (default for `origin: 'bundled'`) throw on any
16
+ * parse, version, or schema failure — these failures indicate a build
17
+ * bug, not a configuration problem.
18
+ * - **Non-strict** sources (default for `origin: 'external'`) emit a
19
+ * {@link LoaderWarning} and are skipped, so a single malformed
20
+ * downstream manifest does not take the registry down.
21
+ *
22
+ * If no source loads successfully (every source failed warn-and-skip) the
23
+ * loader throws — silent empty registries are the worst failure mode.
24
+ */
25
+ import { type SemanticTypeEntry } from './semantic-types-schema.js';
26
+ /**
27
+ * One manifest the loader is asked to ingest. `path` must be absolute (the
28
+ * caller is responsible for resolving any repo-relative `dbx-mcp.config.json`
29
+ * entries against the config file's directory before invoking the loader).
30
+ *
31
+ * `strict` defaults to `true` for `origin: 'bundled'` and `false` for
32
+ * `origin: 'external'`. Override the default to e.g. enforce strict
33
+ * validation on a known-good external source during CI.
34
+ */
35
+ export interface ManifestSource {
36
+ readonly origin: 'bundled' | 'external';
37
+ readonly path: string;
38
+ readonly strict?: boolean;
39
+ }
40
+ /**
41
+ * Function shape used by the loader to read manifest contents. Defaults to
42
+ * `node:fs/promises.readFile(path, 'utf-8')` when not supplied. Tests
43
+ * inject a Map-backed implementation so they can drive the loader without
44
+ * touching disk.
45
+ */
46
+ export type ManifestReadFile = (absolutePath: string) => Promise<string>;
47
+ /**
48
+ * Input to {@link loadSemanticTypeManifests}.
49
+ */
50
+ export interface LoadSemanticTypeManifestsInput {
51
+ readonly sources: readonly ManifestSource[];
52
+ readonly readFile?: ManifestReadFile;
53
+ }
54
+ /**
55
+ * Result of {@link loadSemanticTypeManifests}. `entries` is the merged
56
+ * lookup map keyed by `${package}::${name}`; `topicsIndex` is the inverted
57
+ * index from topic to entry keys (each bucket sorted alphabetically for
58
+ * deterministic output). `warnings` is sorted deterministically so test
59
+ * assertions over the array are stable across runs.
60
+ */
61
+ export interface LoadSemanticTypeManifestsResult {
62
+ readonly entries: ReadonlyMap<string, SemanticTypeEntry>;
63
+ readonly topicsIndex: ReadonlyMap<string, readonly string[]>;
64
+ readonly warnings: readonly LoaderWarning[];
65
+ readonly loadedSources: readonly string[];
66
+ }
67
+ /**
68
+ * Discriminated union of all non-fatal events the loader emits. Strict
69
+ * sources convert these into thrown errors; non-strict sources collect
70
+ * them into the result's `warnings` array.
71
+ */
72
+ export type LoaderWarning = {
73
+ readonly kind: 'manifest-missing';
74
+ readonly path: string;
75
+ } | {
76
+ readonly kind: 'manifest-parse-failed';
77
+ readonly path: string;
78
+ readonly error: string;
79
+ } | {
80
+ readonly kind: 'manifest-schema-failed';
81
+ readonly path: string;
82
+ readonly error: string;
83
+ } | {
84
+ readonly kind: 'manifest-version-unsupported';
85
+ readonly path: string;
86
+ readonly version: unknown;
87
+ } | {
88
+ readonly kind: 'source-label-collision';
89
+ readonly source: string;
90
+ readonly existingPath: string;
91
+ readonly droppedPath: string;
92
+ } | {
93
+ readonly kind: 'entry-collision';
94
+ readonly entryKey: string;
95
+ readonly winningSource: string;
96
+ readonly losingSource: string;
97
+ } | {
98
+ readonly kind: 'topic-unknown-core';
99
+ readonly entryKey: string;
100
+ readonly topic: string;
101
+ } | {
102
+ readonly kind: 'topic-namespace-mismatch';
103
+ readonly entryKey: string;
104
+ readonly topic: string;
105
+ readonly expectedNamespace: string;
106
+ };
107
+ /**
108
+ * Loads, validates, and merges the supplied manifest sources into a single
109
+ * registry suitable for the (future) `lookup-semantic-type` /
110
+ * `search-semantic-type` MCP tools.
111
+ *
112
+ * Strict sources fail loud; non-strict sources fail soft. If every source
113
+ * fails — strict or not — the loader throws, since a silent empty registry
114
+ * provides no value to a downstream agent.
115
+ *
116
+ * @param input - Manifest sources plus an optional injected `readFile`
117
+ * @returns Merged entries, topic index, deterministic warnings, and the list of source labels that loaded.
118
+ * @throws {Error} When a strict source fails or when zero manifests load successfully.
119
+ */
120
+ export declare function loadSemanticTypeManifests(input: LoadSemanticTypeManifestsInput): Promise<LoadSemanticTypeManifestsResult>;
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Generic core for the per-domain manifest loaders (actions, filters,
3
+ * forge-fields, pipes, ui-components).
4
+ *
5
+ * Each domain loader (`actions-loader.ts`, etc.) is a thin wrapper that
6
+ * supplies an arktype schema, an index-key extractor, and an entry-key
7
+ * builder. The orchestration — read, parse, version-check, schema-validate,
8
+ * merge, dedupe, sort — lives here so the five domains do not duplicate
9
+ * ~150 lines of identical procedural code each.
10
+ *
11
+ * The semantic-types loader (`loader.ts`) is intentionally not migrated to
12
+ * this base: it carries extra topic-filtering logic and a different result
13
+ * shape, so consolidating it would expand scope without removing
14
+ * meaningful duplication.
15
+ */
16
+ import { type } from 'arktype';
17
+ /**
18
+ * One manifest the loader is asked to ingest. `path` must be absolute (the
19
+ * caller resolves any repo-relative `dbx-mcp.config.json` entries against
20
+ * the config file's directory before invoking the loader).
21
+ */
22
+ export interface ManifestSource {
23
+ readonly origin: 'bundled' | 'external';
24
+ readonly path: string;
25
+ readonly strict?: boolean;
26
+ }
27
+ /**
28
+ * Function shape used by the loader to read manifest contents. Defaults to
29
+ * `node:fs/promises.readFile(path, 'utf-8')` when not supplied.
30
+ */
31
+ export type ManifestReadFile = (absolutePath: string) => Promise<string>;
32
+ /**
33
+ * Discriminated union of all non-fatal events the loader emits. Strict
34
+ * sources convert these into thrown errors; non-strict sources collect
35
+ * them into the result's `warnings` array.
36
+ */
37
+ export type ManifestLoaderWarning = {
38
+ readonly kind: 'manifest-missing';
39
+ readonly path: string;
40
+ } | {
41
+ readonly kind: 'manifest-parse-failed';
42
+ readonly path: string;
43
+ readonly error: string;
44
+ } | {
45
+ readonly kind: 'manifest-schema-failed';
46
+ readonly path: string;
47
+ readonly error: string;
48
+ } | {
49
+ readonly kind: 'manifest-version-unsupported';
50
+ readonly path: string;
51
+ readonly version: unknown;
52
+ } | {
53
+ readonly kind: 'source-label-collision';
54
+ readonly source: string;
55
+ readonly existingPath: string;
56
+ readonly droppedPath: string;
57
+ } | {
58
+ readonly kind: 'entry-collision';
59
+ readonly entryKey: string;
60
+ readonly winningSource: string;
61
+ readonly losingSource: string;
62
+ };
63
+ /**
64
+ * The minimum manifest envelope shape the base loader needs to merge a
65
+ * source. Each domain's full manifest type is a structural superset of
66
+ * this.
67
+ */
68
+ export interface BaseManifest<TEntry> {
69
+ readonly source: string;
70
+ readonly entries: readonly TEntry[];
71
+ }
72
+ /**
73
+ * Per-domain configuration for {@link loadManifestsBase}.
74
+ */
75
+ export interface ManifestLoaderConfig<TManifest extends BaseManifest<TEntry>, TEntry> {
76
+ /**
77
+ * Function name used in error messages — e.g. `loadActionManifests`.
78
+ */
79
+ readonly name: string;
80
+ /**
81
+ * Arktype validator for the domain's manifest envelope. The raw return
82
+ * value (`TManifest | type.errors`) is interrogated with `instanceof
83
+ * type.errors`.
84
+ */
85
+ readonly schema: (parsed: unknown) => TManifest | type.errors;
86
+ /**
87
+ * Pulls the inverted-index key out of one entry (e.g. `entry.role` for
88
+ * actions, `entry.kind` for filters).
89
+ */
90
+ readonly extractIndexValue: (entry: TEntry) => string;
91
+ /**
92
+ * Builds the merged-map key for one entry. Most domains use
93
+ * `${manifest.module}::${entry.slug}`; ui-components reads `module`
94
+ * from the entry itself instead of the envelope.
95
+ */
96
+ readonly buildEntryKey: (manifest: TManifest, entry: TEntry) => string;
97
+ }
98
+ /**
99
+ * Input to {@link loadManifestsBase}.
100
+ */
101
+ export interface ManifestLoaderInput {
102
+ readonly sources: readonly ManifestSource[];
103
+ readonly readFile?: ManifestReadFile;
104
+ }
105
+ /**
106
+ * Generic result of {@link loadManifestsBase}. Domain wrappers re-emit
107
+ * `indexMap` under their own property name (`roleIndex`, `kindIndex`,
108
+ * `tierIndex`, `categoryIndex`).
109
+ */
110
+ export interface ManifestLoaderBaseResult<TEntry> {
111
+ readonly entries: ReadonlyMap<string, TEntry>;
112
+ readonly indexMap: ReadonlyMap<string, readonly string[]>;
113
+ readonly warnings: readonly ManifestLoaderWarning[];
114
+ readonly loadedSources: readonly string[];
115
+ }
116
+ /**
117
+ * Loads, validates, and merges the supplied manifest sources into a single
118
+ * registry. Strict sources fail loud; non-strict sources fail soft. If
119
+ * every source fails — strict or not — the loader throws, since a silent
120
+ * empty registry provides no value to a downstream agent.
121
+ *
122
+ * Domain wrappers translate the generic result fields into their named
123
+ * shape (e.g. `indexMap` → `roleIndex`).
124
+ *
125
+ * @param input - Manifest sources plus an optional injected `readFile`
126
+ * @param config - Per-domain schema + key extractors + name for error messages.
127
+ * @returns Merged entries, generic index map, deterministic warnings, and the list of source labels that loaded.
128
+ * @throws {Error} When a strict source fails or when zero manifests load successfully.
129
+ */
130
+ export declare function loadManifestsBase<TManifest extends BaseManifest<TEntry>, TEntry>(input: ManifestLoaderInput, config: ManifestLoaderConfig<TManifest, TEntry>): Promise<ManifestLoaderBaseResult<TEntry>>;
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Loader for model-firebase-index manifests.
3
+ *
4
+ * Reads one or more manifest files (bundled `@dereekb/firebase` registry
5
+ * plus any downstream-app manifests discovered via `dbx-mcp.config.json`),
6
+ * validates them against {@link ModelFirebaseIndexManifest}, and merges
7
+ * them into a single lookup-ready registry.
8
+ *
9
+ * Failure handling mirrors the model-snapshot-fields loader: bundled
10
+ * sources are strict by default, external sources are not. If no source
11
+ * loads successfully the loader throws.
12
+ */
13
+ import { type ModelFirebaseIndexEntry } from '@dereekb/dbx-cli/firestore-indexes';
14
+ import { type ManifestLoaderWarning, type ManifestReadFile, type ManifestSource } from './manifest-loader-base.js';
15
+ /**
16
+ * One manifest the loader is asked to ingest. `path` must be absolute.
17
+ */
18
+ export type ModelFirebaseIndexManifestSource = ManifestSource;
19
+ /**
20
+ * Function shape used by the loader to read manifest contents.
21
+ */
22
+ export type ModelFirebaseIndexManifestReadFile = ManifestReadFile;
23
+ /**
24
+ * Discriminated union of all non-fatal events the loader emits.
25
+ */
26
+ export type ModelFirebaseIndexLoaderWarning = ManifestLoaderWarning;
27
+ /**
28
+ * Input to {@link loadModelFirebaseIndexManifests}.
29
+ */
30
+ export interface LoadModelFirebaseIndexManifestsInput {
31
+ readonly sources: readonly ModelFirebaseIndexManifestSource[];
32
+ readonly readFile?: ModelFirebaseIndexManifestReadFile;
33
+ }
34
+ /**
35
+ * Result of {@link loadModelFirebaseIndexManifests}.
36
+ */
37
+ export interface LoadModelFirebaseIndexManifestsResult {
38
+ readonly entries: ReadonlyMap<string, ModelFirebaseIndexEntry>;
39
+ readonly collectionIndex: ReadonlyMap<string, readonly string[]>;
40
+ readonly warnings: readonly ModelFirebaseIndexLoaderWarning[];
41
+ readonly loadedSources: readonly string[];
42
+ }
43
+ /**
44
+ * Loads, validates, and merges the supplied manifest sources into a
45
+ * single registry suitable for the `dbx_model_firebase_index_*` MCP
46
+ * tools.
47
+ *
48
+ * @param input - Manifest sources plus an optional injected `readFile`
49
+ * @returns Merged entries, collection index, deterministic warnings, and
50
+ * the list of source labels that loaded.
51
+ * @throws {Error} When a strict source fails or when zero manifests load successfully.
52
+ */
53
+ export declare function loadModelFirebaseIndexManifests(input: LoadModelFirebaseIndexManifestsInput): Promise<LoadModelFirebaseIndexManifestsResult>;
@@ -0,0 +1,54 @@
1
+ /**
2
+ * Loader for model-snapshot-fields manifests.
3
+ *
4
+ * Reads one or more manifest files (bundled `@dereekb/firebase` registry plus
5
+ * any downstream-app manifests discovered via `dbx-mcp.config.json`),
6
+ * validates them against {@link ModelSnapshotFieldManifest}, and merges them
7
+ * into a single lookup-ready registry.
8
+ *
9
+ * Failure handling mirrors the utils loader: bundled sources are strict by
10
+ * default, external sources are not. If no source loads successfully the
11
+ * loader throws.
12
+ */
13
+ import { type ModelSnapshotFieldEntry } from './model-snapshot-fields-schema.js';
14
+ import { type ManifestLoaderWarning, type ManifestReadFile, type ManifestSource } from './manifest-loader-base.js';
15
+ /**
16
+ * One manifest the loader is asked to ingest. `path` must be absolute.
17
+ */
18
+ export type ModelSnapshotFieldManifestSource = ManifestSource;
19
+ /**
20
+ * Function shape used by the loader to read manifest contents.
21
+ */
22
+ export type ModelSnapshotFieldManifestReadFile = ManifestReadFile;
23
+ /**
24
+ * Discriminated union of all non-fatal events the loader emits.
25
+ */
26
+ export type ModelSnapshotFieldLoaderWarning = ManifestLoaderWarning;
27
+ /**
28
+ * Input to {@link loadModelSnapshotFieldManifests}.
29
+ */
30
+ export interface LoadModelSnapshotFieldManifestsInput {
31
+ readonly sources: readonly ModelSnapshotFieldManifestSource[];
32
+ readonly readFile?: ModelSnapshotFieldManifestReadFile;
33
+ }
34
+ /**
35
+ * Result of {@link loadModelSnapshotFieldManifests}. `entries` is the merged
36
+ * lookup map keyed by `${module}::${slug}`; `categoryIndex` is the inverted
37
+ * index from category value to entry keys (sorted alphabetically for
38
+ * deterministic output).
39
+ */
40
+ export interface LoadModelSnapshotFieldManifestsResult {
41
+ readonly entries: ReadonlyMap<string, ModelSnapshotFieldEntry>;
42
+ readonly categoryIndex: ReadonlyMap<string, readonly string[]>;
43
+ readonly warnings: readonly ModelSnapshotFieldLoaderWarning[];
44
+ readonly loadedSources: readonly string[];
45
+ }
46
+ /**
47
+ * Loads, validates, and merges the supplied manifest sources into a single
48
+ * registry suitable for the `dbx_model_snapshot_field_*` MCP tools.
49
+ *
50
+ * @param input - Manifest sources plus an optional injected `readFile`
51
+ * @returns Merged entries, category index, deterministic warnings, and the list of source labels that loaded.
52
+ * @throws {Error} When a strict source fails or when zero manifests load successfully.
53
+ */
54
+ export declare function loadModelSnapshotFieldManifests(input: LoadModelSnapshotFieldManifestsInput): Promise<LoadModelSnapshotFieldManifestsResult>;