@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,81 @@
1
+ /**
2
+ * Semantic-types registry wrapper.
3
+ *
4
+ * Wraps the raw {@link LoadSemanticTypeManifestsResult} produced by the
5
+ * loader with domain-friendly accessors so the lookup / search tools and
6
+ * the registry resource don't have to walk Maps directly.
7
+ *
8
+ * The registry is loaded once at server startup (see Step 6) and passed
9
+ * into the tool factories. Tests can construct a registry from any
10
+ * `SemanticTypeEntry` array via {@link createSemanticTypeRegistryFromEntries}
11
+ * to drive the tools without touching disk.
12
+ */
13
+ import type { LoadSemanticTypeManifestsResult } from '../manifest/loader.js';
14
+ import type { SemanticTypeEntry } from '../manifest/semantic-types-schema.js';
15
+ /**
16
+ * Domain-friendly read API over a merged semantic-types manifest set. All
17
+ * accessors return readonly arrays sorted by name to keep tool output
18
+ * deterministic.
19
+ */
20
+ export interface SemanticTypeRegistry {
21
+ readonly all: readonly SemanticTypeEntry[];
22
+ readonly loadedSources: readonly string[];
23
+ readonly topics: readonly string[];
24
+ readonly packages: readonly string[];
25
+ readonly baseTypes: readonly string[];
26
+ /**
27
+ * Returns every entry that matches `name` exactly. Names are case-sensitive.
28
+ */
29
+ findByName(name: string): readonly SemanticTypeEntry[];
30
+ /**
31
+ * Returns every entry tagged with `topic`. Topics are case-sensitive.
32
+ */
33
+ findByTopic(topic: string): readonly SemanticTypeEntry[];
34
+ /**
35
+ * Returns every entry whose `package` field matches `packageLabel` exactly.
36
+ */
37
+ findByPackage(packageLabel: string): readonly SemanticTypeEntry[];
38
+ /**
39
+ * Returns every entry whose `baseType` matches `baseType` exactly.
40
+ */
41
+ findByBaseType(baseType: string): readonly SemanticTypeEntry[];
42
+ /**
43
+ * Substring search across `name`, `module`, and `definition`. Case-
44
+ * insensitive.
45
+ */
46
+ findByQuery(query: string): readonly SemanticTypeEntry[];
47
+ }
48
+ /**
49
+ * Builds a {@link SemanticTypeRegistry} from a loader result. The wrapper
50
+ * keeps a single sorted-by-name copy of every entry plus pre-computed
51
+ * topic / package / baseType buckets so each lookup is O(n) at worst and
52
+ * subsequent calls hit the cached bucket lists.
53
+ *
54
+ * @param loaded - The merged registry returned by `loadSemanticTypeManifests`
55
+ * @returns A domain-friendly read API over the merged entries.
56
+ *
57
+ * @__NO_SIDE_EFFECTS__
58
+ */
59
+ export declare function createSemanticTypeRegistry(loaded: LoadSemanticTypeManifestsResult): SemanticTypeRegistry;
60
+ /**
61
+ * Builds a {@link SemanticTypeRegistry} from a raw entry array. Used by tests
62
+ * that need to drive the tools without going through the loader pipeline.
63
+ *
64
+ * @param input - The entries plus the source labels to advertise.
65
+ * @param input.entries - The full entry list (will be sorted by name)
66
+ * @param input.loadedSources - Source labels reported via `registry.loadedSources`
67
+ * @returns A domain-friendly read API over the supplied entries.
68
+ *
69
+ * @__NO_SIDE_EFFECTS__
70
+ */
71
+ export declare function createSemanticTypeRegistryFromEntries(input: {
72
+ readonly entries: readonly SemanticTypeEntry[];
73
+ readonly loadedSources: readonly string[];
74
+ }): SemanticTypeRegistry;
75
+ /**
76
+ * Empty registry suitable as a default when the server has no manifest
77
+ * sources to load. Tools wired against this registry behave like a
78
+ * registry that loaded successfully with zero entries — they emit
79
+ * "no results" responses rather than crashing.
80
+ */
81
+ export declare const EMPTY_SEMANTIC_TYPE_REGISTRY: SemanticTypeRegistry;
@@ -0,0 +1,96 @@
1
+ /**
2
+ * Tokens runtime registry wrapper.
3
+ *
4
+ * Wraps the raw {@link LoadTokenManifestsResult} produced by the tokens
5
+ * loader with domain-friendly accessors so `dbx_css_token_lookup` and
6
+ * `dbx_ui_smell_check` 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 `TokenEntry` array via
10
+ * {@link createTokenRegistryFromEntries} to drive the tools without
11
+ * touching disk.
12
+ */
13
+ import type { LoadTokenManifestsResult } from '../manifest/tokens-loader.js';
14
+ import type { TokenEntry } from '../manifest/tokens-schema.js';
15
+ /**
16
+ * One scored candidate produced by the registry's intent / value matching
17
+ * helpers. `score` is a non-normalised non-negative number — higher means
18
+ * more confident — that the calling tool uses for top-N truncation and
19
+ * cross-resolver tie-breaking.
20
+ */
21
+ export interface ScoredTokenMatch {
22
+ readonly entry: TokenEntry;
23
+ readonly score: number;
24
+ }
25
+ /**
26
+ * Domain-friendly read API over a merged token-manifest set. All accessors
27
+ * return readonly arrays sorted by `cssVariable` so tool output stays
28
+ * deterministic across runs.
29
+ */
30
+ export interface TokenRegistry {
31
+ readonly all: readonly TokenEntry[];
32
+ readonly loadedSources: readonly string[];
33
+ readonly bySource: ReadonlyMap<string, readonly TokenEntry[]>;
34
+ readonly byRole: ReadonlyMap<string, readonly TokenEntry[]>;
35
+ /**
36
+ * Returns the first entry whose `cssVariable` matches `name` (case-sensitive
37
+ * — CSS custom property names are case-sensitive).
38
+ */
39
+ findByCssVariable(name: string): TokenEntry | undefined;
40
+ /**
41
+ * Returns the first entry whose `scssVariable` matches `name`.
42
+ */
43
+ findByScssVariable(name: string): TokenEntry | undefined;
44
+ /**
45
+ * Returns scored candidates whose `intents[]` array contains a string that
46
+ * matches `query` (case-insensitive substring). Optional `role` filter
47
+ * narrows the candidate pool before scoring.
48
+ */
49
+ findByIntent(query: string, role?: string): readonly ScoredTokenMatch[];
50
+ /**
51
+ * Returns scored candidates whose `defaults.{light,dark}` matches the
52
+ * supplied raw CSS value via the substring-match fallback. Tools with
53
+ * domain-specific value parsing (OKLCH color distance, length tolerance,
54
+ * shadow layers) implement their own scoring on top of `all`.
55
+ */
56
+ findByValue(value: string, role?: string): readonly ScoredTokenMatch[];
57
+ /**
58
+ * Returns every entry whose `componentScope` matches the supplied
59
+ * Angular Material slug exactly (e.g. `mat-progress-bar`).
60
+ */
61
+ findByComponent(component: string): readonly TokenEntry[];
62
+ }
63
+ /**
64
+ * Builds a {@link TokenRegistry} from a loader result. The wrapper keeps a
65
+ * single sorted-by-`cssVariable` copy of every entry plus pre-computed
66
+ * source / role buckets so each lookup is O(n) at worst and subsequent
67
+ * calls hit the cached bucket lists.
68
+ *
69
+ * @param loaded - The merged registry returned by `loadTokenManifests`
70
+ * @returns A domain-friendly read API over the merged entries.
71
+ *
72
+ * @__NO_SIDE_EFFECTS__
73
+ */
74
+ export declare function createTokenRegistry(loaded: LoadTokenManifestsResult): TokenRegistry;
75
+ /**
76
+ * Builds a {@link TokenRegistry} from a raw entry array. Used by tests and
77
+ * by callers that want to drive the tools without going through the loader
78
+ * pipeline.
79
+ *
80
+ * @param input - The entries plus the source labels to advertise.
81
+ * @param input.entries - The full entry list (will be sorted by cssVariable)
82
+ * @param input.loadedSources - Source labels reported via `registry.loadedSources`
83
+ * @returns A domain-friendly read API over the supplied entries.
84
+ *
85
+ * @__NO_SIDE_EFFECTS__
86
+ */
87
+ export declare function createTokenRegistryFromEntries(input: {
88
+ readonly entries: readonly TokenEntry[];
89
+ readonly loadedSources: readonly string[];
90
+ }): TokenRegistry;
91
+ /**
92
+ * Empty registry suitable as a default when the server has no manifest
93
+ * sources to load. Tools wired against this behave like a registry that
94
+ * loaded successfully with zero entries.
95
+ */
96
+ export declare const EMPTY_TOKEN_REGISTRY: TokenRegistry;
@@ -0,0 +1,90 @@
1
+ /**
2
+ * UI components runtime registry wrapper.
3
+ *
4
+ * Wraps the raw {@link LoadUiComponentManifestsResult} produced by the
5
+ * loader with domain-friendly accessors so the lookup / search tools and
6
+ * the registry resource 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 `UiComponentEntry`
10
+ * array via {@link createUiComponentRegistryFromEntries} to drive the
11
+ * tools without touching disk.
12
+ */
13
+ import type { LoadUiComponentManifestsResult } from '../manifest/ui-components-loader.js';
14
+ import type { UiComponentEntry } from '../manifest/ui-components-schema.js';
15
+ /**
16
+ * Domain-friendly read API over a merged ui-components manifest set. All
17
+ * accessors return readonly arrays sorted by slug to keep tool output
18
+ * deterministic.
19
+ */
20
+ export interface UiComponentRegistry {
21
+ readonly all: readonly UiComponentEntry[];
22
+ readonly loadedSources: readonly string[];
23
+ readonly categories: readonly string[];
24
+ readonly kinds: readonly string[];
25
+ readonly modules: readonly string[];
26
+ /**
27
+ * Returns every entry whose slug matches `slug` exactly. Slugs are
28
+ * case-sensitive.
29
+ */
30
+ findBySlug(slug: string): readonly UiComponentEntry[];
31
+ /**
32
+ * Returns every entry whose `category` field matches exactly. Categories
33
+ * are case-sensitive.
34
+ */
35
+ findByCategory(category: string): readonly UiComponentEntry[];
36
+ /**
37
+ * Returns every entry whose `kind` field matches exactly.
38
+ */
39
+ findByKind(kind: string): readonly UiComponentEntry[];
40
+ /**
41
+ * Returns the entry whose `selector` includes the supplied string as
42
+ * one of its comma-separated tokens. Selector tokens are matched
43
+ * verbatim including the bracket form (`[dbxAction]`).
44
+ */
45
+ findBySelector(selector: string): UiComponentEntry | undefined;
46
+ /**
47
+ * Returns the entry whose `className` matches the supplied string
48
+ * (case-insensitive).
49
+ */
50
+ findByClassName(className: string): UiComponentEntry | undefined;
51
+ /**
52
+ * Substring search across `slug`, `selector`, `className`, and
53
+ * `description`. Case-insensitive.
54
+ */
55
+ findByQuery(query: string): readonly UiComponentEntry[];
56
+ }
57
+ /**
58
+ * Builds a {@link UiComponentRegistry} from a loader result. The wrapper
59
+ * keeps a single sorted-by-slug copy of every entry plus pre-computed
60
+ * category / kind / module buckets so each lookup is O(n) at worst and
61
+ * subsequent calls hit the cached bucket lists.
62
+ *
63
+ * @param loaded - The merged registry returned by `loadUiComponentManifests`
64
+ * @returns A domain-friendly read API over the merged entries.
65
+ *
66
+ * @__NO_SIDE_EFFECTS__
67
+ */
68
+ export declare function createUiComponentRegistry(loaded: LoadUiComponentManifestsResult): UiComponentRegistry;
69
+ /**
70
+ * Builds a {@link UiComponentRegistry} from a raw entry array. Used by tests
71
+ * that need to drive the tools without going through the loader pipeline.
72
+ *
73
+ * @param input - The entries plus the source labels to advertise.
74
+ * @param input.entries - The full entry list (will be sorted by slug)
75
+ * @param input.loadedSources - Source labels reported via `registry.loadedSources`
76
+ * @returns A domain-friendly read API over the supplied entries.
77
+ *
78
+ * @__NO_SIDE_EFFECTS__
79
+ */
80
+ export declare function createUiComponentRegistryFromEntries(input: {
81
+ readonly entries: readonly UiComponentEntry[];
82
+ readonly loadedSources: readonly string[];
83
+ }): UiComponentRegistry;
84
+ /**
85
+ * Empty registry suitable as a default when the server has no manifest
86
+ * sources to load. Tools wired against this registry behave like a
87
+ * registry that loaded successfully with zero entries — they emit
88
+ * "no results" responses rather than crashing.
89
+ */
90
+ export declare const EMPTY_UI_COMPONENT_REGISTRY: UiComponentRegistry;
@@ -0,0 +1,136 @@
1
+ /**
2
+ * Utils runtime registry wrapper.
3
+ *
4
+ * Wraps the raw {@link LoadUtilManifestsResult} produced by the loader with
5
+ * domain-friendly accessors so the lookup/search tools and the registry
6
+ * resource 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 createUtilRegistryFromEntries} to drive the tools without touching
11
+ * disk.
12
+ */
13
+ import type { LoadUtilManifestsResult } from '../manifest/utils-loader.js';
14
+ import type { UtilEntry } from '../manifest/utils-schema.js';
15
+ /**
16
+ * Closed kind vocabulary describing the shape of one utility entry.
17
+ */
18
+ export type UtilKind = 'function' | 'class' | 'const' | 'factory';
19
+ /**
20
+ * One documented parameter of a function/factory utility, or one
21
+ * constructor parameter for a class utility.
22
+ */
23
+ export interface UtilParamInfo {
24
+ readonly name: string;
25
+ readonly type: string;
26
+ readonly description: string;
27
+ readonly optional: boolean;
28
+ }
29
+ /**
30
+ * One curated utility entry surfaced through the `dbx_util_*` tools.
31
+ *
32
+ * Mirrors {@link UtilEntry} but normalises optional manifest fields to
33
+ * empty arrays so callers (lookup, search, resources) don't have to
34
+ * defensively branch.
35
+ */
36
+ export interface UtilEntryInfo {
37
+ readonly slug: string;
38
+ readonly name: string;
39
+ readonly kind: UtilKind;
40
+ readonly category: string;
41
+ readonly module: string;
42
+ readonly subpath: string;
43
+ readonly signature: string;
44
+ readonly description: string;
45
+ readonly params: readonly UtilParamInfo[];
46
+ readonly returns: string;
47
+ readonly tags: readonly string[];
48
+ readonly example: string;
49
+ readonly relatedSlugs: readonly string[];
50
+ readonly skillRefs: readonly string[];
51
+ readonly deprecated: boolean | string;
52
+ readonly since: string;
53
+ }
54
+ /**
55
+ * Domain-friendly read API over a merged utils manifest set. All accessors
56
+ * return readonly arrays preserving the order the manifests declared their
57
+ * entries (manifests are walked in source order).
58
+ */
59
+ export interface UtilRegistry {
60
+ readonly all: readonly UtilEntryInfo[];
61
+ readonly loadedSources: readonly string[];
62
+ readonly categories: readonly string[];
63
+ readonly modules: readonly string[];
64
+ /**
65
+ * Returns the entry whose slug matches `slug` exactly. Slugs are unique
66
+ * across manifests (collisions emit a loader warning and the
67
+ * second-loaded entry wins).
68
+ */
69
+ findBySlug(slug: string): UtilEntryInfo | undefined;
70
+ /**
71
+ * Returns the entry whose exported identifier matches `name`. Lookup is
72
+ * case-sensitive — most utility names are camelCase.
73
+ */
74
+ findByName(name: string): UtilEntryInfo | undefined;
75
+ /**
76
+ * Returns the entry whose exported identifier matches `name`
77
+ * case-insensitively. Falls back to the case-sensitive path first to
78
+ * keep camelCase hits prioritised.
79
+ */
80
+ findByNameInsensitive(name: string): UtilEntryInfo | undefined;
81
+ /**
82
+ * Returns every entry whose `category` field matches `category` exactly,
83
+ * in registry order.
84
+ */
85
+ findByCategory(category: string): readonly UtilEntryInfo[];
86
+ /**
87
+ * Returns every entry whose `module` field matches `module` exactly, in
88
+ * registry order.
89
+ */
90
+ findByModule(module: string): readonly UtilEntryInfo[];
91
+ /**
92
+ * Returns every entry whose `tags` array includes `tag` (case-sensitive,
93
+ * tags are stored lowercased), in registry order.
94
+ */
95
+ findByTag(tag: string): readonly UtilEntryInfo[];
96
+ }
97
+ /**
98
+ * Builds a {@link UtilRegistry} from a loader result.
99
+ *
100
+ * @param loaded - The merged registry returned by `loadUtilManifests`
101
+ * @returns A domain-friendly read API over the merged entries.
102
+ *
103
+ * @__NO_SIDE_EFFECTS__
104
+ */
105
+ export declare function createUtilRegistry(loaded: LoadUtilManifestsResult): UtilRegistry;
106
+ /**
107
+ * Builds a {@link UtilRegistry} from a raw {@link UtilEntryInfo} array.
108
+ * Used by tests that need to drive the tools without going through the
109
+ * loader pipeline.
110
+ *
111
+ * @param input - The entries plus the source labels to advertise.
112
+ * @param input.entries - The full entry list.
113
+ * @param input.loadedSources - Source labels reported via `registry.loadedSources`
114
+ * @returns A domain-friendly read API over the supplied entries.
115
+ *
116
+ * @__NO_SIDE_EFFECTS__
117
+ */
118
+ export declare function createUtilRegistryFromEntries(input: {
119
+ readonly entries: readonly UtilEntryInfo[];
120
+ readonly loadedSources: readonly string[];
121
+ }): UtilRegistry;
122
+ /**
123
+ * Empty registry suitable as a default when the server has no utils
124
+ * manifest sources to load. Tools wired against this registry behave like
125
+ * a registry that loaded successfully with zero entries.
126
+ */
127
+ export declare const EMPTY_UTIL_REGISTRY: UtilRegistry;
128
+ /**
129
+ * Converts a manifest entry into the {@link UtilEntryInfo} shape the
130
+ * lookup/search tools consume. Optional manifest fields fall back to safe
131
+ * defaults so a partially-populated entry still renders cleanly.
132
+ *
133
+ * @param entry - The manifest entry to convert.
134
+ * @returns The matching UtilEntryInfo.
135
+ */
136
+ export declare function toUtilEntryInfo(entry: UtilEntry): UtilEntryInfo;
@@ -0,0 +1,245 @@
1
+ /**
2
+ * Shared infrastructure for the `*-extract.ts` modules that walk a ts-morph
3
+ * `Project` looking for JSDoc-tagged exports.
4
+ *
5
+ * Each per-domain extractor (utils, model-snapshot-fields, …) repeats the
6
+ * same scaffolding: pull every exported function/class/variable statement,
7
+ * check whether it carries a domain-specific JSDoc marker tag, normalise the
8
+ * tag list, parse common JSDoc fields (summary, params, returns, examples,
9
+ * deprecated/since), extract parameter declarations, and derive a default
10
+ * kebab-case slug + category from the source file's path.
11
+ *
12
+ * Lifting that scaffolding here keeps each per-domain extractor focused on
13
+ * its domain-specific differences (marker names, kind union, optional field
14
+ * derivation, …) instead of repeating the AST plumbing.
15
+ */
16
+ import { type ClassDeclaration, type FunctionDeclaration, type JSDoc, type ParameterDeclaration, type SourceFile, type VariableDeclaration, type VariableStatement } from 'ts-morph';
17
+ /**
18
+ * Tagged exported function declaration. The `decl` is the implementation
19
+ * (ts-morph returns only the impl for overloaded functions); `jsDocs` may
20
+ * include docs aggregated from overload signatures when the collector ran
21
+ * with `includeOverloadDocs: true`.
22
+ */
23
+ export interface TaggedExportFunctionCandidate {
24
+ readonly kind: 'function';
25
+ readonly decl: FunctionDeclaration;
26
+ readonly jsDocs: readonly JSDoc[];
27
+ }
28
+ /**
29
+ * Tagged exported class declaration. Only emitted when
30
+ * {@link collectTaggedExports} was called with `includeClasses: true`.
31
+ */
32
+ export interface TaggedExportClassCandidate {
33
+ readonly kind: 'class';
34
+ readonly decl: ClassDeclaration;
35
+ readonly jsDocs: readonly JSDoc[];
36
+ }
37
+ /**
38
+ * Tagged exported variable declaration. Emitted once per declaration in an
39
+ * `export const x = …, y = …` statement; `statement` is the enclosing
40
+ * VariableStatement so callers can read its JSDoc and source position.
41
+ */
42
+ export interface TaggedExportVariableCandidate {
43
+ readonly kind: 'variable';
44
+ readonly statement: VariableStatement;
45
+ readonly decl: VariableDeclaration;
46
+ readonly jsDocs: readonly JSDoc[];
47
+ }
48
+ /**
49
+ * Discriminated union over the three tagged-export shapes the per-domain
50
+ * extractors care about. Helpers below operate on the wider union; per-
51
+ * domain extractors typically narrow to `function | variable` by not
52
+ * enabling `includeClasses`.
53
+ */
54
+ export type TaggedExportCandidate = TaggedExportFunctionCandidate | TaggedExportClassCandidate | TaggedExportVariableCandidate;
55
+ /**
56
+ * Returns the original JSDoc list when at least one tag in any doc has
57
+ * `tagName === markerName`, otherwise an empty array. Used by the per-
58
+ * collector helpers below to skip undecorated exports cheaply.
59
+ *
60
+ * @param jsDocs - The JSDocs attached to an exported declaration.
61
+ * @param markerName - The marker tag name (without `@`, e.g. `'dbxUtil'`).
62
+ * @returns The input docs when the marker was found, else `[]`.
63
+ */
64
+ export declare function findTaggedDocs(jsDocs: readonly JSDoc[], markerName: string): readonly JSDoc[];
65
+ /**
66
+ * Options for {@link collectTaggedFunctions}.
67
+ */
68
+ export interface CollectTaggedFunctionsOptions {
69
+ /**
70
+ * When `true`, JSDoc from overload signatures is merged with the
71
+ * implementation's JSDoc (overloads are where authors typically put
72
+ * `@param` and `@returns`). Defaults to `false`.
73
+ */
74
+ readonly includeOverloadDocs?: boolean;
75
+ }
76
+ /**
77
+ * Collects exported function declarations whose JSDoc carries `markerName`.
78
+ *
79
+ * @param sourceFile - The ts-morph source file to scan.
80
+ * @param markerName - The marker tag name (e.g. `'dbxUtil'`).
81
+ * @param options - Optional flags (see {@link CollectTaggedFunctionsOptions}).
82
+ * @returns The tagged function candidates in source order.
83
+ */
84
+ export declare function collectTaggedFunctions(sourceFile: SourceFile, markerName: string, options?: CollectTaggedFunctionsOptions): readonly TaggedExportFunctionCandidate[];
85
+ /**
86
+ * Collects exported class declarations whose JSDoc carries `markerName`.
87
+ *
88
+ * @param sourceFile - The ts-morph source file to scan.
89
+ * @param markerName - The marker tag name.
90
+ * @returns The tagged class candidates in source order.
91
+ */
92
+ export declare function collectTaggedClasses(sourceFile: SourceFile, markerName: string): readonly TaggedExportClassCandidate[];
93
+ /**
94
+ * Collects exported variable declarations whose enclosing
95
+ * `VariableStatement`'s JSDoc carries `markerName`. Emits one candidate per
96
+ * declaration in a comma-separated `export const a = …, b = …` statement.
97
+ *
98
+ * @param sourceFile - The ts-morph source file to scan.
99
+ * @param markerName - The marker tag name.
100
+ * @returns The tagged variable candidates in source order.
101
+ */
102
+ export declare function collectTaggedVariables(sourceFile: SourceFile, markerName: string): readonly TaggedExportVariableCandidate[];
103
+ /**
104
+ * Options for {@link collectTaggedExports}.
105
+ */
106
+ export interface CollectTaggedExportsOptions {
107
+ /**
108
+ * When `true`, exported classes carrying `markerName` are included.
109
+ * Defaults to `false` — most per-domain extractors only care about
110
+ * function and variable exports.
111
+ */
112
+ readonly includeClasses?: boolean;
113
+ /**
114
+ * Forwarded to {@link collectTaggedFunctions}. Defaults to `false`.
115
+ */
116
+ readonly includeOverloadDocs?: boolean;
117
+ }
118
+ /**
119
+ * Source-position of a candidate, used by {@link collectTaggedExports} to
120
+ * sort the combined output in source order.
121
+ *
122
+ * @param candidate - The tagged-export candidate to position.
123
+ * @returns The 0-based start offset within the source file.
124
+ */
125
+ export declare function candidateSourceStart(candidate: TaggedExportCandidate): number;
126
+ /**
127
+ * Combines the per-kind collectors and returns the candidates in source
128
+ * order.
129
+ *
130
+ * @param sourceFile - The ts-morph source file to scan.
131
+ * @param markerName - The marker tag name.
132
+ * @param options - Optional flags (see {@link CollectTaggedExportsOptions}).
133
+ * @returns The combined candidate list in source order.
134
+ */
135
+ export declare function collectTaggedExports(sourceFile: SourceFile, markerName: string, options?: CollectTaggedExportsOptions): readonly TaggedExportCandidate[];
136
+ /**
137
+ * Callback bundle for {@link walkJsDocs}.
138
+ */
139
+ export interface JsDocTagHandlers {
140
+ /**
141
+ * Invoked once per JSDoc block whose description text (the prose above
142
+ * the tag list) is non-empty.
143
+ */
144
+ readonly onSummary: (summary: string) => void;
145
+ /**
146
+ * Invoked once per `@param` tag with the documented parameter name and
147
+ * its description text (both trimmed; `paramName` is `undefined`-filtered
148
+ * before the callback so it's always a non-empty string).
149
+ */
150
+ readonly onParam: (paramName: string, text: string) => void;
151
+ /**
152
+ * Invoked once per non-`@param` tag.
153
+ */
154
+ readonly onTag: (tagName: string, text: string) => void;
155
+ }
156
+ /**
157
+ * Walks a list of JSDoc blocks, dispatching descriptions, `@param` tags,
158
+ * and the remaining tags to the supplied callbacks.
159
+ *
160
+ * @param jsDocs - The JSDocs to walk.
161
+ * @param handlers - The summary/param/tag callbacks.
162
+ */
163
+ export declare function walkJsDocs(jsDocs: readonly JSDoc[], handlers: JsDocTagHandlers): void;
164
+ /**
165
+ * Best-effort extraction of the parameter name from a raw `@param ...` tag
166
+ * text when ts-morph's typed accessor isn't available (older AST shapes).
167
+ *
168
+ * @param rawTag - The raw `@param` tag text.
169
+ * @returns The parameter name, or `undefined` when the tag doesn't match.
170
+ */
171
+ export declare function extractParamNameFromRawTag(rawTag: string): string | undefined;
172
+ /**
173
+ * Shared parameter shape produced by {@link extractCandidateParams}.
174
+ * Matches the structure of both `UtilParamEntry` and
175
+ * `ModelSnapshotFieldParamEntry` so per-domain extractors can pass it
176
+ * straight through.
177
+ */
178
+ export interface ExtractedParam {
179
+ readonly name: string;
180
+ readonly type: string;
181
+ readonly description: string;
182
+ readonly optional: boolean;
183
+ }
184
+ /**
185
+ * Returns the parameter declarations for a candidate. For functions, this
186
+ * is the impl's parameter list; for classes, the first constructor's; for
187
+ * variables initialized with an arrow function or function expression, the
188
+ * initializer's. Otherwise (a plain `const` like
189
+ * `firestorePassthroughField`), an empty list.
190
+ *
191
+ * @param candidate - The candidate to inspect.
192
+ * @returns The parameter declarations, possibly empty.
193
+ */
194
+ export declare function getCandidateParameters(candidate: TaggedExportCandidate): readonly ParameterDeclaration[];
195
+ /**
196
+ * Reads a candidate's parameters, pairing each with its JSDoc-`@param`
197
+ * description (or empty string when none was documented).
198
+ *
199
+ * @param candidate - The candidate whose parameters to extract.
200
+ * @param descriptions - Map from parameter name to its `@param` text.
201
+ * @returns The extracted parameter list.
202
+ */
203
+ export declare function extractCandidateParams(candidate: TaggedExportCandidate, descriptions: ReadonlyMap<string, string>): readonly ExtractedParam[];
204
+ /**
205
+ * Converts an export name into its kebab-case slug form. Handles
206
+ * camelCase (`expirationDetails` → `expiration-details`), PascalCase
207
+ * (`ExpirationDetails` → `expiration-details`), and SCREAMING_SNAKE_CASE
208
+ * (`FIRESTORE_PASSTHROUGH_FIELD` → `firestore-passthrough-field`);
209
+ * already-kebab inputs pass through unchanged.
210
+ *
211
+ * @param name - The export identifier.
212
+ * @returns The kebab-case slug.
213
+ */
214
+ export declare function toKebabCase(name: string): string;
215
+ /**
216
+ * Picks a default `category` from a source file path. The category is the
217
+ * first folder beneath `src/lib/` (or `src/` when `src/lib/` isn't
218
+ * present), so `packages/util/src/lib/date/expires.ts` → `date`.
219
+ *
220
+ * @param filePath - The absolute or repo-relative path to the source file.
221
+ * @returns The derived category slug, or `'misc'` when no folder is found.
222
+ */
223
+ export declare function deriveCategoryFromPath(filePath: string): string;
224
+ /**
225
+ * Input to {@link buildTagSet}.
226
+ */
227
+ export interface BuildTagSetInput {
228
+ readonly name: string;
229
+ readonly slug: string;
230
+ readonly summary: string;
231
+ readonly explicit: readonly string[];
232
+ readonly category: string;
233
+ }
234
+ /**
235
+ * Builds the deduped, lowercased tag set for a tagged-export entry. Tags
236
+ * are seeded from any `@*Tags` JSDoc body (`explicit`), then the category,
237
+ * the slug pieces, the export name (raw + kebab-cased pieces). When no
238
+ * explicit tags were supplied, up to eight summary-derived tokens are
239
+ * appended so the registry has some matchable text even when the author
240
+ * skipped the explicit tag.
241
+ *
242
+ * @param input - Source pieces to assemble the tag set from.
243
+ * @returns The deduped, lowercased tag list.
244
+ */
245
+ export declare function buildTagSet(input: BuildTagSetInput): readonly string[];