@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
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Arktype schema for the `forgeFields` section of `dbx-mcp.scan.json`.
|
|
3
|
+
*
|
|
4
|
+
* Forge-field scanning lives next to the existing semantic-types and
|
|
5
|
+
* ui-components sections — all three use the same `dbx-mcp.scan.json`
|
|
6
|
+
* filename so a project that opts into multiple pipelines keeps a single
|
|
7
|
+
* config file. The CLI subcommand `scan-forge-fields` reads only the
|
|
8
|
+
* `forgeFields` field; sibling subcommands continue to read their own
|
|
9
|
+
* top-level fields unchanged.
|
|
10
|
+
*
|
|
11
|
+
* The schema is intentionally permissive at the root (extra keys are
|
|
12
|
+
* preserved untouched) so semantic-types and ui-components configs can
|
|
13
|
+
* coexist without cross-section validation.
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* Inner config that drives one forge-fields scan run. `source` becomes the
|
|
17
|
+
* manifest's `source` label (used for collision detection across loaded
|
|
18
|
+
* sources); `module` becomes the npm package name attached to every produced
|
|
19
|
+
* entry. Both default to the project's `package.json#name` when omitted.
|
|
20
|
+
*/
|
|
21
|
+
export declare const ForgeFieldsScanSection: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
22
|
+
include: string[];
|
|
23
|
+
source?: string | undefined;
|
|
24
|
+
module?: string | undefined;
|
|
25
|
+
exclude?: string[] | undefined;
|
|
26
|
+
out?: string | undefined;
|
|
27
|
+
}, {}>;
|
|
28
|
+
/**
|
|
29
|
+
* Static type inferred from {@link ForgeFieldsScanSection}.
|
|
30
|
+
*/
|
|
31
|
+
export type ForgeFieldsScanSection = typeof ForgeFieldsScanSection.infer;
|
|
32
|
+
/**
|
|
33
|
+
* Top-level shape used by the forge-fields builder. Only the `forgeFields`
|
|
34
|
+
* key is consumed; the rest of the document is ignored so a single
|
|
35
|
+
* `dbx-mcp.scan.json` can house all the scan sections side-by-side.
|
|
36
|
+
*/
|
|
37
|
+
export declare const ForgeFieldsScanConfig: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
38
|
+
version: 1;
|
|
39
|
+
forgeFields: {
|
|
40
|
+
include: string[];
|
|
41
|
+
source?: string | undefined;
|
|
42
|
+
module?: string | undefined;
|
|
43
|
+
exclude?: string[] | undefined;
|
|
44
|
+
out?: string | undefined;
|
|
45
|
+
};
|
|
46
|
+
}, {}>;
|
|
47
|
+
/**
|
|
48
|
+
* Static type inferred from {@link ForgeFieldsScanConfig}.
|
|
49
|
+
*/
|
|
50
|
+
export type ForgeFieldsScanConfig = typeof ForgeFieldsScanConfig.infer;
|
|
51
|
+
/**
|
|
52
|
+
* Default value used when the scan config does not specify `out`.
|
|
53
|
+
* Lives next to the scan config in the project root.
|
|
54
|
+
*/
|
|
55
|
+
export declare const DEFAULT_FORGE_FIELDS_SCAN_OUT_PATH = "forge-fields.mcp.generated.json";
|
|
56
|
+
/**
|
|
57
|
+
* Filename the loader looks for at `${projectRoot}/`. Re-exported here so
|
|
58
|
+
* the forge-fields CLI does not have to import from a sibling scan config
|
|
59
|
+
* module.
|
|
60
|
+
*/
|
|
61
|
+
export declare const FORGE_FIELDS_SCAN_CONFIG_FILENAME = "dbx-mcp.scan.json";
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Scan barrel for the dbx-components MCP scan infrastructure.
|
|
3
|
+
*
|
|
4
|
+
* Exposes the ts-morph-backed extractors, build-manifest helpers,
|
|
5
|
+
* scan-config schemas, and CLI entrypoints used by the
|
|
6
|
+
* `generate-mcp-manifest`-family CLIs and by runtime resources that
|
|
7
|
+
* scan workspace source for downstream models / discovery.
|
|
8
|
+
*/
|
|
9
|
+
export * from './scan-config-schema.js';
|
|
10
|
+
export * from './extract.js';
|
|
11
|
+
export * from './build-manifest.js';
|
|
12
|
+
export * from './cli.js';
|
|
13
|
+
export * from './filters-cli.js';
|
|
14
|
+
export * from './filters-extract.js';
|
|
15
|
+
export * from './filters-build-manifest.js';
|
|
16
|
+
export * from './filters-scan-config-schema.js';
|
|
17
|
+
export * from './actions-cli.js';
|
|
18
|
+
export * from './actions-extract.js';
|
|
19
|
+
export * from './actions-build-manifest.js';
|
|
20
|
+
export * from './actions-scan-config-schema.js';
|
|
21
|
+
export * from './auth-extract.js';
|
|
22
|
+
export * from './css-utilities-cli.js';
|
|
23
|
+
export * from './css-utilities-extract.js';
|
|
24
|
+
export * from './css-utilities-build-manifest.js';
|
|
25
|
+
export * from './css-utilities-scan-config-schema.js';
|
|
26
|
+
export * from './dbx-docs-ui-examples-cli.js';
|
|
27
|
+
export * from './dbx-docs-ui-examples-extract.js';
|
|
28
|
+
export * from './dbx-docs-ui-examples-build-manifest.js';
|
|
29
|
+
export * from './dbx-docs-ui-examples-scan-config-schema.js';
|
|
30
|
+
export * from './discover-downstream-packages.js';
|
|
31
|
+
export { discoverDownstreamFirebasePackages, resolveExplicitFirebasePackages } from './discover-firebase-packages.js';
|
|
32
|
+
export type { DownstreamFirebasePackage } from './discover-firebase-packages.js';
|
|
33
|
+
export * from './forge-fields-cli.js';
|
|
34
|
+
export * from './forge-fields-extract.js';
|
|
35
|
+
export * from './forge-fields-build-manifest.js';
|
|
36
|
+
export * from './forge-fields-scan-config-schema.js';
|
|
37
|
+
export * from './model-firebase-index-cli.js';
|
|
38
|
+
export * from './model-firebase-index-dispatcher-credit.js';
|
|
39
|
+
export * from './model-firebase-index-reference-scan.js';
|
|
40
|
+
export * from './model-snapshot-fields-cli.js';
|
|
41
|
+
export * from './model-snapshot-fields-extract.js';
|
|
42
|
+
export * from './model-snapshot-fields-build-manifest.js';
|
|
43
|
+
export * from './model-snapshot-fields-scan-config-schema.js';
|
|
44
|
+
export * from './pipes-cli.js';
|
|
45
|
+
export * from './pipes-extract.js';
|
|
46
|
+
export * from './pipes-build-manifest.js';
|
|
47
|
+
export * from './pipes-scan-config-schema.js';
|
|
48
|
+
export * from './scan-angular-io.js';
|
|
49
|
+
export { runScanCliBase, parseScanArgs } from './scan-cli-base.js';
|
|
50
|
+
export type { ScanCliBaseReadFile, ScanCliBaseWriteFile, ScanCliBaseLogger, ScanCliManifestLike, ScanCliBuildSuccess, ScanCliBuildFailure, ScanCliBuildOutcome, ScanCliBuildInput, ScanCliConfig, RunScanCliBaseInput } from './scan-cli-base.js';
|
|
51
|
+
export * from './ui-components-cli.js';
|
|
52
|
+
export type { ExtractedUiEntry, ExtractUiEntriesInput, ExtractUiEntriesResult, ExtractWarning as UiComponentExtractWarning } from './ui-components-extract.js';
|
|
53
|
+
export { extractUiEntries, ExtractedUiEntrySchema } from './ui-components-extract.js';
|
|
54
|
+
export * from './ui-components-build-manifest.js';
|
|
55
|
+
export * from './ui-components-scan-config-schema.js';
|
|
56
|
+
export * from './utils-cli.js';
|
|
57
|
+
export * from './utils-extract.js';
|
|
58
|
+
export * from './utils-build-manifest.js';
|
|
59
|
+
export * from './utils-scan-config-schema.js';
|
|
60
|
+
export * from './extract-models/index.js';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `scan-model-firebase-indexes` subcommand entry point.
|
|
3
|
+
*
|
|
4
|
+
* Thin wrapper around {@link runScanCliBase} that supplies the
|
|
5
|
+
* model-firebase-index domain config.
|
|
6
|
+
*/
|
|
7
|
+
import { type BuildModelFirebaseIndexGlobber } from '../../../../firestore-indexes/src/model-firebase-index-build-manifest.js';
|
|
8
|
+
import { type RunScanCliBaseInput, type RunScanCliResult, type ScanCliBaseLogger, type ScanCliBaseReadFile, type ScanCliBaseWriteFile } from './scan-cli-base.js';
|
|
9
|
+
export type ModelFirebaseIndexScanCliReadFile = ScanCliBaseReadFile;
|
|
10
|
+
export type ModelFirebaseIndexScanCliWriteFile = ScanCliBaseWriteFile;
|
|
11
|
+
export type ModelFirebaseIndexScanCliLogger = ScanCliBaseLogger;
|
|
12
|
+
export type RunModelFirebaseIndexScanCliInput = RunScanCliBaseInput<BuildModelFirebaseIndexGlobber>;
|
|
13
|
+
export type RunModelFirebaseIndexScanCliResult = RunScanCliResult;
|
|
14
|
+
/**
|
|
15
|
+
* Runs one invocation of `scan-model-firebase-indexes`. Never throws on
|
|
16
|
+
* user errors — every failure path returns a structured exit code so
|
|
17
|
+
* callers can wire this into `process.exit` without try/catch.
|
|
18
|
+
*
|
|
19
|
+
* @param input - Argv plus injectable I/O hooks.
|
|
20
|
+
* @returns The CLI's exit code (0 on success, 1 on drift / build failure, 2 on usage error)
|
|
21
|
+
*/
|
|
22
|
+
export declare function runModelFirebaseIndexScanCli(input: RunModelFirebaseIndexScanCliInput): Promise<RunModelFirebaseIndexScanCliResult>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Dispatcher → delegate caller-count credit table.
|
|
3
|
+
*
|
|
4
|
+
* Folds {@link FactoryReferenceCount}s for every tagged
|
|
5
|
+
* `@dbxModelFirebaseIndexDispatcher` into every factory the dispatcher
|
|
6
|
+
* delegates to by name. Consumed by `dbx_model_firebase_index_validate_app`
|
|
7
|
+
* and `dbx_model_firebase_index_list_app` so a primitive that is only
|
|
8
|
+
* reached through a dispatcher does not perpetually false-positive on
|
|
9
|
+
* `MODEL_FIREBASE_INDEX_UNUSED_FACTORY`.
|
|
10
|
+
*
|
|
11
|
+
* Lives in `scan/` (not under either tool) so the validator and list-app
|
|
12
|
+
* tools share a single resolution rule.
|
|
13
|
+
*/
|
|
14
|
+
import type { ModelFirebaseIndexDispatcherSummary } from '@dereekb/dbx-cli/firestore-indexes';
|
|
15
|
+
import type { FactoryReferenceCount } from './model-firebase-index-reference-scan.js';
|
|
16
|
+
/**
|
|
17
|
+
* Reference credit routed to one delegated factory through one or more
|
|
18
|
+
* dispatchers. Summed across every dispatcher whose body delegates to the
|
|
19
|
+
* factory.
|
|
20
|
+
*/
|
|
21
|
+
export interface DispatcherCredit {
|
|
22
|
+
readonly productionCount: number;
|
|
23
|
+
readonly specCount: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Builds the dispatcher → delegate credit table.
|
|
27
|
+
*
|
|
28
|
+
* For each summary in `dispatcherSummaries`, resolves the dispatcher's
|
|
29
|
+
* own scanner reference count (by slug) and folds it into every name in
|
|
30
|
+
* the dispatcher's `delegates` list. Dispatchers with zero references
|
|
31
|
+
* contribute nothing — there is nothing to credit. Multiple dispatchers
|
|
32
|
+
* delegating to the same factory sum their counts.
|
|
33
|
+
*
|
|
34
|
+
* @param dispatcherSummaries - Dispatcher entries surfaced by the build outcome.
|
|
35
|
+
* @param references - Per-slug reference counts from {@link scanFactoryReferences}.
|
|
36
|
+
* @returns Map keyed by delegate factory `name`.
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* const creditByName = buildDispatcherCreditByName(buildOutcome.dispatcherSummaries, references);
|
|
41
|
+
* const credit = creditByName.get(entry.name);
|
|
42
|
+
* if ((references.get(entry.slug)?.productionCount ?? 0) + (credit?.productionCount ?? 0) === 0) {
|
|
43
|
+
* // emit MODEL_FIREBASE_INDEX_UNUSED_FACTORY
|
|
44
|
+
* }
|
|
45
|
+
* ```
|
|
46
|
+
*/
|
|
47
|
+
export declare function buildDispatcherCreditByName(dispatcherSummaries: readonly ModelFirebaseIndexDispatcherSummary[], references: ReadonlyMap<string, FactoryReferenceCount>): ReadonlyMap<string, DispatcherCredit>;
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reference scanner for `@dbxModelFirebaseIndex`-tagged factories.
|
|
3
|
+
*
|
|
4
|
+
* Given a list of extracted entries and a glob of consumer `.ts` files,
|
|
5
|
+
* counts the external references to each factory by name. Used by
|
|
6
|
+
* `dbx_model_firebase_index_list_app` to surface the `referenceCount` +
|
|
7
|
+
* `referencedBy` columns, and by `dbx_model_firebase_index_validate_app`
|
|
8
|
+
* to emit `MODEL_FIREBASE_INDEX_UNUSED_FACTORY` when a non-skip /
|
|
9
|
+
* non-manual factory has zero external references.
|
|
10
|
+
*
|
|
11
|
+
* Scope: the consumers (`*_list_app`, `*_validate_app`) point the scan at
|
|
12
|
+
* the workspace root (`process.cwd()`) with workspace-wide globs covering
|
|
13
|
+
* `apps/**`, `components/**`, and `packages/**` so callers in sibling
|
|
14
|
+
* components, downstream apps, or shared packages are counted alongside
|
|
15
|
+
* intra-component references. {@link WORKSPACE_FACTORY_SCAN_INCLUDE} and
|
|
16
|
+
* {@link WORKSPACE_FACTORY_SCAN_EXCLUDE} are the canonical defaults.
|
|
17
|
+
*
|
|
18
|
+
* Implementation note: deliberately text-based rather than AST-based. The
|
|
19
|
+
* extractor's in-memory ts-morph project only contains `*.query.ts`
|
|
20
|
+
* files, so AST `findReferencesAsNodes()` would miss the actions /
|
|
21
|
+
* services / API callers that actually use these factories. Loading every
|
|
22
|
+
* consumer into ts-morph would be slow and would force the consumer of
|
|
23
|
+
* this module to expand the scan globs. A word-boundary text scan against
|
|
24
|
+
* the factory names is precise enough — collisions would require an
|
|
25
|
+
* unrelated identifier with the same exact name AND export-style
|
|
26
|
+
* `.query.ts` factory naming (e.g. `*Query`), which the existing factory-
|
|
27
|
+
* naming convention already rules out in practice.
|
|
28
|
+
*/
|
|
29
|
+
import { type ScanGlobber, type ScanReadFile } from '../../scan-helpers/scan-io.js';
|
|
30
|
+
import type { ExtractedModelFirebaseIndexEntry } from '@dereekb/dbx-cli/firestore-indexes';
|
|
31
|
+
/**
|
|
32
|
+
* One usage of a factory found in a consumer file.
|
|
33
|
+
*/
|
|
34
|
+
export interface FactoryReferenceSite {
|
|
35
|
+
readonly file: string;
|
|
36
|
+
readonly line: number;
|
|
37
|
+
/**
|
|
38
|
+
* True when the consumer file is a `*.spec.ts` (test) file. Used by the
|
|
39
|
+
* validator to enforce `@dbxModelFirebaseIndexSpecFilesOnly` semantics —
|
|
40
|
+
* spec-only factories may only have spec callers, and a regular factory's
|
|
41
|
+
* "unused" check still counts only non-spec callers.
|
|
42
|
+
*/
|
|
43
|
+
readonly isSpec: boolean;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Per-factory reference report. Keyed by the entry's `slug` in the
|
|
47
|
+
* scanner's return value. `count` is the total site count;
|
|
48
|
+
* `productionCount` / `specCount` partition it by whether the site lives
|
|
49
|
+
* in a `*.spec.ts` file. `referencedBy` carries every site (each tagged
|
|
50
|
+
* with `isSpec`) so consumers can render the full breakdown without
|
|
51
|
+
* re-counting.
|
|
52
|
+
*/
|
|
53
|
+
export interface FactoryReferenceCount {
|
|
54
|
+
readonly count: number;
|
|
55
|
+
readonly productionCount: number;
|
|
56
|
+
readonly specCount: number;
|
|
57
|
+
readonly referencedBy: readonly FactoryReferenceSite[];
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Input to {@link scanFactoryReferences}.
|
|
61
|
+
*/
|
|
62
|
+
export interface ScanFactoryReferencesInput {
|
|
63
|
+
readonly projectRoot: string;
|
|
64
|
+
readonly entries: readonly Pick<ExtractedModelFirebaseIndexEntry, 'slug' | 'name' | 'filePath'>[];
|
|
65
|
+
readonly include?: readonly string[];
|
|
66
|
+
readonly exclude?: readonly string[];
|
|
67
|
+
readonly readFile?: ScanReadFile;
|
|
68
|
+
readonly globber?: ScanGlobber;
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Canonical include-glob set the tool layer hands to {@link scanFactoryReferences}
|
|
72
|
+
* when the projectRoot is the workspace root. Covers every place a downstream
|
|
73
|
+
* project may call a tagged factory: apps, sibling components, and shared
|
|
74
|
+
* packages. Keep these aligned with the Nx workspace layout — the validator's
|
|
75
|
+
* `MODEL_FIREBASE_INDEX_UNUSED_FACTORY` warning is only useful if it sees
|
|
76
|
+
* every plausible call-site.
|
|
77
|
+
*/
|
|
78
|
+
export declare const WORKSPACE_FACTORY_SCAN_INCLUDE: readonly string[];
|
|
79
|
+
/**
|
|
80
|
+
* Canonical exclude-glob set paired with {@link WORKSPACE_FACTORY_SCAN_INCLUDE}.
|
|
81
|
+
* Strips ambient typings, build outputs, and `node_modules` so the
|
|
82
|
+
* workspace-wide scan stays fast. `*.spec.ts` files are intentionally KEPT
|
|
83
|
+
* so the scanner can flag spec callers (`isSpec: true`) — the validator
|
|
84
|
+
* uses that to enforce `@dbxModelFirebaseIndexSpecFilesOnly` and to treat
|
|
85
|
+
* spec-only references as "not a production caller" for the unused-factory
|
|
86
|
+
* warning.
|
|
87
|
+
*/
|
|
88
|
+
export declare const WORKSPACE_FACTORY_SCAN_EXCLUDE: readonly string[];
|
|
89
|
+
/**
|
|
90
|
+
* Counts external references to each entry's exported factory by name.
|
|
91
|
+
*
|
|
92
|
+
* Walks every `.ts` file under {@link projectRoot} (default
|
|
93
|
+
* `src/**\/*.ts`, excluding specs + `.d.ts`), reads it once, and scans
|
|
94
|
+
* for word-boundary occurrences of each factory name. References inside
|
|
95
|
+
* the factory's own declaration file are excluded — only callers count.
|
|
96
|
+
*
|
|
97
|
+
* @param input - Project root, the entries to count, optional glob + IO overrides for tests.
|
|
98
|
+
* @returns Map keyed by entry slug → reference count + locations.
|
|
99
|
+
*/
|
|
100
|
+
export declare function scanFactoryReferences(input: ScanFactoryReferencesInput): Promise<ReadonlyMap<string, FactoryReferenceCount>>;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orchestrator for the `scan-model-snapshot-fields` generator.
|
|
3
|
+
*
|
|
4
|
+
* Composes a complete {@link ModelSnapshotFieldManifest} from a project
|
|
5
|
+
* root by
|
|
6
|
+
*
|
|
7
|
+
* 1. reading `dbx-mcp.scan.json` against {@link ModelSnapshotFieldsScanConfig}
|
|
8
|
+
* 2. reading `package.json` to derive the entry-level `module` field
|
|
9
|
+
* 3. resolving include/exclude globs against the project root
|
|
10
|
+
* 4. feeding matched files into a ts-morph project
|
|
11
|
+
* 5. extracting entries via {@link extractModelSnapshotFieldEntries}
|
|
12
|
+
* 6. assembling the manifest envelope and validating it against
|
|
13
|
+
* {@link ModelSnapshotFieldManifest}
|
|
14
|
+
*
|
|
15
|
+
* I/O is fully injectable so tests drive every code path without
|
|
16
|
+
* touching the real filesystem.
|
|
17
|
+
*/
|
|
18
|
+
import { ModelSnapshotFieldManifest } from '../manifest/model-snapshot-fields-schema.js';
|
|
19
|
+
import { type ModelSnapshotFieldExtractWarning } from './model-snapshot-fields-extract.js';
|
|
20
|
+
import { type ScanGlobber, type ScanReadFile } from '../../scan-helpers/scan-io.js';
|
|
21
|
+
export type BuildModelSnapshotFieldsReadFile = ScanReadFile;
|
|
22
|
+
export type BuildModelSnapshotFieldsGlobber = ScanGlobber;
|
|
23
|
+
/**
|
|
24
|
+
* Input to {@link buildModelSnapshotFieldsManifest}.
|
|
25
|
+
*/
|
|
26
|
+
export interface BuildModelSnapshotFieldsManifestInput {
|
|
27
|
+
readonly projectRoot: string;
|
|
28
|
+
readonly generator: string;
|
|
29
|
+
readonly now?: () => Date;
|
|
30
|
+
readonly readFile?: BuildModelSnapshotFieldsReadFile;
|
|
31
|
+
readonly globber?: BuildModelSnapshotFieldsGlobber;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Outcome of one generator run. The success payload carries everything
|
|
35
|
+
* the caller needs to write the manifest to disk or run a freshness diff
|
|
36
|
+
* against an existing on-disk version.
|
|
37
|
+
*/
|
|
38
|
+
export type BuildModelSnapshotFieldsManifestOutcome = {
|
|
39
|
+
readonly kind: 'success';
|
|
40
|
+
readonly manifest: ModelSnapshotFieldManifest;
|
|
41
|
+
readonly outPath: string;
|
|
42
|
+
readonly scannedFileCount: number;
|
|
43
|
+
readonly extractWarnings: readonly ModelSnapshotFieldExtractWarning[];
|
|
44
|
+
} | {
|
|
45
|
+
readonly kind: 'no-config';
|
|
46
|
+
readonly configPath: string;
|
|
47
|
+
} | {
|
|
48
|
+
readonly kind: 'invalid-scan-config';
|
|
49
|
+
readonly configPath: string;
|
|
50
|
+
readonly error: string;
|
|
51
|
+
} | {
|
|
52
|
+
readonly kind: 'no-package';
|
|
53
|
+
readonly packagePath: string;
|
|
54
|
+
} | {
|
|
55
|
+
readonly kind: 'invalid-package';
|
|
56
|
+
readonly packagePath: string;
|
|
57
|
+
readonly error: string;
|
|
58
|
+
} | {
|
|
59
|
+
readonly kind: 'invalid-manifest';
|
|
60
|
+
readonly error: string;
|
|
61
|
+
};
|
|
62
|
+
/**
|
|
63
|
+
* Builds a {@link ModelSnapshotFieldManifest} from the supplied project
|
|
64
|
+
* root. The function is pure with respect to the injected I/O hooks, so
|
|
65
|
+
* unit tests can drive every branch without disk access.
|
|
66
|
+
*
|
|
67
|
+
* @param input - The project root + injection hooks for testing.
|
|
68
|
+
* @returns A discriminated outcome describing the result.
|
|
69
|
+
*/
|
|
70
|
+
export declare function buildModelSnapshotFieldsManifest(input: BuildModelSnapshotFieldsManifestInput): Promise<BuildModelSnapshotFieldsManifestOutcome>;
|
|
71
|
+
/**
|
|
72
|
+
* JSON-stringifies a manifest with stable key ordering and trailing
|
|
73
|
+
* newline so `--check` mode can byte-compare against a committed file
|
|
74
|
+
* without false-positive diffs from key reordering.
|
|
75
|
+
*
|
|
76
|
+
* @param manifest - The manifest to serialise.
|
|
77
|
+
* @returns The canonical string form.
|
|
78
|
+
*/
|
|
79
|
+
export declare function serializeModelSnapshotFieldsManifest(manifest: ModelSnapshotFieldManifest): string;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `scan-model-snapshot-fields` subcommand entry point.
|
|
3
|
+
*
|
|
4
|
+
* Thin wrapper around {@link runScanCliBase} that supplies the
|
|
5
|
+
* model-snapshot-fields domain config.
|
|
6
|
+
*/
|
|
7
|
+
import { type BuildModelSnapshotFieldsGlobber } from './model-snapshot-fields-build-manifest.js';
|
|
8
|
+
import { type RunScanCliBaseInput, type RunScanCliResult, type ScanCliBaseLogger, type ScanCliBaseReadFile, type ScanCliBaseWriteFile } from './scan-cli-base.js';
|
|
9
|
+
/**
|
|
10
|
+
* Function shape used to read text files during `--check`.
|
|
11
|
+
*/
|
|
12
|
+
export type ModelSnapshotFieldsScanCliReadFile = ScanCliBaseReadFile;
|
|
13
|
+
/**
|
|
14
|
+
* Function shape used to write the produced manifest in write mode.
|
|
15
|
+
*/
|
|
16
|
+
export type ModelSnapshotFieldsScanCliWriteFile = ScanCliBaseWriteFile;
|
|
17
|
+
/**
|
|
18
|
+
* Console-shaped sink for stdout and stderr lines.
|
|
19
|
+
*/
|
|
20
|
+
export type ModelSnapshotFieldsScanCliLogger = ScanCliBaseLogger;
|
|
21
|
+
/**
|
|
22
|
+
* Input to {@link runModelSnapshotFieldsScanCli}.
|
|
23
|
+
*/
|
|
24
|
+
export type RunModelSnapshotFieldsScanCliInput = RunScanCliBaseInput<BuildModelSnapshotFieldsGlobber>;
|
|
25
|
+
/**
|
|
26
|
+
* Result of one CLI invocation.
|
|
27
|
+
*/
|
|
28
|
+
export type RunModelSnapshotFieldsScanCliResult = RunScanCliResult;
|
|
29
|
+
/**
|
|
30
|
+
* Runs one invocation of `scan-model-snapshot-fields`. Never throws on
|
|
31
|
+
* user errors — every failure path returns a structured exit code so
|
|
32
|
+
* callers can wire this into `process.exit` without try/catch.
|
|
33
|
+
*
|
|
34
|
+
* @param input - Argv plus injectable I/O hooks.
|
|
35
|
+
* @returns The CLI's exit code (0 on success, 1 on drift / build failure, 2 on usage error)
|
|
36
|
+
*/
|
|
37
|
+
export declare function runModelSnapshotFieldsScanCli(input: RunModelSnapshotFieldsScanCliInput): Promise<RunModelSnapshotFieldsScanCliResult>;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AST extraction for the `scan-model-snapshot-fields` generator.
|
|
3
|
+
*
|
|
4
|
+
* Walks every source file in the supplied ts-morph `Project` looking for
|
|
5
|
+
* top-level exported declarations (functions, `const` variable statements)
|
|
6
|
+
* tagged with the `@dbxModelSnapshotField` JSDoc marker. Each match is
|
|
7
|
+
* normalised into an {@link ExtractedModelSnapshotFieldEntry} that
|
|
8
|
+
* {@link buildModelSnapshotFieldsManifest} assembles into a
|
|
9
|
+
* `ModelSnapshotFieldManifest` entry.
|
|
10
|
+
*
|
|
11
|
+
* Optional sub-tags supply overrides that can't be reliably auto-derived
|
|
12
|
+
* (slug, category, tags, related slugs, skill refs, kind, optional flag).
|
|
13
|
+
* Sensible defaults are computed for each from the source — kebab-case of
|
|
14
|
+
* the export name, the parent folder of the source file, the export name +
|
|
15
|
+
* first JSDoc paragraph tokens, the `optional` name-prefix heuristic for
|
|
16
|
+
* `optionalFirestore*` variants, etc.
|
|
17
|
+
*
|
|
18
|
+
* Mirrors the `utils-extract.ts` shape one-to-one so the same scanner
|
|
19
|
+
* mental model applies. The differences:
|
|
20
|
+
* - kind is restricted to `factory | const` (no class/function variants —
|
|
21
|
+
* a snapshot field is always either a factory call or a pre-built const)
|
|
22
|
+
* - an `optional: boolean` field is captured for the `optionalFirestore*`
|
|
23
|
+
* name-prefix family so the lookup tool can flag required vs. optional
|
|
24
|
+
* variants and the registry can cross-link them via `relatedSlugs`.
|
|
25
|
+
*/
|
|
26
|
+
import { type Project } from 'ts-morph';
|
|
27
|
+
import type { ModelSnapshotFieldKindValue, ModelSnapshotFieldParamEntry } from '../manifest/model-snapshot-fields-schema.js';
|
|
28
|
+
/**
|
|
29
|
+
* One snapshot-field entry extracted from a source file. Mirrors
|
|
30
|
+
* {@link ModelSnapshotFieldEntry} minus `module` (derived from the package
|
|
31
|
+
* being scanned in build-manifest) and `subpath` (also derived in
|
|
32
|
+
* build-manifest from the project root). `filePath` and `line` are kept for
|
|
33
|
+
* in-process warnings and never persisted to the manifest.
|
|
34
|
+
*/
|
|
35
|
+
export interface ExtractedModelSnapshotFieldEntry {
|
|
36
|
+
readonly slug: string;
|
|
37
|
+
readonly name: string;
|
|
38
|
+
readonly kind: ModelSnapshotFieldKindValue;
|
|
39
|
+
readonly category: string;
|
|
40
|
+
readonly signature: string;
|
|
41
|
+
readonly description: string;
|
|
42
|
+
readonly optional: boolean;
|
|
43
|
+
readonly params: readonly ModelSnapshotFieldParamEntry[];
|
|
44
|
+
readonly returns: string;
|
|
45
|
+
readonly tags: readonly string[];
|
|
46
|
+
readonly relatedSlugs?: readonly string[];
|
|
47
|
+
readonly skillRefs?: readonly string[];
|
|
48
|
+
readonly example: string;
|
|
49
|
+
readonly deprecated?: boolean | string;
|
|
50
|
+
readonly since?: string;
|
|
51
|
+
readonly filePath: string;
|
|
52
|
+
readonly line: number;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Discriminated union of the non-fatal events the extractor emits when an
|
|
56
|
+
* entry can't be assembled. Build-manifest collates these into a structured
|
|
57
|
+
* warning array so missing/invalid tag combinations surface during
|
|
58
|
+
* generation rather than silently dropping entries.
|
|
59
|
+
*/
|
|
60
|
+
export type ModelSnapshotFieldExtractWarning = {
|
|
61
|
+
readonly kind: 'unsupported-kind-override';
|
|
62
|
+
readonly name: string;
|
|
63
|
+
readonly override: string;
|
|
64
|
+
readonly filePath: string;
|
|
65
|
+
readonly line: number;
|
|
66
|
+
} | {
|
|
67
|
+
readonly kind: 'missing-name';
|
|
68
|
+
readonly filePath: string;
|
|
69
|
+
readonly line: number;
|
|
70
|
+
} | {
|
|
71
|
+
readonly kind: 'duplicate-slug';
|
|
72
|
+
readonly name: string;
|
|
73
|
+
readonly slug: string;
|
|
74
|
+
readonly previousName: string;
|
|
75
|
+
readonly filePath: string;
|
|
76
|
+
readonly line: number;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Input to {@link extractModelSnapshotFieldEntries}. The caller is
|
|
80
|
+
* responsible for adding source files to `project`.
|
|
81
|
+
*/
|
|
82
|
+
export interface ExtractModelSnapshotFieldEntriesInput {
|
|
83
|
+
readonly project: Project;
|
|
84
|
+
/**
|
|
85
|
+
* Repo-relative project root (e.g. `packages/firebase`). The extractor
|
|
86
|
+
* uses this so it can drop the project prefix from the warning `filePath`
|
|
87
|
+
* fields and so the build-manifest layer can compute `subpath` against a
|
|
88
|
+
* stable base.
|
|
89
|
+
*/
|
|
90
|
+
readonly projectRoot?: string;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Result of {@link extractModelSnapshotFieldEntries}.
|
|
94
|
+
*/
|
|
95
|
+
export interface ExtractModelSnapshotFieldEntriesResult {
|
|
96
|
+
readonly entries: readonly ExtractedModelSnapshotFieldEntry[];
|
|
97
|
+
readonly warnings: readonly ModelSnapshotFieldExtractWarning[];
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Walks the supplied project and returns every export tagged with the
|
|
101
|
+
* `@dbxModelSnapshotField` JSDoc marker. Order is stable: source files in
|
|
102
|
+
* the order ts-morph reports them, declarations within a file in source order.
|
|
103
|
+
*
|
|
104
|
+
* @param input - The ts-morph project to scan.
|
|
105
|
+
* @returns The extracted entries plus any non-fatal warnings.
|
|
106
|
+
*/
|
|
107
|
+
export declare function extractModelSnapshotFieldEntries(input: ExtractModelSnapshotFieldEntriesInput): ExtractModelSnapshotFieldEntriesResult;
|
|
108
|
+
/**
|
|
109
|
+
* Heuristic that flags `optionalFirestore*` exports as optional. The user
|
|
110
|
+
* can override this with `@dbxModelSnapshotFieldOptional false`.
|
|
111
|
+
*
|
|
112
|
+
* @param name - The export identifier.
|
|
113
|
+
* @returns True when the name signals an optional variant.
|
|
114
|
+
*/
|
|
115
|
+
export declare function deriveOptionalFromName(name: string): boolean;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Arktype schema for the `modelSnapshotFields` section of `dbx-mcp.scan.json`.
|
|
3
|
+
*
|
|
4
|
+
* Model-snapshot-fields scanning lives next to the existing semantic-types,
|
|
5
|
+
* ui-components, forge-fields, pipes, and utils sections — all use the same
|
|
6
|
+
* `dbx-mcp.scan.json` filename so a project that opts into multiple
|
|
7
|
+
* pipelines keeps a single config file. The CLI subcommand
|
|
8
|
+
* `scan-model-snapshot-fields` reads only the `modelSnapshotFields` field;
|
|
9
|
+
* sibling subcommands continue to read their own top-level fields unchanged.
|
|
10
|
+
*/
|
|
11
|
+
/**
|
|
12
|
+
* Inner config that drives one model-snapshot-fields scan run. `source`
|
|
13
|
+
* becomes the manifest's `source` label (used for collision detection across
|
|
14
|
+
* loaded sources); `module` becomes the npm package name attached to every
|
|
15
|
+
* produced entry. Both default to the project's `package.json#name` when
|
|
16
|
+
* omitted.
|
|
17
|
+
*/
|
|
18
|
+
export declare const ModelSnapshotFieldsScanSection: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
19
|
+
include: string[];
|
|
20
|
+
source?: string | undefined;
|
|
21
|
+
module?: string | undefined;
|
|
22
|
+
exclude?: string[] | undefined;
|
|
23
|
+
out?: string | undefined;
|
|
24
|
+
}, {}>;
|
|
25
|
+
/**
|
|
26
|
+
* Static type inferred from {@link ModelSnapshotFieldsScanSection}.
|
|
27
|
+
*/
|
|
28
|
+
export type ModelSnapshotFieldsScanSection = typeof ModelSnapshotFieldsScanSection.infer;
|
|
29
|
+
/**
|
|
30
|
+
* Top-level shape used by the model-snapshot-fields builder. Only the
|
|
31
|
+
* `modelSnapshotFields` key is consumed; the rest of the document is ignored
|
|
32
|
+
* so a single `dbx-mcp.scan.json` can house all the scan sections
|
|
33
|
+
* side-by-side.
|
|
34
|
+
*/
|
|
35
|
+
export declare const ModelSnapshotFieldsScanConfig: import("arktype/internal/variants/object.ts").ObjectType<{
|
|
36
|
+
version: 1;
|
|
37
|
+
modelSnapshotFields: {
|
|
38
|
+
include: string[];
|
|
39
|
+
source?: string | undefined;
|
|
40
|
+
module?: string | undefined;
|
|
41
|
+
exclude?: string[] | undefined;
|
|
42
|
+
out?: string | undefined;
|
|
43
|
+
};
|
|
44
|
+
}, {}>;
|
|
45
|
+
/**
|
|
46
|
+
* Static type inferred from {@link ModelSnapshotFieldsScanConfig}.
|
|
47
|
+
*/
|
|
48
|
+
export type ModelSnapshotFieldsScanConfig = typeof ModelSnapshotFieldsScanConfig.infer;
|
|
49
|
+
/**
|
|
50
|
+
* Default value used when the scan config does not specify `out`.
|
|
51
|
+
* Lives next to the scan config in the project root.
|
|
52
|
+
*/
|
|
53
|
+
export declare const DEFAULT_MODEL_SNAPSHOT_FIELDS_SCAN_OUT_PATH = "model-snapshot-fields.mcp.generated.json";
|
|
54
|
+
/**
|
|
55
|
+
* Filename the loader looks for at `${projectRoot}/`. Re-exported here so
|
|
56
|
+
* the model-snapshot-fields CLI does not have to import from a sibling scan
|
|
57
|
+
* config module.
|
|
58
|
+
*/
|
|
59
|
+
export declare const MODEL_SNAPSHOT_FIELDS_SCAN_CONFIG_FILENAME = "dbx-mcp.scan.json";
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Orchestrator for the `scan-pipes` generator.
|
|
3
|
+
*
|
|
4
|
+
* Composes a complete {@link PipeManifest} from a project root by
|
|
5
|
+
*
|
|
6
|
+
* 1. reading `dbx-mcp.scan.json` against {@link PipesScanConfig}
|
|
7
|
+
* 2. reading `package.json` to derive the entry-level `module` field
|
|
8
|
+
* 3. resolving include/exclude globs against the project root
|
|
9
|
+
* 4. feeding matched files into a ts-morph project
|
|
10
|
+
* 5. extracting entries via {@link extractPipeEntries}
|
|
11
|
+
* 6. assembling the manifest envelope and validating it against
|
|
12
|
+
* {@link PipeManifest}
|
|
13
|
+
*
|
|
14
|
+
* I/O is fully injectable so tests drive every code path without touching
|
|
15
|
+
* the real filesystem.
|
|
16
|
+
*/
|
|
17
|
+
import { PipeManifest } from '../manifest/pipes-schema.js';
|
|
18
|
+
import { type PipeExtractWarning } from './pipes-extract.js';
|
|
19
|
+
import { type ScanGlobber, type ScanReadFile } from '../../scan-helpers/scan-io.js';
|
|
20
|
+
export type BuildPipesReadFile = ScanReadFile;
|
|
21
|
+
export type BuildPipesGlobber = ScanGlobber;
|
|
22
|
+
/**
|
|
23
|
+
* Input to {@link buildPipesManifest}.
|
|
24
|
+
*/
|
|
25
|
+
export interface BuildPipesManifestInput {
|
|
26
|
+
readonly projectRoot: string;
|
|
27
|
+
readonly generator: string;
|
|
28
|
+
readonly now?: () => Date;
|
|
29
|
+
readonly readFile?: BuildPipesReadFile;
|
|
30
|
+
readonly globber?: BuildPipesGlobber;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Outcome of one generator run. The success payload carries everything the
|
|
34
|
+
* caller needs to write the manifest to disk or run a freshness diff against
|
|
35
|
+
* an existing on-disk version.
|
|
36
|
+
*/
|
|
37
|
+
export type BuildPipesManifestOutcome = {
|
|
38
|
+
readonly kind: 'success';
|
|
39
|
+
readonly manifest: PipeManifest;
|
|
40
|
+
readonly outPath: string;
|
|
41
|
+
readonly scannedFileCount: number;
|
|
42
|
+
readonly extractWarnings: readonly PipeExtractWarning[];
|
|
43
|
+
} | {
|
|
44
|
+
readonly kind: 'no-config';
|
|
45
|
+
readonly configPath: string;
|
|
46
|
+
} | {
|
|
47
|
+
readonly kind: 'invalid-scan-config';
|
|
48
|
+
readonly configPath: string;
|
|
49
|
+
readonly error: string;
|
|
50
|
+
} | {
|
|
51
|
+
readonly kind: 'no-package';
|
|
52
|
+
readonly packagePath: string;
|
|
53
|
+
} | {
|
|
54
|
+
readonly kind: 'invalid-package';
|
|
55
|
+
readonly packagePath: string;
|
|
56
|
+
readonly error: string;
|
|
57
|
+
} | {
|
|
58
|
+
readonly kind: 'invalid-manifest';
|
|
59
|
+
readonly error: string;
|
|
60
|
+
};
|
|
61
|
+
/**
|
|
62
|
+
* Builds a {@link PipeManifest} from the supplied project root. The function
|
|
63
|
+
* is pure with respect to the injected I/O hooks, so unit tests can drive
|
|
64
|
+
* every branch without disk access.
|
|
65
|
+
*
|
|
66
|
+
* @param input - The project root + injection hooks for testing.
|
|
67
|
+
* @returns A discriminated outcome describing the result.
|
|
68
|
+
*/
|
|
69
|
+
export declare function buildPipesManifest(input: BuildPipesManifestInput): Promise<BuildPipesManifestOutcome>;
|
|
70
|
+
/**
|
|
71
|
+
* JSON-stringifies a manifest with stable key ordering and trailing newline so
|
|
72
|
+
* `--check` mode can byte-compare against a committed file without
|
|
73
|
+
* false-positive diffs from key reordering.
|
|
74
|
+
*
|
|
75
|
+
* @param manifest - The manifest to serialise.
|
|
76
|
+
* @returns The canonical string form.
|
|
77
|
+
*/
|
|
78
|
+
export declare function serializePipeManifest(manifest: PipeManifest): string;
|