@dereekb/dbx-cli 13.11.18 → 13.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/firebase-api-manifest/main.js +70 -9
- package/firebase-api-manifest/package.json +1 -1
- package/firestore-indexes/src/firestore-indexes-generate.d.ts +125 -0
- package/firestore-indexes/src/firestore-model-identity-resolver.d.ts +93 -0
- package/firestore-indexes/src/firestore-query-helpers.d.ts +108 -0
- package/firestore-indexes/src/generate-firestore-indexes-cli.d.ts +94 -0
- package/firestore-indexes/src/index.d.ts +7 -0
- package/firestore-indexes/src/model-firebase-index-analyze.d.ts +68 -0
- package/firestore-indexes/src/model-firebase-index-build-manifest.d.ts +123 -0
- package/firestore-indexes/src/model-firebase-index-extract.d.ts +246 -0
- package/firestore-indexes/src/model-firebase-index-runtime.d.ts +126 -0
- package/firestore-indexes/src/model-firebase-index-scan-config-schema.d.ts +58 -0
- package/firestore-indexes/src/model-firebase-index-schema.d.ts +366 -0
- package/generate-firestore-indexes/main.js +1 -1
- package/generate-firestore-indexes/package.json +1 -1
- package/generate-mcp-manifest/main.js +1314 -0
- package/generate-mcp-manifest/package.json +6 -0
- package/generated/firebase-models.generated.d.ts +3 -0
- package/index.cjs.js +45614 -640
- package/index.esm.js +45321 -643
- package/lint-cache/main.js +32 -28
- package/lint-cache/package.json +2 -2
- package/manifest-extract/index.cjs.js +169 -4
- package/manifest-extract/index.esm.js +169 -4
- package/manifest-extract/package.json +1 -1
- package/manifest-extract/src/lib/types.d.ts +26 -1
- package/package.json +14 -10
- package/src/lib/index.d.ts +3 -0
- package/src/lib/manifest/types.d.ts +155 -0
- package/src/lib/mcp-scan/config/config-schema.d.ts +226 -0
- package/src/lib/mcp-scan/config/load-config.d.ts +63 -0
- package/src/lib/mcp-scan/index.d.ts +16 -0
- package/src/lib/mcp-scan/manifest/actions-loader.d.ts +49 -0
- package/src/lib/mcp-scan/manifest/actions-schema.d.ts +328 -0
- package/src/lib/mcp-scan/manifest/core-topics.d.ts +38 -0
- package/src/lib/mcp-scan/manifest/css-utilities-loader.d.ts +55 -0
- package/src/lib/mcp-scan/manifest/css-utilities-schema.d.ts +168 -0
- package/src/lib/mcp-scan/manifest/dbx-docs-ui-examples-loader.d.ts +33 -0
- package/src/lib/mcp-scan/manifest/dbx-docs-ui-examples-schema.d.ts +133 -0
- package/src/lib/mcp-scan/manifest/filters-loader.d.ts +61 -0
- package/src/lib/mcp-scan/manifest/filters-schema.d.ts +190 -0
- package/src/lib/mcp-scan/manifest/forge-fields-loader.d.ts +53 -0
- package/src/lib/mcp-scan/manifest/forge-fields-schema.d.ts +170 -0
- package/src/lib/mcp-scan/manifest/index.d.ts +43 -0
- package/src/lib/mcp-scan/manifest/load-actions-registry.d.ts +38 -0
- package/src/lib/mcp-scan/manifest/load-auth-registry.d.ts +82 -0
- package/src/lib/mcp-scan/manifest/load-css-utilities-registry.d.ts +67 -0
- package/src/lib/mcp-scan/manifest/load-dbx-docs-ui-examples-registry.d.ts +45 -0
- package/src/lib/mcp-scan/manifest/load-filters-registry.d.ts +69 -0
- package/src/lib/mcp-scan/manifest/load-forge-fields-registry.d.ts +70 -0
- package/src/lib/mcp-scan/manifest/load-model-firebase-index-registry.d.ts +61 -0
- package/src/lib/mcp-scan/manifest/load-model-snapshot-fields-registry.d.ts +74 -0
- package/src/lib/mcp-scan/manifest/load-pipes-registry.d.ts +69 -0
- package/src/lib/mcp-scan/manifest/load-registry.d.ts +76 -0
- package/src/lib/mcp-scan/manifest/load-tokens-registry.d.ts +69 -0
- package/src/lib/mcp-scan/manifest/load-ui-components-registry.d.ts +70 -0
- package/src/lib/mcp-scan/manifest/load-utils-registry.d.ts +73 -0
- package/src/lib/mcp-scan/manifest/loader.d.ts +120 -0
- package/src/lib/mcp-scan/manifest/manifest-loader-base.d.ts +130 -0
- package/src/lib/mcp-scan/manifest/model-firebase-index-loader.d.ts +53 -0
- package/src/lib/mcp-scan/manifest/model-snapshot-fields-loader.d.ts +54 -0
- package/src/lib/mcp-scan/manifest/model-snapshot-fields-schema.d.ts +127 -0
- package/src/lib/mcp-scan/manifest/pipes-loader.d.ts +54 -0
- package/src/lib/mcp-scan/manifest/pipes-schema.d.ts +125 -0
- package/src/lib/mcp-scan/manifest/semantic-types-schema.d.ts +108 -0
- package/src/lib/mcp-scan/manifest/tokens-loader.d.ts +55 -0
- package/src/lib/mcp-scan/manifest/tokens-schema.d.ts +116 -0
- package/src/lib/mcp-scan/manifest/ui-components-loader.d.ts +54 -0
- package/src/lib/mcp-scan/manifest/ui-components-schema.d.ts +149 -0
- package/src/lib/mcp-scan/manifest/utils-loader.d.ts +54 -0
- package/src/lib/mcp-scan/manifest/utils-schema.d.ts +120 -0
- package/src/lib/mcp-scan/registry/actions-runtime.d.ts +173 -0
- package/src/lib/mcp-scan/registry/archetypes.d.ts +235 -0
- package/src/lib/mcp-scan/registry/auth-builtin.d.ts +59 -0
- package/src/lib/mcp-scan/registry/auth-runtime.d.ts +343 -0
- package/src/lib/mcp-scan/registry/css-utilities-runtime.d.ts +133 -0
- package/src/lib/mcp-scan/registry/dbx-docs-ui-examples-runtime.d.ts +58 -0
- package/src/lib/mcp-scan/registry/downstream-models-runtime.d.ts +93 -0
- package/src/lib/mcp-scan/registry/filters-runtime.d.ts +128 -0
- package/src/lib/mcp-scan/registry/firebase-models.d.ts +387 -0
- package/src/lib/mcp-scan/registry/forge-fields.d.ts +101 -0
- package/src/lib/mcp-scan/registry/form-fields.d.ts +203 -0
- package/src/lib/mcp-scan/registry/index.d.ts +165 -0
- package/src/lib/mcp-scan/registry/model-snapshot-fields-runtime.d.ts +138 -0
- package/src/lib/mcp-scan/registry/pipes-runtime.d.ts +136 -0
- package/src/lib/mcp-scan/registry/reserved-model-folders.d.ts +29 -0
- package/src/lib/mcp-scan/registry/semantic-types.d.ts +81 -0
- package/src/lib/mcp-scan/registry/tokens-runtime.d.ts +96 -0
- package/src/lib/mcp-scan/registry/ui-components-runtime.d.ts +90 -0
- package/src/lib/mcp-scan/registry/utils-runtime.d.ts +136 -0
- package/src/lib/mcp-scan/scan/_jsdoc-tagged-export/extract-base.d.ts +245 -0
- package/src/lib/mcp-scan/scan/actions-build-manifest.d.ts +58 -0
- package/src/lib/mcp-scan/scan/actions-cli.d.ts +38 -0
- package/src/lib/mcp-scan/scan/actions-extract.d.ts +99 -0
- package/src/lib/mcp-scan/scan/actions-scan-config-schema.d.ts +42 -0
- package/src/lib/mcp-scan/scan/auth-extract.d.ts +127 -0
- package/src/lib/mcp-scan/scan/build-manifest.d.ts +76 -0
- package/src/lib/mcp-scan/scan/cli.d.ts +60 -0
- package/src/lib/mcp-scan/scan/css-utilities-build-manifest.d.ts +76 -0
- package/src/lib/mcp-scan/scan/css-utilities-cli.d.ts +36 -0
- package/src/lib/mcp-scan/scan/css-utilities-extract.d.ts +187 -0
- package/src/lib/mcp-scan/scan/css-utilities-scan-config-schema.d.ts +57 -0
- package/src/lib/mcp-scan/scan/dbx-docs-ui-examples-build-manifest.d.ts +68 -0
- package/src/lib/mcp-scan/scan/dbx-docs-ui-examples-cli.d.ts +20 -0
- package/src/lib/mcp-scan/scan/dbx-docs-ui-examples-extract.d.ts +160 -0
- package/src/lib/mcp-scan/scan/dbx-docs-ui-examples-scan-config-schema.d.ts +56 -0
- package/src/lib/mcp-scan/scan/discover-downstream-packages.d.ts +76 -0
- package/src/lib/mcp-scan/scan/discover-firebase-packages.d.ts +58 -0
- package/src/lib/mcp-scan/scan/extract-models/assemble.d.ts +105 -0
- package/src/lib/mcp-scan/scan/extract-models/collect-inherited.d.ts +22 -0
- package/src/lib/mcp-scan/scan/extract-models/find-converters.d.ts +19 -0
- package/src/lib/mcp-scan/scan/extract-models/find-enums.d.ts +19 -0
- package/src/lib/mcp-scan/scan/extract-models/find-identities.d.ts +25 -0
- package/src/lib/mcp-scan/scan/extract-models/find-interfaces.d.ts +31 -0
- package/src/lib/mcp-scan/scan/extract-models/find-model-groups.d.ts +21 -0
- package/src/lib/mcp-scan/scan/extract-models/find-service-factories.d.ts +19 -0
- package/src/lib/mcp-scan/scan/extract-models/find-sub-object-consts.d.ts +20 -0
- package/src/lib/mcp-scan/scan/extract-models/index.d.ts +74 -0
- package/src/lib/mcp-scan/scan/extract-models/infer-collection-kind.d.ts +22 -0
- package/src/lib/mcp-scan/scan/extract-models/service-factory-constants.d.ts +6 -0
- package/src/lib/mcp-scan/scan/extract-models/types.d.ts +171 -0
- package/src/lib/mcp-scan/scan/extract.d.ts +82 -0
- package/src/lib/mcp-scan/scan/filters-build-manifest.d.ts +78 -0
- package/src/lib/mcp-scan/scan/filters-cli.d.ts +37 -0
- package/src/lib/mcp-scan/scan/filters-extract.d.ts +101 -0
- package/src/lib/mcp-scan/scan/filters-scan-config-schema.d.ts +56 -0
- package/src/lib/mcp-scan/scan/forge-fields-build-manifest.d.ts +78 -0
- package/src/lib/mcp-scan/scan/forge-fields-cli.d.ts +37 -0
- package/src/lib/mcp-scan/scan/forge-fields-extract.d.ts +165 -0
- package/src/lib/mcp-scan/scan/forge-fields-scan-config-schema.d.ts +61 -0
- package/src/lib/mcp-scan/scan/index.d.ts +60 -0
- package/src/lib/mcp-scan/scan/model-firebase-index-cli.d.ts +22 -0
- package/src/lib/mcp-scan/scan/model-firebase-index-dispatcher-credit.d.ts +47 -0
- package/src/lib/mcp-scan/scan/model-firebase-index-reference-scan.d.ts +100 -0
- package/src/lib/mcp-scan/scan/model-snapshot-fields-build-manifest.d.ts +79 -0
- package/src/lib/mcp-scan/scan/model-snapshot-fields-cli.d.ts +37 -0
- package/src/lib/mcp-scan/scan/model-snapshot-fields-extract.d.ts +115 -0
- package/src/lib/mcp-scan/scan/model-snapshot-fields-scan-config-schema.d.ts +59 -0
- package/src/lib/mcp-scan/scan/pipes-build-manifest.d.ts +78 -0
- package/src/lib/mcp-scan/scan/pipes-cli.d.ts +37 -0
- package/src/lib/mcp-scan/scan/pipes-extract.d.ts +90 -0
- package/src/lib/mcp-scan/scan/pipes-scan-config-schema.d.ts +56 -0
- package/src/lib/mcp-scan/scan/scan-angular-io.d.ts +89 -0
- package/src/lib/mcp-scan/scan/scan-cli-base.d.ts +162 -0
- package/src/lib/mcp-scan/scan/scan-config-schema.d.ts +44 -0
- package/src/lib/mcp-scan/scan/ui-components-build-manifest.d.ts +78 -0
- package/src/lib/mcp-scan/scan/ui-components-cli.d.ts +37 -0
- package/src/lib/mcp-scan/scan/ui-components-extract.d.ts +124 -0
- package/src/lib/mcp-scan/scan/ui-components-scan-config-schema.d.ts +62 -0
- package/src/lib/mcp-scan/scan/utils-build-manifest.d.ts +78 -0
- package/src/lib/mcp-scan/scan/utils-cli.d.ts +37 -0
- package/src/lib/mcp-scan/scan/utils-extract.d.ts +103 -0
- package/src/lib/mcp-scan/scan/utils-scan-config-schema.d.ts +57 -0
- package/test/package.json +9 -9
- package/index.cjs.default.js +0 -1
- package/index.cjs.mjs +0 -2
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { Maybe } from '@dereekb/util';
|
|
1
2
|
import { type Type } from 'arktype';
|
|
2
3
|
/**
|
|
3
4
|
* One persisted field on a {@link CliModelManifestEntry}.
|
|
@@ -122,6 +123,20 @@ export interface CliModelManifestEntry {
|
|
|
122
123
|
* Persisted-field metadata in source order.
|
|
123
124
|
*/
|
|
124
125
|
readonly fields: readonly CliModelField[];
|
|
126
|
+
/**
|
|
127
|
+
* Read posture declared by `@dbxModelRead <level>` on the model interface. Closed enum:
|
|
128
|
+
* `system` / `owner` / `admin-only` / `permissions`. Absent when the model interface omits the tag.
|
|
129
|
+
*/
|
|
130
|
+
readonly read?: 'system' | 'owner' | 'admin-only' | 'permissions';
|
|
131
|
+
/**
|
|
132
|
+
* Resolved `@dbxModelServiceFactory <modelType>`-tagged export that implements this model.
|
|
133
|
+
* Joined by `modelType` during model-manifest assembly. Absent when no factory was found
|
|
134
|
+
* (surfaced as an orphan by the cross-file ESLint rule).
|
|
135
|
+
*/
|
|
136
|
+
readonly serviceFactory?: {
|
|
137
|
+
readonly exportName: string;
|
|
138
|
+
readonly sourceFile: string;
|
|
139
|
+
};
|
|
125
140
|
}
|
|
126
141
|
/**
|
|
127
142
|
* Generated array of {@link CliModelManifestEntry} consumed by `model-info`
|
|
@@ -168,3 +183,143 @@ export interface CliApiManifestEntry {
|
|
|
168
183
|
readonly resultFields?: readonly CliApiManifestField[];
|
|
169
184
|
}
|
|
170
185
|
export type CliApiManifest = readonly CliApiManifestEntry[];
|
|
186
|
+
/**
|
|
187
|
+
* Version stamp embedded in the build-time MCP manifest JSON. Runtime loaders
|
|
188
|
+
* refuse manifests whose `version` does not match this constant.
|
|
189
|
+
*/
|
|
190
|
+
export declare const MCP_MANIFEST_VERSION: 1;
|
|
191
|
+
/**
|
|
192
|
+
* One tool entry inside the build-time MCP manifest JSON.
|
|
193
|
+
*
|
|
194
|
+
* The renderer pre-merges descriptions, enriches the input schema with per-field
|
|
195
|
+
* `description` text, and synthesizes an `outputSchema` from `resultFields[]` so the
|
|
196
|
+
* runtime only has to do map lookups.
|
|
197
|
+
*/
|
|
198
|
+
export interface McpManifestToolEntry {
|
|
199
|
+
/**
|
|
200
|
+
* Merged tool description: `entry.description` joined with `entry.paramsTypeDescription`.
|
|
201
|
+
* Omitted when both source fields are absent.
|
|
202
|
+
*/
|
|
203
|
+
readonly description?: string;
|
|
204
|
+
/**
|
|
205
|
+
* JSON Schema produced from the params validator and enriched with `paramsFields[]` descriptions.
|
|
206
|
+
* Omitted when neither validator nor fields produced a schema.
|
|
207
|
+
*/
|
|
208
|
+
readonly inputSchema?: object;
|
|
209
|
+
/**
|
|
210
|
+
* JSON Schema synthesized from `resultFields[]` / `resultTypeDescription`. Omitted when both absent.
|
|
211
|
+
*/
|
|
212
|
+
readonly outputSchema?: object;
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* One persisted field on a {@link McpManifestModelEntry}.
|
|
216
|
+
*
|
|
217
|
+
* Structural projection of {@link CliModelField} minus the converter expression
|
|
218
|
+
* text (CLI-only). Keeps the runtime payload narrow for downstream MCP tools.
|
|
219
|
+
*/
|
|
220
|
+
export interface McpManifestModelField {
|
|
221
|
+
readonly name: string;
|
|
222
|
+
readonly longName: string;
|
|
223
|
+
readonly tsType?: string;
|
|
224
|
+
readonly optional: boolean;
|
|
225
|
+
readonly description?: string;
|
|
226
|
+
readonly enumRef?: string;
|
|
227
|
+
readonly syncFlag?: string;
|
|
228
|
+
readonly nestedFields?: readonly McpManifestModelField[];
|
|
229
|
+
readonly nestedIsArray?: boolean;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* One Firestore model entry in the build-time MCP manifest JSON.
|
|
233
|
+
*
|
|
234
|
+
* Structural projection of {@link CliModelManifestEntry} consumed at runtime by
|
|
235
|
+
* the firebase-server/mcp built-in `model-info` and `model-decode` tools.
|
|
236
|
+
*/
|
|
237
|
+
export interface McpManifestModelEntry {
|
|
238
|
+
readonly modelType: string;
|
|
239
|
+
readonly modelName: string;
|
|
240
|
+
readonly modelGroup?: string;
|
|
241
|
+
readonly identityConst: string;
|
|
242
|
+
readonly collectionPrefix: string;
|
|
243
|
+
readonly parentIdentityConst?: string;
|
|
244
|
+
readonly description?: string;
|
|
245
|
+
readonly sourcePackage: string;
|
|
246
|
+
readonly sourceFile: string;
|
|
247
|
+
readonly fields: readonly McpManifestModelField[];
|
|
248
|
+
}
|
|
249
|
+
/**
|
|
250
|
+
* One auth claim entry in the pre-rendered MCP manifest JSON. Powers the
|
|
251
|
+
* runtime `whoami` tool. Source paths and line numbers are stripped — only
|
|
252
|
+
* the catalog-facing fields survive.
|
|
253
|
+
*/
|
|
254
|
+
export interface McpManifestAuthClaim {
|
|
255
|
+
readonly key: string;
|
|
256
|
+
readonly description: string;
|
|
257
|
+
readonly type: string;
|
|
258
|
+
readonly app?: string;
|
|
259
|
+
readonly interfaceName?: string;
|
|
260
|
+
readonly source: 'system' | 'app';
|
|
261
|
+
readonly mapping: {
|
|
262
|
+
readonly roles: readonly string[];
|
|
263
|
+
readonly inverse: boolean;
|
|
264
|
+
readonly inverseMode?: 'any' | 'all';
|
|
265
|
+
readonly claimValue?: string | number | boolean;
|
|
266
|
+
readonly customEncodeDecode: boolean;
|
|
267
|
+
};
|
|
268
|
+
readonly tags: readonly string[];
|
|
269
|
+
}
|
|
270
|
+
/**
|
|
271
|
+
* One auth app entry in the pre-rendered MCP manifest JSON.
|
|
272
|
+
*
|
|
273
|
+
* `auth.app` denotes the manifest's primary app (the host that emitted the
|
|
274
|
+
* manifest). `auth.apps` carries the full list, which may include the primary
|
|
275
|
+
* plus inherited apps (e.g. `storageFile-upload-user`).
|
|
276
|
+
*/
|
|
277
|
+
export interface McpManifestAuthApp {
|
|
278
|
+
readonly app: string;
|
|
279
|
+
readonly claimsInterfaceName: string;
|
|
280
|
+
readonly serviceConstName: string;
|
|
281
|
+
readonly claimKeys: readonly string[];
|
|
282
|
+
readonly scopes: readonly string[];
|
|
283
|
+
readonly description?: string;
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Auth section of the pre-rendered MCP manifest JSON. Optional — runtimes
|
|
287
|
+
* built before this section landed simply skip registering whoami.
|
|
288
|
+
*/
|
|
289
|
+
export interface McpManifestAuth {
|
|
290
|
+
readonly app?: McpManifestAuthApp;
|
|
291
|
+
readonly apps: readonly McpManifestAuthApp[];
|
|
292
|
+
readonly claims: readonly McpManifestAuthClaim[];
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* Build-time MCP manifest JSON shape consumed by the runtime MCP module's optional manifest loader.
|
|
296
|
+
*
|
|
297
|
+
* `tools` is keyed by {@link mcpManifestKey} so the runtime can do O(1) lookups per registered tool.
|
|
298
|
+
* `models` is optional — the runtime skips the catalog-introspection tools when missing.
|
|
299
|
+
* `auth` is optional — drives the runtime `whoami` tool.
|
|
300
|
+
*/
|
|
301
|
+
export interface McpManifest {
|
|
302
|
+
readonly version: typeof MCP_MANIFEST_VERSION;
|
|
303
|
+
/**
|
|
304
|
+
* ISO-8601 timestamp captured when the manifest was rendered. Useful for diagnostics.
|
|
305
|
+
*/
|
|
306
|
+
readonly generatedAt: string;
|
|
307
|
+
readonly tools: {
|
|
308
|
+
readonly [key: string]: McpManifestToolEntry | undefined;
|
|
309
|
+
};
|
|
310
|
+
readonly models?: readonly McpManifestModelEntry[];
|
|
311
|
+
readonly auth?: McpManifestAuth;
|
|
312
|
+
}
|
|
313
|
+
/**
|
|
314
|
+
* Builds the canonical MCP manifest key for a (modelType, callType, specifier) triple.
|
|
315
|
+
*
|
|
316
|
+
* The default-specifier entry collapses to `_` so the runtime can compose the same
|
|
317
|
+
* key from its dispatch coordinates without first checking whether the handler is
|
|
318
|
+
* behind a specifier router.
|
|
319
|
+
*
|
|
320
|
+
* @param modelType - The Firestore model type (e.g., `guestbook`).
|
|
321
|
+
* @param call - The call type / verb (e.g., `query`).
|
|
322
|
+
* @param specifier - The specifier key, or `_` / undefined for the default entry.
|
|
323
|
+
* @returns The canonical `modelType.call.specifier` lookup key, with the default specifier normalized to `_`.
|
|
324
|
+
*/
|
|
325
|
+
export declare function mcpManifestKey(modelType: string, call: string, specifier?: Maybe<string>): string;
|
|
@@ -0,0 +1,226 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Arktype schema for `dbx-mcp.config.json`.
|
|
3
|
+
*
|
|
4
|
+
* The config file lives at the workspace root and carries three kinds of
|
|
5
|
+
* settings:
|
|
6
|
+
*
|
|
7
|
+
* 1. `<cluster>.sources` — repo-relative paths to *external* generated
|
|
8
|
+
* manifests merged alongside the bundled `@dereekb/*` registries.
|
|
9
|
+
* 2. `<cluster>.scan` — per-package scan inputs that drive bundled-manifest
|
|
10
|
+
* generation (replacing the per-package `dbx-mcp.scan.json` files this
|
|
11
|
+
* repo previously shipped).
|
|
12
|
+
* 3. `modelValidate` — overrides for the firebase-model rule pipeline
|
|
13
|
+
* (field-name length limit, ignored field names).
|
|
14
|
+
*
|
|
15
|
+
* The bundled registries are *always* loaded; `sources` adds extras. The
|
|
16
|
+
* `scan` array is consumed by `scripts/generate-manifests.mjs` at build
|
|
17
|
+
* time. `modelValidate` is read once at server bootstrap and threaded into
|
|
18
|
+
* `dbx_model_validate`'s rule options.
|
|
19
|
+
*/
|
|
20
|
+
/**
|
|
21
|
+
* One entry in `<cluster>.scan[]`. Mirrors the shape of the legacy
|
|
22
|
+
* per-package `dbx-mcp.scan.json` plus a `project` field that names the
|
|
23
|
+
* package directory the scan should target. Fields are intentionally a
|
|
24
|
+
* permissive superset across all six clusters — semantic-types entries
|
|
25
|
+
* carry `topicNamespace` / `declaredTopics`, cluster-with-section entries
|
|
26
|
+
* carry `module`, and per-cluster CLIs read only the fields they care
|
|
27
|
+
* about.
|
|
28
|
+
*/
|
|
29
|
+
declare const ScanEntry: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
30
|
+
project: string;
|
|
31
|
+
source: string;
|
|
32
|
+
out: string;
|
|
33
|
+
include?: string[] | undefined;
|
|
34
|
+
exclude?: string[] | undefined;
|
|
35
|
+
topicNamespace?: string | undefined;
|
|
36
|
+
declaredTopics?: string[] | undefined;
|
|
37
|
+
module?: string | undefined;
|
|
38
|
+
}, {}>;
|
|
39
|
+
/**
|
|
40
|
+
* Top-level config schema. Missing-but-optional cluster keys mean the
|
|
41
|
+
* MCP runs with only its bundled `@dereekb/*` manifests, which is the
|
|
42
|
+
* intended default for fresh installs.
|
|
43
|
+
*/
|
|
44
|
+
export declare const DbxMcpConfig: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
45
|
+
version: 1;
|
|
46
|
+
modelValidate?: {
|
|
47
|
+
maxFieldNameLength?: number | undefined;
|
|
48
|
+
ignoredFieldNames?: string[] | undefined;
|
|
49
|
+
ignoredExternalParents?: string[] | undefined;
|
|
50
|
+
} | undefined;
|
|
51
|
+
logs?: {
|
|
52
|
+
basePath?: string | undefined;
|
|
53
|
+
defaultProject?: string | undefined;
|
|
54
|
+
} | undefined;
|
|
55
|
+
semanticTypes?: {
|
|
56
|
+
sources?: string[] | undefined;
|
|
57
|
+
scan?: {
|
|
58
|
+
project: string;
|
|
59
|
+
source: string;
|
|
60
|
+
out: string;
|
|
61
|
+
include?: string[] | undefined;
|
|
62
|
+
exclude?: string[] | undefined;
|
|
63
|
+
topicNamespace?: string | undefined;
|
|
64
|
+
declaredTopics?: string[] | undefined;
|
|
65
|
+
module?: string | undefined;
|
|
66
|
+
}[] | undefined;
|
|
67
|
+
} | undefined;
|
|
68
|
+
uiComponents?: {
|
|
69
|
+
sources?: string[] | undefined;
|
|
70
|
+
scan?: {
|
|
71
|
+
project: string;
|
|
72
|
+
source: string;
|
|
73
|
+
out: string;
|
|
74
|
+
include?: string[] | undefined;
|
|
75
|
+
exclude?: string[] | undefined;
|
|
76
|
+
topicNamespace?: string | undefined;
|
|
77
|
+
declaredTopics?: string[] | undefined;
|
|
78
|
+
module?: string | undefined;
|
|
79
|
+
}[] | undefined;
|
|
80
|
+
} | undefined;
|
|
81
|
+
forgeFields?: {
|
|
82
|
+
sources?: string[] | undefined;
|
|
83
|
+
scan?: {
|
|
84
|
+
project: string;
|
|
85
|
+
source: string;
|
|
86
|
+
out: string;
|
|
87
|
+
include?: string[] | undefined;
|
|
88
|
+
exclude?: string[] | undefined;
|
|
89
|
+
topicNamespace?: string | undefined;
|
|
90
|
+
declaredTopics?: string[] | undefined;
|
|
91
|
+
module?: string | undefined;
|
|
92
|
+
}[] | undefined;
|
|
93
|
+
} | undefined;
|
|
94
|
+
pipes?: {
|
|
95
|
+
sources?: string[] | undefined;
|
|
96
|
+
scan?: {
|
|
97
|
+
project: string;
|
|
98
|
+
source: string;
|
|
99
|
+
out: string;
|
|
100
|
+
include?: string[] | undefined;
|
|
101
|
+
exclude?: string[] | undefined;
|
|
102
|
+
topicNamespace?: string | undefined;
|
|
103
|
+
declaredTopics?: string[] | undefined;
|
|
104
|
+
module?: string | undefined;
|
|
105
|
+
}[] | undefined;
|
|
106
|
+
} | undefined;
|
|
107
|
+
actions?: {
|
|
108
|
+
sources?: string[] | undefined;
|
|
109
|
+
scan?: {
|
|
110
|
+
project: string;
|
|
111
|
+
source: string;
|
|
112
|
+
out: string;
|
|
113
|
+
include?: string[] | undefined;
|
|
114
|
+
exclude?: string[] | undefined;
|
|
115
|
+
topicNamespace?: string | undefined;
|
|
116
|
+
declaredTopics?: string[] | undefined;
|
|
117
|
+
module?: string | undefined;
|
|
118
|
+
}[] | undefined;
|
|
119
|
+
} | undefined;
|
|
120
|
+
filters?: {
|
|
121
|
+
sources?: string[] | undefined;
|
|
122
|
+
scan?: {
|
|
123
|
+
project: string;
|
|
124
|
+
source: string;
|
|
125
|
+
out: string;
|
|
126
|
+
include?: string[] | undefined;
|
|
127
|
+
exclude?: string[] | undefined;
|
|
128
|
+
topicNamespace?: string | undefined;
|
|
129
|
+
declaredTopics?: string[] | undefined;
|
|
130
|
+
module?: string | undefined;
|
|
131
|
+
}[] | undefined;
|
|
132
|
+
} | undefined;
|
|
133
|
+
tokens?: {
|
|
134
|
+
sources?: string[] | undefined;
|
|
135
|
+
scan?: {
|
|
136
|
+
project: string;
|
|
137
|
+
source: string;
|
|
138
|
+
out: string;
|
|
139
|
+
include?: string[] | undefined;
|
|
140
|
+
exclude?: string[] | undefined;
|
|
141
|
+
topicNamespace?: string | undefined;
|
|
142
|
+
declaredTopics?: string[] | undefined;
|
|
143
|
+
module?: string | undefined;
|
|
144
|
+
}[] | undefined;
|
|
145
|
+
} | undefined;
|
|
146
|
+
cssUtilities?: {
|
|
147
|
+
sources?: string[] | undefined;
|
|
148
|
+
scan?: {
|
|
149
|
+
project: string;
|
|
150
|
+
source: string;
|
|
151
|
+
out: string;
|
|
152
|
+
include?: string[] | undefined;
|
|
153
|
+
exclude?: string[] | undefined;
|
|
154
|
+
topicNamespace?: string | undefined;
|
|
155
|
+
declaredTopics?: string[] | undefined;
|
|
156
|
+
module?: string | undefined;
|
|
157
|
+
}[] | undefined;
|
|
158
|
+
} | undefined;
|
|
159
|
+
utils?: {
|
|
160
|
+
sources?: string[] | undefined;
|
|
161
|
+
scan?: {
|
|
162
|
+
project: string;
|
|
163
|
+
source: string;
|
|
164
|
+
out: string;
|
|
165
|
+
include?: string[] | undefined;
|
|
166
|
+
exclude?: string[] | undefined;
|
|
167
|
+
topicNamespace?: string | undefined;
|
|
168
|
+
declaredTopics?: string[] | undefined;
|
|
169
|
+
module?: string | undefined;
|
|
170
|
+
}[] | undefined;
|
|
171
|
+
} | undefined;
|
|
172
|
+
modelSnapshotFields?: {
|
|
173
|
+
sources?: string[] | undefined;
|
|
174
|
+
scan?: {
|
|
175
|
+
project: string;
|
|
176
|
+
source: string;
|
|
177
|
+
out: string;
|
|
178
|
+
include?: string[] | undefined;
|
|
179
|
+
exclude?: string[] | undefined;
|
|
180
|
+
topicNamespace?: string | undefined;
|
|
181
|
+
declaredTopics?: string[] | undefined;
|
|
182
|
+
module?: string | undefined;
|
|
183
|
+
}[] | undefined;
|
|
184
|
+
} | undefined;
|
|
185
|
+
modelFirebaseIndex?: {
|
|
186
|
+
sources?: string[] | undefined;
|
|
187
|
+
scan?: {
|
|
188
|
+
project: string;
|
|
189
|
+
source: string;
|
|
190
|
+
out: string;
|
|
191
|
+
include?: string[] | undefined;
|
|
192
|
+
exclude?: string[] | undefined;
|
|
193
|
+
topicNamespace?: string | undefined;
|
|
194
|
+
declaredTopics?: string[] | undefined;
|
|
195
|
+
module?: string | undefined;
|
|
196
|
+
}[] | undefined;
|
|
197
|
+
} | undefined;
|
|
198
|
+
dbxDocsUiExamples?: {
|
|
199
|
+
sources?: string[] | undefined;
|
|
200
|
+
scan?: {
|
|
201
|
+
project: string;
|
|
202
|
+
source: string;
|
|
203
|
+
out: string;
|
|
204
|
+
include?: string[] | undefined;
|
|
205
|
+
exclude?: string[] | undefined;
|
|
206
|
+
topicNamespace?: string | undefined;
|
|
207
|
+
declaredTopics?: string[] | undefined;
|
|
208
|
+
module?: string | undefined;
|
|
209
|
+
}[] | undefined;
|
|
210
|
+
} | undefined;
|
|
211
|
+
uiSmellCheck?: {
|
|
212
|
+
projectConventions?: {
|
|
213
|
+
cardWrapperClasses?: string[] | undefined;
|
|
214
|
+
} | undefined;
|
|
215
|
+
} | undefined;
|
|
216
|
+
}, {}>;
|
|
217
|
+
/**
|
|
218
|
+
* Static type inferred from {@link DbxMcpConfig}.
|
|
219
|
+
*/
|
|
220
|
+
export type DbxMcpConfig = typeof DbxMcpConfig.infer;
|
|
221
|
+
/**
|
|
222
|
+
* Static type inferred from `ScanEntry`. Exported so the build
|
|
223
|
+
* orchestrator and per-cluster CLIs can share one canonical entry type.
|
|
224
|
+
*/
|
|
225
|
+
export type DbxMcpScanEntry = typeof ScanEntry.infer;
|
|
226
|
+
export {};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loader for `dbx-mcp.config.json`.
|
|
3
|
+
*
|
|
4
|
+
* Reads the config file from `${cwd}/dbx-mcp.config.json` (no upward walk —
|
|
5
|
+
* the MCP is always launched at the repo root, mirroring the cwd contract
|
|
6
|
+
* that the existing `validate-input.ts` security check relies on).
|
|
7
|
+
*
|
|
8
|
+
* Failure modes are surfaced as warnings rather than thrown errors. A
|
|
9
|
+
* missing file is *not* a warning — it is the expected default for fresh
|
|
10
|
+
* installs that haven't opted into downstream manifests yet. Parse and
|
|
11
|
+
* schema failures are warnings so the rest of the MCP can still come up;
|
|
12
|
+
* the caller decides whether to log or escalate.
|
|
13
|
+
*/
|
|
14
|
+
import type { Maybe } from '@dereekb/util';
|
|
15
|
+
import { DbxMcpConfig } from './config-schema.js';
|
|
16
|
+
/**
|
|
17
|
+
* Function shape used by the loader to read the config file. Defaults to
|
|
18
|
+
* `node:fs/promises.readFile(path, 'utf-8')`. Tests inject a Map-backed
|
|
19
|
+
* implementation so they can drive the loader without touching disk.
|
|
20
|
+
*/
|
|
21
|
+
export type ConfigReadFile = (absolutePath: string) => Promise<string>;
|
|
22
|
+
/**
|
|
23
|
+
* Discriminated union of the non-fatal events the config loader emits.
|
|
24
|
+
* A missing file is *not* represented here — that case returns `null`
|
|
25
|
+
* config + empty warnings.
|
|
26
|
+
*/
|
|
27
|
+
export type ConfigWarning = {
|
|
28
|
+
readonly kind: 'config-parse-failed';
|
|
29
|
+
readonly path: string;
|
|
30
|
+
readonly error: string;
|
|
31
|
+
} | {
|
|
32
|
+
readonly kind: 'config-schema-failed';
|
|
33
|
+
readonly path: string;
|
|
34
|
+
readonly error: string;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Result of {@link findAndLoadConfig}. `config` is `null` either when no
|
|
38
|
+
* file is present or when parsing/validation failed; `configPath` is set
|
|
39
|
+
* iff a file was actually found, regardless of whether parsing succeeded.
|
|
40
|
+
*/
|
|
41
|
+
export interface FindAndLoadConfigResult {
|
|
42
|
+
readonly config: Maybe<DbxMcpConfig>;
|
|
43
|
+
readonly configPath: Maybe<string>;
|
|
44
|
+
readonly warnings: readonly ConfigWarning[];
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Input to {@link findAndLoadConfig}.
|
|
48
|
+
*/
|
|
49
|
+
export interface FindAndLoadConfigInput {
|
|
50
|
+
readonly cwd: string;
|
|
51
|
+
readonly readFile?: ConfigReadFile;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Reads `${cwd}/dbx-mcp.config.json` and returns its parsed contents.
|
|
55
|
+
* Missing files return `{ config: null, configPath: null, warnings: [] }`
|
|
56
|
+
* (not an error — the file is optional). Parse and schema failures
|
|
57
|
+
* return `{ config: null, configPath: <found path>, warnings: [...] }`
|
|
58
|
+
* so the caller can decide how loud to be about the failure.
|
|
59
|
+
*
|
|
60
|
+
* @param input - Cwd and an optional injected `readFile`
|
|
61
|
+
* @returns The parsed config, the path it came from, and any warnings.
|
|
62
|
+
*/
|
|
63
|
+
export declare function findAndLoadConfig(input: FindAndLoadConfigInput): Promise<FindAndLoadConfigResult>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Umbrella barrel for the dbx-components MCP scan infrastructure.
|
|
3
|
+
*
|
|
4
|
+
* Three subdirs:
|
|
5
|
+
* - `registry/` — typed metadata catalogs (`FIREBASE_MODELS`, archetypes,
|
|
6
|
+
* auth, semantic types, etc.) used by runtime MCP tools and build-time CLIs.
|
|
7
|
+
* - `scan/` — ts-morph-backed source extractors and `generate-mcp-manifest`
|
|
8
|
+
* cluster CLIs that walk workspace source to build the catalog JSON files.
|
|
9
|
+
* - `manifest/` — arktype-validated schemas + loader helpers that hydrate the
|
|
10
|
+
* runtime registries from those JSON files.
|
|
11
|
+
*/
|
|
12
|
+
export * from './config/config-schema.js';
|
|
13
|
+
export * from './config/load-config.js';
|
|
14
|
+
export * from './registry/index.js';
|
|
15
|
+
export * from './scan/index.js';
|
|
16
|
+
export * from './manifest/index.js';
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Loader for actions manifests.
|
|
3
|
+
*
|
|
4
|
+
* Reads one or more manifest files, validates them against
|
|
5
|
+
* {@link ActionManifest}, and merges them into a single lookup-ready
|
|
6
|
+
* registry. Mirrors the pipes / forge-fields / ui-components loaders via
|
|
7
|
+
* the shared {@link loadManifestsBase} core.
|
|
8
|
+
*/
|
|
9
|
+
import { type ActionEntry } from './actions-schema.js';
|
|
10
|
+
import { type ManifestLoaderWarning, type ManifestReadFile, type ManifestSource } from './manifest-loader-base.js';
|
|
11
|
+
/**
|
|
12
|
+
* One manifest the loader is asked to ingest. `path` must be absolute.
|
|
13
|
+
*/
|
|
14
|
+
export type ActionManifestSource = ManifestSource;
|
|
15
|
+
/**
|
|
16
|
+
* Function shape used by the loader to read manifest contents.
|
|
17
|
+
*/
|
|
18
|
+
export type ActionManifestReadFile = ManifestReadFile;
|
|
19
|
+
/**
|
|
20
|
+
* Discriminated union of all non-fatal events the loader emits.
|
|
21
|
+
*/
|
|
22
|
+
export type ActionLoaderWarning = ManifestLoaderWarning;
|
|
23
|
+
/**
|
|
24
|
+
* Input to {@link loadActionManifests}.
|
|
25
|
+
*/
|
|
26
|
+
export interface LoadActionManifestsInput {
|
|
27
|
+
readonly sources: readonly ActionManifestSource[];
|
|
28
|
+
readonly readFile?: ActionManifestReadFile;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Result of {@link loadActionManifests}. `entries` is the merged lookup map
|
|
32
|
+
* keyed by `${module}::${slug}`; `roleIndex` is the inverted index from role
|
|
33
|
+
* to entry keys. `warnings` is sorted deterministically.
|
|
34
|
+
*/
|
|
35
|
+
export interface LoadActionManifestsResult {
|
|
36
|
+
readonly entries: ReadonlyMap<string, ActionEntry>;
|
|
37
|
+
readonly roleIndex: ReadonlyMap<string, readonly string[]>;
|
|
38
|
+
readonly warnings: readonly ActionLoaderWarning[];
|
|
39
|
+
readonly loadedSources: readonly string[];
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Loads, validates, and merges the supplied manifest sources into a single
|
|
43
|
+
* registry suitable for the `dbx_action_lookup` MCP tool.
|
|
44
|
+
*
|
|
45
|
+
* @param input - Manifest sources plus an optional injected `readFile`
|
|
46
|
+
* @returns Merged entries, role index, deterministic warnings, and the list of source labels that loaded.
|
|
47
|
+
* @throws {Error} When a strict source fails or when zero manifests load successfully.
|
|
48
|
+
*/
|
|
49
|
+
export declare function loadActionManifests(input: LoadActionManifestsInput): Promise<LoadActionManifestsResult>;
|