@dereekb/dbx-cli 13.11.18 → 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,133 @@
1
+ /**
2
+ * CSS-utility-class runtime registry wrapper.
3
+ *
4
+ * Wraps the raw {@link LoadCssUtilityManifestsResult} produced by the
5
+ * css-utilities loader with domain-friendly accessors so
6
+ * `dbx_css_class_lookup` does not have to walk Maps directly.
7
+ *
8
+ * The registry is loaded once at server startup and passed into the tool
9
+ * factories. Tests can construct a registry from any `CssUtilityEntry`
10
+ * array via {@link createCssUtilityRegistryFromEntries} to drive the tool
11
+ * without touching disk.
12
+ *
13
+ * Equivalency engine: `searchByDeclarations` parses a raw CSS declaration
14
+ * string into a property→value map and scores every entry by Jaccard
15
+ * (intersection / union) plus a structural-property weighting. The
16
+ * structural set (`display`, `flex`, `flex-direction`, `align-items`,
17
+ * `justify-content`, `gap`, `grid-template-columns`) is weighted higher
18
+ * because matching on those usually means the same layout intent;
19
+ * matching on padding/margin alone is rarely interesting on its own.
20
+ */
21
+ import type { LoadCssUtilityManifestsResult } from '../manifest/css-utilities-loader.js';
22
+ import type { CssUtilityEntry } from '../manifest/css-utilities-schema.js';
23
+ /**
24
+ * One scored candidate produced by the equivalency search.
25
+ */
26
+ export interface ScoredCssUtilityMatch {
27
+ readonly entry: CssUtilityEntry;
28
+ readonly score: number;
29
+ readonly matchedProperties: readonly string[];
30
+ readonly extraEntryProperties: readonly string[];
31
+ readonly missingInputProperties: readonly string[];
32
+ }
33
+ /**
34
+ * Optional knobs accepted by `searchByDeclarations`. `limit` defaults to 5,
35
+ * `minScore` defaults to 0.05. Child utilities (entries with a `parent`
36
+ * slug) are filtered out by default; pass `includeChildren: true` to
37
+ * include them, or pass an explicit `parent` slug to scope the search to a
38
+ * specific parent's children.
39
+ */
40
+ export interface SearchByDeclarationsOptions {
41
+ readonly limit?: number;
42
+ readonly minScore?: number;
43
+ readonly role?: string;
44
+ readonly parent?: string;
45
+ readonly includeChildren?: boolean;
46
+ }
47
+ /**
48
+ * Optional knobs accepted by `findByIntent`. Mirrors the child-filter
49
+ * semantics of {@link SearchByDeclarationsOptions}.
50
+ */
51
+ export interface FindByIntentOptions {
52
+ readonly role?: string;
53
+ readonly parent?: string;
54
+ readonly includeChildren?: boolean;
55
+ }
56
+ /**
57
+ * Domain-friendly read API over a merged css-utility manifest set. All
58
+ * accessors return readonly arrays sorted by `slug` so tool output stays
59
+ * deterministic across runs.
60
+ */
61
+ export interface CssUtilityRegistry {
62
+ readonly all: readonly CssUtilityEntry[];
63
+ readonly loadedSources: readonly string[];
64
+ readonly bySource: ReadonlyMap<string, readonly CssUtilityEntry[]>;
65
+ readonly byRole: ReadonlyMap<string, readonly CssUtilityEntry[]>;
66
+ readonly byParent: ReadonlyMap<string, readonly CssUtilityEntry[]>;
67
+ /**
68
+ * Returns the first entry whose `selector` or `slug` matches the
69
+ * supplied name. Accepts both `.dbx-flex-fill-0` and `dbx-flex-fill-0`
70
+ * — the leading dot is normalised away.
71
+ */
72
+ findByName(name: string): CssUtilityEntry | undefined;
73
+ /**
74
+ * Returns the children registered under the supplied parent slug,
75
+ * sorted by slug. Empty when the parent has no children (or does not
76
+ * exist).
77
+ */
78
+ findChildrenOf(parent: string): readonly CssUtilityEntry[];
79
+ /**
80
+ * Returns scored candidates whose `intent` field contains the supplied
81
+ * substring (case-insensitive). Children (entries with a `parent` slug)
82
+ * are excluded by default; pass `includeChildren: true` to include them,
83
+ * or pass an explicit `parent` slug to scope to that parent's children.
84
+ */
85
+ findByIntent(query: string, options?: FindByIntentOptions): readonly ScoredCssUtilityMatch[];
86
+ /**
87
+ * Equivalency search — parses a raw CSS declaration string into a
88
+ * property→value map, scores every entry, returns the top-N candidates.
89
+ * Child entries are excluded by default; see {@link SearchByDeclarationsOptions}.
90
+ */
91
+ searchByDeclarations(rawCss: string, options?: SearchByDeclarationsOptions): readonly ScoredCssUtilityMatch[];
92
+ }
93
+ /**
94
+ * Parses a raw CSS declaration string (e.g. `"display: flex; gap: 8px;"`)
95
+ * into a property→value map. Lowercases properties; trims and collapses
96
+ * whitespace in values; drops empty pairs.
97
+ *
98
+ * @param raw - The declaration string to parse.
99
+ * @returns The parsed property→value map (lowercased keys)
100
+ */
101
+ export declare function parseDeclarations(raw: string): ReadonlyMap<string, string>;
102
+ /**
103
+ * Builds a {@link CssUtilityRegistry} from a loader result. Single sorted-by-
104
+ * slug copy, plus pre-computed source/role buckets.
105
+ *
106
+ * @param loaded - The merged registry returned by `loadCssUtilityManifests`
107
+ * @returns A domain-friendly read API over the merged entries.
108
+ *
109
+ * @__NO_SIDE_EFFECTS__
110
+ */
111
+ export declare function createCssUtilityRegistry(loaded: LoadCssUtilityManifestsResult): CssUtilityRegistry;
112
+ /**
113
+ * Builds a {@link CssUtilityRegistry} from a raw entry array. Used by tests
114
+ * and by callers that want to drive the tool without going through the
115
+ * loader pipeline.
116
+ *
117
+ * @param input - The entries plus the source labels to advertise.
118
+ * @param input.entries - The full entry list (will be sorted by slug)
119
+ * @param input.loadedSources - Source labels reported via `registry.loadedSources`
120
+ * @returns A domain-friendly read API over the supplied entries.
121
+ *
122
+ * @__NO_SIDE_EFFECTS__
123
+ */
124
+ export declare function createCssUtilityRegistryFromEntries(input: {
125
+ readonly entries: readonly CssUtilityEntry[];
126
+ readonly loadedSources: readonly string[];
127
+ }): CssUtilityRegistry;
128
+ /**
129
+ * Empty registry suitable as a default when the server has no manifest
130
+ * sources to load. Tools wired against this behave like a registry that
131
+ * loaded successfully with zero entries.
132
+ */
133
+ export declare const EMPTY_CSS_UTILITY_REGISTRY: CssUtilityRegistry;
@@ -0,0 +1,58 @@
1
+ /**
2
+ * dbx-docs-ui-examples runtime registry wrapper.
3
+ *
4
+ * Wraps the merged manifest result with domain-friendly accessors so the
5
+ * `dbx_ui_examples` and `dbx_ui_search` tools can query entries without
6
+ * walking Maps directly. Mirrors `ui-components-runtime.ts`: registry is
7
+ * loaded once at server startup and passed into the tool factories.
8
+ */
9
+ import type { LoadDbxDocsUiExamplesManifestsResult } from '../manifest/dbx-docs-ui-examples-loader.js';
10
+ import type { DbxDocsUiExampleEntry } from '../manifest/dbx-docs-ui-examples-schema.js';
11
+ export interface DbxDocsUiExamplesRegistry {
12
+ readonly all: readonly DbxDocsUiExampleEntry[];
13
+ readonly loadedSources: readonly string[];
14
+ readonly categories: readonly string[];
15
+ readonly modules: readonly string[];
16
+ /**
17
+ * Returns the entry whose slug matches exactly. Slugs are
18
+ * case-sensitive; collisions across modules are resolved at load time.
19
+ */
20
+ findBySlug(slug: string): DbxDocsUiExampleEntry | undefined;
21
+ /**
22
+ * Returns every entry whose `category` field matches exactly.
23
+ */
24
+ findByCategory(category: string): readonly DbxDocsUiExampleEntry[];
25
+ /**
26
+ * Returns every entry whose `relatedSlugs` contains the supplied UI
27
+ * component slug. Used by `dbx_ui_search` to surface relevant examples
28
+ * alongside component results.
29
+ */
30
+ findRelatedTo(uiComponentSlug: string): readonly DbxDocsUiExampleEntry[];
31
+ }
32
+ /**
33
+ * Builds a {@link DbxDocsUiExamplesRegistry} from a loader result.
34
+ *
35
+ * @param loaded - The merged manifest loader output.
36
+ * @returns A registry with slug, category, module, and related-slug indices.
37
+ * @__NO_SIDE_EFFECTS__
38
+ */
39
+ export declare function createDbxDocsUiExamplesRegistry(loaded: LoadDbxDocsUiExamplesManifestsResult): DbxDocsUiExamplesRegistry;
40
+ /**
41
+ * Builds a {@link DbxDocsUiExamplesRegistry} from a raw entry array, used by tests and tools that synthesize entries directly.
42
+ *
43
+ * @param input - Pre-built entries and source labels.
44
+ * @param input.entries - The example entries to index.
45
+ * @param input.loadedSources - Labels of the manifest sources that contributed the entries.
46
+ * @returns A registry with slug, category, module, and related-slug indices.
47
+ * @__NO_SIDE_EFFECTS__
48
+ */
49
+ export declare function createDbxDocsUiExamplesRegistryFromEntries(input: {
50
+ readonly entries: readonly DbxDocsUiExampleEntry[];
51
+ readonly loadedSources: readonly string[];
52
+ }): DbxDocsUiExamplesRegistry;
53
+ /**
54
+ * Empty registry suitable as a default when no example manifests are
55
+ * configured. Tools wired against this behave like an empty cluster —
56
+ * "no examples" rather than crashing.
57
+ */
58
+ export declare const EMPTY_DBX_DOCS_UI_EXAMPLES_REGISTRY: DbxDocsUiExamplesRegistry;
@@ -0,0 +1,93 @@
1
+ /**
2
+ * Runtime cache for downstream `<x>-firebase` model catalogs.
3
+ *
4
+ * `dbx_model_search` and `dbx_model_lookup` consult this cache after the
5
+ * upstream `FIREBASE_MODELS` registry to extend their reach into the
6
+ * caller's workspace. The first call performs discovery + extraction; the
7
+ * result is memoised for the server lifetime keyed by
8
+ * (workspaceRoot, componentDirs).
9
+ *
10
+ * No mtime-based invalidation — the agent loop is short enough that a stale
11
+ * catalog after an in-flight downstream model edit is fixed by reconnecting
12
+ * the MCP server. That mirrors the upstream registry, which is baked at
13
+ * build time and never refreshed at runtime.
14
+ */
15
+ import { type DownstreamFirebasePackage } from '../scan/discover-firebase-packages.js';
16
+ import type { FirebaseModel, FirebaseModelGroup } from './firebase-models.js';
17
+ /**
18
+ * One per-package extraction failure. Surfaced so a malformed downstream
19
+ * package doesn't silently drop without a trace.
20
+ */
21
+ export interface DownstreamCatalogError {
22
+ /**
23
+ * Workspace-relative component directory the failure occurred under.
24
+ */
25
+ readonly componentDir: string;
26
+ /**
27
+ * Workspace-relative source file path when the failure was tied to a
28
+ * single file; equal to `componentDir` for whole-package failures.
29
+ */
30
+ readonly sourceFile: string;
31
+ /**
32
+ * Human-readable failure message.
33
+ */
34
+ readonly message: string;
35
+ }
36
+ /**
37
+ * Aggregated downstream catalog for a workspace + componentDirs scope.
38
+ */
39
+ export interface DownstreamCatalog {
40
+ /**
41
+ * Every detected downstream model, sorted root-first then alphabetically.
42
+ */
43
+ readonly models: readonly FirebaseModel[];
44
+ /**
45
+ * Every detected downstream model-group container.
46
+ */
47
+ readonly modelGroups: readonly FirebaseModelGroup[];
48
+ /**
49
+ * The packages the catalog was assembled from. Includes packages that
50
+ * produced zero models (kept so the formatter can report what was
51
+ * scanned).
52
+ */
53
+ readonly packages: readonly DownstreamFirebasePackage[];
54
+ /**
55
+ * Per-package extraction failures, if any.
56
+ */
57
+ readonly errors: readonly DownstreamCatalogError[];
58
+ /**
59
+ * `true` when the catalog was built via auto-discovery (no
60
+ * `componentDirs` override). The search formatter uses this to render
61
+ * the "no downstream packages discovered" hint.
62
+ */
63
+ readonly discoveryUsed: boolean;
64
+ }
65
+ /**
66
+ * Input for {@link getDownstreamCatalog}.
67
+ */
68
+ export interface GetDownstreamCatalogInput {
69
+ /**
70
+ * Absolute workspace root the scan should run against.
71
+ */
72
+ readonly workspaceRoot: string;
73
+ /**
74
+ * Optional explicit component directories (workspace-relative). When
75
+ * supplied, discovery is skipped and only these directories are scanned.
76
+ * When omitted, `components/*-firebase` is auto-discovered.
77
+ */
78
+ readonly componentDirs?: readonly string[];
79
+ }
80
+ /**
81
+ * Returns the downstream catalog for the supplied workspace + dirs scope.
82
+ * Cached for the server lifetime. Concurrent callers get the same in-flight
83
+ * promise and share the underlying ts-morph parses.
84
+ *
85
+ * @param input - The scope to scan.
86
+ * @returns The assembled downstream catalog.
87
+ */
88
+ export declare function getDownstreamCatalog(input: GetDownstreamCatalogInput): Promise<DownstreamCatalog>;
89
+ /**
90
+ * Drops every cached entry. Intended for spec use only — the runtime
91
+ * never needs to call this because the cache is server-lifetime.
92
+ */
93
+ export declare function clearDownstreamCatalogCache(): void;
@@ -0,0 +1,128 @@
1
+ /**
2
+ * Filters runtime registry wrapper.
3
+ *
4
+ * Wraps the raw {@link LoadFilterManifestsResult} produced by the loader with
5
+ * domain-friendly accessors so the lookup tool and the registry resource
6
+ * don't have to walk Maps directly.
7
+ *
8
+ * The registry is loaded once at server startup and passed into the tool
9
+ * factories. Tests can construct a registry from any entry array via
10
+ * {@link createFilterRegistryFromEntries} to drive the tool without touching
11
+ * disk.
12
+ *
13
+ * Manifest entries (flat, JSON-friendly shape) are converted into the
14
+ * `FilterEntryInfo` shape historically exposed by `tools/data/filter-entries.ts`.
15
+ * The lookup tool keeps consuming that shape so this module is the only seam
16
+ * that changed when the hand-written entries were deleted.
17
+ */
18
+ import type { LoadFilterManifestsResult } from '../manifest/filters-loader.js';
19
+ import type { FilterEntry } from '../manifest/filters-schema.js';
20
+ /**
21
+ * Discriminator between Angular directives (`[dbxFilter*]`) and shape-only
22
+ * patterns (`ClickableFilterPreset`). Mirrors the legacy `FilterEntryKind`
23
+ * exposed by `tools/data/filter-entries.ts`.
24
+ */
25
+ export type FilterKind = 'directive' | 'pattern';
26
+ /**
27
+ * One documented input on a filter directive — alias, type, description.
28
+ */
29
+ export interface FilterEntryInputInfo {
30
+ readonly name: string;
31
+ readonly type: string;
32
+ readonly description: string;
33
+ }
34
+ /**
35
+ * One curated filter entry surfaced through `dbx_filter_lookup`. Mirrors the
36
+ * legacy hand-written shape so the lookup tool didn't have to be rewritten
37
+ * when the manifest pipeline replaced the inline data table.
38
+ */
39
+ export interface FilterEntryInfo {
40
+ readonly slug: string;
41
+ readonly kind: FilterKind;
42
+ readonly className: string;
43
+ readonly selector: string | undefined;
44
+ readonly module: string;
45
+ readonly description: string;
46
+ readonly inputs: readonly FilterEntryInputInfo[];
47
+ readonly outputs: readonly FilterEntryInputInfo[];
48
+ readonly relatedSlugs: readonly string[];
49
+ readonly skillRefs: readonly string[];
50
+ readonly example: string;
51
+ }
52
+ /**
53
+ * Domain-friendly read API over a merged filters manifest set. All accessors
54
+ * return readonly arrays preserving the order the manifests declared their
55
+ * entries (manifests are walked in source order).
56
+ */
57
+ export interface FilterRegistry {
58
+ readonly all: readonly FilterEntryInfo[];
59
+ readonly loadedSources: readonly string[];
60
+ readonly kinds: readonly FilterKind[];
61
+ /**
62
+ * Returns the entry whose slug matches `slug` exactly. Slugs are unique
63
+ * across manifests (collisions emit a loader warning and the second-loaded
64
+ * entry wins).
65
+ */
66
+ findBySlug(slug: string): FilterEntryInfo | undefined;
67
+ /**
68
+ * Returns the entry whose TypeScript class name matches `className`
69
+ * (case-insensitive).
70
+ */
71
+ findByClassName(className: string): FilterEntryInfo | undefined;
72
+ /**
73
+ * Returns the directive entry whose `selector` matches `selector`. The
74
+ * lookup tolerates the `[dbxFoo]` attribute form and the bracket-less
75
+ * `dbxFoo` form so callers can use whichever syntax their host context
76
+ * renders.
77
+ */
78
+ findBySelector(selector: string): FilterEntryInfo | undefined;
79
+ /**
80
+ * Returns every entry whose `kind` field matches `kind` exactly, in
81
+ * registry order.
82
+ */
83
+ findByKind(kind: FilterKind): readonly FilterEntryInfo[];
84
+ }
85
+ /**
86
+ * Stable rendering order for kind buckets in the catalog view.
87
+ */
88
+ export declare const FILTER_KIND_ORDER: readonly FilterKind[];
89
+ /**
90
+ * Builds a {@link FilterRegistry} from a loader result.
91
+ *
92
+ * @param loaded - The merged registry returned by `loadFilterManifests`
93
+ * @returns A domain-friendly read API over the merged entries.
94
+ *
95
+ * @__NO_SIDE_EFFECTS__
96
+ */
97
+ export declare function createFilterRegistry(loaded: LoadFilterManifestsResult): FilterRegistry;
98
+ /**
99
+ * Builds a {@link FilterRegistry} from a raw {@link FilterEntryInfo} array.
100
+ * Used by tests that need to drive the tool without going through the loader
101
+ * pipeline.
102
+ *
103
+ * @param input - The entries plus the source labels to advertise.
104
+ * @param input.entries - The full entry list.
105
+ * @param input.loadedSources - Source labels reported via `registry.loadedSources`
106
+ * @returns A domain-friendly read API over the supplied entries.
107
+ *
108
+ * @__NO_SIDE_EFFECTS__
109
+ */
110
+ export declare function createFilterRegistryFromEntries(input: {
111
+ readonly entries: readonly FilterEntryInfo[];
112
+ readonly loadedSources: readonly string[];
113
+ }): FilterRegistry;
114
+ /**
115
+ * Empty registry suitable as a default when the server has no filters
116
+ * manifest sources to load. Tools wired against this registry behave like
117
+ * a registry that loaded successfully with zero entries.
118
+ */
119
+ export declare const EMPTY_FILTER_REGISTRY: FilterRegistry;
120
+ /**
121
+ * Converts a manifest entry into the {@link FilterEntryInfo} shape the lookup
122
+ * tool consumes. Pattern entries (no `@Directive` decorator) carry an
123
+ * `undefined` selector and empty inputs/outputs.
124
+ *
125
+ * @param entry - The manifest entry to convert.
126
+ * @returns The matching FilterEntryInfo.
127
+ */
128
+ export declare function toFilterEntryInfo(entry: FilterEntry): FilterEntryInfo;