@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.
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/main.js +1314 -0
  17. package/generate-mcp-manifest/package.json +6 -0
  18. package/generated/firebase-models.generated.d.ts +3 -0
  19. package/index.cjs.js +45614 -640
  20. package/index.esm.js +45321 -643
  21. package/lint-cache/main.js +32 -28
  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 +127 -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,82 @@
1
+ /**
2
+ * AST extraction for the `scan-semantic-types` generator.
3
+ *
4
+ * Walks every source file in the supplied ts-morph `Project` looking for
5
+ * top-level exported type aliases and interfaces tagged with the
6
+ * `@semanticType` JSDoc marker. Each match is normalised into an
7
+ * {@link ExtractedEntry} that {@link buildManifest} will assemble into a
8
+ * `SemanticTypeManifest` entry.
9
+ *
10
+ * Topic validation is **not** performed here. The generator emits whatever
11
+ * the source code declares; the loader (Step 1) handles core/namespaced
12
+ * topic enforcement at consumption time. That separation keeps this
13
+ * module purely syntactic.
14
+ */
15
+ import { type Project } from 'ts-morph';
16
+ import { type SemanticTypeEntry } from '../manifest/semantic-types-schema.js';
17
+ /**
18
+ * One semantic-type extracted from a source file. Mirrors the
19
+ * {@link SemanticTypeEntry} shape minus `package` and `module` (which are
20
+ * derived in {@link buildManifest}). Topic strings are passed through
21
+ * verbatim — the loader applies vocabulary rules at consumption time.
22
+ */
23
+ export interface ExtractedEntry {
24
+ readonly name: string;
25
+ readonly kind: 'semantic-type' | 'type-alias';
26
+ readonly definition: string;
27
+ readonly baseType: SemanticTypeEntry['baseType'];
28
+ readonly topics: readonly string[];
29
+ readonly unionValues?: readonly string[];
30
+ readonly typeParameters?: readonly string[];
31
+ readonly guards: readonly string[];
32
+ readonly factories: readonly string[];
33
+ readonly examples: readonly {
34
+ readonly caption?: string;
35
+ readonly code: string;
36
+ }[];
37
+ readonly notes?: string;
38
+ readonly deprecated?: boolean | string;
39
+ readonly since?: string;
40
+ readonly filePath: string;
41
+ readonly line: number;
42
+ }
43
+ /**
44
+ * Input to {@link extractEntries}. The caller is responsible for adding
45
+ * source files to `project` (either from disk, in-memory fixtures, or
46
+ * a tsconfig).
47
+ */
48
+ export interface ExtractEntriesInput {
49
+ readonly project: Project;
50
+ }
51
+ /**
52
+ * Walks the supplied ts-morph project and returns every type/interface entry tagged with the dbx semantic-type marker.
53
+ *
54
+ * @param input - The extraction context.
55
+ * @param input.project - The ts-morph project containing source files to scan.
56
+ * @returns The extracted entries in source-file order.
57
+ */
58
+ export declare function extractEntries(input: ExtractEntriesInput): readonly ExtractedEntry[];
59
+ /**
60
+ * Arktype validator that mirrors {@link ExtractedEntry}. Useful for
61
+ * tests and for runtime-validating fixture entries crafted by hand.
62
+ */
63
+ export declare const ExtractedEntrySchema: import("arktype/internal/variants/object.ts").ObjectType<{
64
+ name: string;
65
+ kind: "semantic-type" | "type-alias";
66
+ definition: string;
67
+ baseType: "string" | "number" | "boolean" | "object" | "branded" | "union-literal" | "template-literal" | "other";
68
+ topics: string[];
69
+ guards: string[];
70
+ factories: string[];
71
+ examples: {
72
+ code: string;
73
+ caption?: string | undefined;
74
+ }[];
75
+ filePath: string;
76
+ line: number;
77
+ unionValues?: string[] | undefined;
78
+ typeParameters?: string[] | undefined;
79
+ notes?: string | undefined;
80
+ deprecated?: string | boolean | undefined;
81
+ since?: string | undefined;
82
+ }, {}>;
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Orchestrator for the `scan-filters` generator.
3
+ *
4
+ * Composes a complete {@link FilterManifest} from a project root by
5
+ *
6
+ * 1. reading `dbx-mcp.scan.json` against {@link FiltersScanConfig}
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 extractFilterEntries}
11
+ * 6. assembling the manifest envelope and validating it against
12
+ * {@link FilterManifest}
13
+ *
14
+ * I/O is fully injectable so tests drive every code path without touching
15
+ * the real filesystem.
16
+ */
17
+ import { FilterManifest } from '../manifest/filters-schema.js';
18
+ import { type FilterExtractWarning } from './filters-extract.js';
19
+ import { type ScanGlobber, type ScanReadFile } from '../../scan-helpers/scan-io.js';
20
+ export type BuildFiltersReadFile = ScanReadFile;
21
+ export type BuildFiltersGlobber = ScanGlobber;
22
+ /**
23
+ * Input to {@link buildFiltersManifest}.
24
+ */
25
+ export interface BuildFiltersManifestInput {
26
+ readonly projectRoot: string;
27
+ readonly generator: string;
28
+ readonly now?: () => Date;
29
+ readonly readFile?: BuildFiltersReadFile;
30
+ readonly globber?: BuildFiltersGlobber;
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 BuildFiltersManifestOutcome = {
38
+ readonly kind: 'success';
39
+ readonly manifest: FilterManifest;
40
+ readonly outPath: string;
41
+ readonly scannedFileCount: number;
42
+ readonly extractWarnings: readonly FilterExtractWarning[];
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 FilterManifest} 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 buildFiltersManifest(input: BuildFiltersManifestInput): Promise<BuildFiltersManifestOutcome>;
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 serializeFilterManifest(manifest: FilterManifest): string;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * `scan-filters` subcommand entry point.
3
+ *
4
+ * Thin wrapper around {@link runScanCliBase} that supplies the filters
5
+ * domain config.
6
+ */
7
+ import { type BuildFiltersGlobber } from './filters-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 FiltersScanCliReadFile = ScanCliBaseReadFile;
13
+ /**
14
+ * Function shape used to write the produced manifest in write mode.
15
+ */
16
+ export type FiltersScanCliWriteFile = ScanCliBaseWriteFile;
17
+ /**
18
+ * Console-shaped sink for stdout and stderr lines.
19
+ */
20
+ export type FiltersScanCliLogger = ScanCliBaseLogger;
21
+ /**
22
+ * Input to {@link runFiltersScanCli}.
23
+ */
24
+ export type RunFiltersScanCliInput = RunScanCliBaseInput<BuildFiltersGlobber>;
25
+ /**
26
+ * Result of one CLI invocation.
27
+ */
28
+ export type RunFiltersScanCliResult = RunScanCliResult;
29
+ /**
30
+ * Runs one invocation of `scan-filters`. Never throws on user errors —
31
+ * every failure path returns a structured exit code so callers can wire
32
+ * 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 runFiltersScanCli(input: RunFiltersScanCliInput): Promise<RunFiltersScanCliResult>;
@@ -0,0 +1,101 @@
1
+ /**
2
+ * AST extraction for the `scan-filters` generator.
3
+ *
4
+ * Walks every source file in the supplied ts-morph `Project` looking for
5
+ * two entry shapes:
6
+ *
7
+ * - Classes with `@Directive()` decorator and `@dbxFilter` JSDoc marker → directive entries
8
+ * - Interfaces with `@dbxFilter` JSDoc marker → pattern entries
9
+ *
10
+ * The kind discriminator is inferred from the AST shape — classes produce
11
+ * `directive` entries, interfaces produce `pattern` entries — so callers
12
+ * don't need to repeat that fact in JSDoc. JSDoc tags only supply registry
13
+ * metadata that can't be derived from source (slug, related slugs, skill
14
+ * refs).
15
+ */
16
+ import { type Project } from 'ts-morph';
17
+ import type { FilterInputEntry } from '../manifest/filters-schema.js';
18
+ /**
19
+ * One directive entry extracted from a source file. `module` is supplied by
20
+ * the build phase. `filePath` and `line` are kept for in-process warnings
21
+ * and never persisted.
22
+ */
23
+ export interface ExtractedFilterDirective {
24
+ readonly kind: 'directive';
25
+ readonly slug: string;
26
+ readonly selector: string;
27
+ readonly className: string;
28
+ readonly description: string;
29
+ readonly inputs: readonly FilterInputEntry[];
30
+ readonly outputs: readonly FilterInputEntry[];
31
+ readonly relatedSlugs?: readonly string[];
32
+ readonly skillRefs?: readonly string[];
33
+ readonly example: string;
34
+ readonly deprecated?: boolean | string;
35
+ readonly since?: string;
36
+ readonly filePath: string;
37
+ readonly line: number;
38
+ }
39
+ /**
40
+ * One pattern entry extracted from a source file (interface declaration).
41
+ */
42
+ export interface ExtractedFilterPattern {
43
+ readonly kind: 'pattern';
44
+ readonly slug: string;
45
+ readonly className: string;
46
+ readonly description: string;
47
+ readonly relatedSlugs?: readonly string[];
48
+ readonly skillRefs?: readonly string[];
49
+ readonly example: string;
50
+ readonly deprecated?: boolean | string;
51
+ readonly since?: string;
52
+ readonly filePath: string;
53
+ readonly line: number;
54
+ }
55
+ /**
56
+ * Discriminated union of every filter entry shape.
57
+ */
58
+ export type ExtractedFilterEntry = ExtractedFilterDirective | ExtractedFilterPattern;
59
+ /**
60
+ * Discriminated union of the non-fatal events the extractor emits when an
61
+ * entry can't be assembled. Build-manifest collates these into a structured
62
+ * warning array so missing/invalid tag combinations surface during
63
+ * generation rather than silently dropping entries.
64
+ */
65
+ export type FilterExtractWarning = {
66
+ readonly kind: 'missing-required-tag';
67
+ readonly className: string;
68
+ readonly tag: string;
69
+ readonly filePath: string;
70
+ readonly line: number;
71
+ } | {
72
+ readonly kind: 'directive-missing-decorator';
73
+ readonly className: string;
74
+ readonly filePath: string;
75
+ readonly line: number;
76
+ };
77
+ /**
78
+ * Input to {@link extractFilterEntries}. The caller is responsible for adding
79
+ * source files to `project`.
80
+ */
81
+ export interface ExtractFilterEntriesInput {
82
+ readonly project: Project;
83
+ }
84
+ /**
85
+ * Result of {@link extractFilterEntries}.
86
+ */
87
+ export interface ExtractFilterEntriesResult {
88
+ readonly entries: readonly ExtractedFilterEntry[];
89
+ readonly warnings: readonly FilterExtractWarning[];
90
+ }
91
+ /**
92
+ * Walks the supplied project and returns every entry tagged with the
93
+ * `@dbxFilter` JSDoc marker. Order is stable: source files in the order
94
+ * ts-morph reports them, declarations within a file in source order
95
+ * (classes before interfaces is not guaranteed — both share the file's
96
+ * declaration order through ts-morph's class/interface accessors).
97
+ *
98
+ * @param input - The ts-morph project to scan.
99
+ * @returns The extracted entries plus any non-fatal warnings.
100
+ */
101
+ export declare function extractFilterEntries(input: ExtractFilterEntriesInput): ExtractFilterEntriesResult;
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Arktype schema for the `filters` section of `dbx-mcp.scan.json`.
3
+ *
4
+ * Filters scanning lives next to the existing semantic-types, ui-components,
5
+ * forge-fields, pipes, and actions sections — all use the same
6
+ * `dbx-mcp.scan.json` filename so a project that opts into multiple pipelines
7
+ * keeps a single config file. The CLI subcommand `scan-filters` reads only
8
+ * the `filters` field; sibling subcommands continue to read their own
9
+ * top-level fields unchanged.
10
+ */
11
+ /**
12
+ * Inner config that drives one filters scan run. `source` becomes the
13
+ * manifest's `source` label (used for collision detection across loaded
14
+ * sources); `module` becomes the npm package name attached to every produced
15
+ * entry. Both default to the project's `package.json#name` when omitted.
16
+ */
17
+ export declare const FiltersScanSection: import("arktype/internal/variants/object.ts").ObjectType<{
18
+ include: string[];
19
+ source?: string | undefined;
20
+ module?: string | undefined;
21
+ exclude?: string[] | undefined;
22
+ out?: string | undefined;
23
+ }, {}>;
24
+ /**
25
+ * Static type inferred from {@link FiltersScanSection}.
26
+ */
27
+ export type FiltersScanSection = typeof FiltersScanSection.infer;
28
+ /**
29
+ * Top-level shape used by the filters builder. Only the `filters` key is
30
+ * consumed; the rest of the document is ignored so a single
31
+ * `dbx-mcp.scan.json` can house all the scan sections side-by-side.
32
+ */
33
+ export declare const FiltersScanConfig: import("arktype/internal/variants/object.ts").ObjectType<{
34
+ version: 1;
35
+ filters: {
36
+ include: string[];
37
+ source?: string | undefined;
38
+ module?: string | undefined;
39
+ exclude?: string[] | undefined;
40
+ out?: string | undefined;
41
+ };
42
+ }, {}>;
43
+ /**
44
+ * Static type inferred from {@link FiltersScanConfig}.
45
+ */
46
+ export type FiltersScanConfig = typeof FiltersScanConfig.infer;
47
+ /**
48
+ * Default value used when the scan config does not specify `out`.
49
+ * Lives next to the scan config in the project root.
50
+ */
51
+ export declare const DEFAULT_FILTERS_SCAN_OUT_PATH = "filters.mcp.generated.json";
52
+ /**
53
+ * Filename the loader looks for at `${projectRoot}/`. Re-exported here so
54
+ * the filters CLI does not have to import from a sibling scan config module.
55
+ */
56
+ export declare const FILTERS_SCAN_CONFIG_FILENAME = "dbx-mcp.scan.json";
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Orchestrator for the `scan-forge-fields` generator.
3
+ *
4
+ * Composes a complete {@link ForgeFieldManifest} from a project root by
5
+ *
6
+ * 1. reading `dbx-mcp.scan.json` against {@link ForgeFieldsScanConfig}
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 extractForgeFieldEntries}
11
+ * 6. assembling the manifest envelope and validating it against
12
+ * {@link ForgeFieldManifest}
13
+ *
14
+ * I/O is fully injectable so tests drive every code path without
15
+ * touching the real filesystem.
16
+ */
17
+ import { ForgeFieldManifest } from '../manifest/forge-fields-schema.js';
18
+ import { type ForgeExtractWarning } from './forge-fields-extract.js';
19
+ import { type ScanGlobber, type ScanReadFile } from '../../scan-helpers/scan-io.js';
20
+ export type BuildForgeFieldsReadFile = ScanReadFile;
21
+ export type BuildForgeFieldsGlobber = ScanGlobber;
22
+ /**
23
+ * Input to {@link buildForgeFieldsManifest}.
24
+ */
25
+ export interface BuildForgeFieldsManifestInput {
26
+ readonly projectRoot: string;
27
+ readonly generator: string;
28
+ readonly now?: () => Date;
29
+ readonly readFile?: BuildForgeFieldsReadFile;
30
+ readonly globber?: BuildForgeFieldsGlobber;
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 BuildForgeFieldsManifestOutcome = {
38
+ readonly kind: 'success';
39
+ readonly manifest: ForgeFieldManifest;
40
+ readonly outPath: string;
41
+ readonly scannedFileCount: number;
42
+ readonly extractWarnings: readonly ForgeExtractWarning[];
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 ForgeFieldManifest} from the supplied project root. The
63
+ * function is pure with respect to the injected I/O hooks, so unit tests can
64
+ * drive 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 buildForgeFieldsManifest(input: BuildForgeFieldsManifestInput): Promise<BuildForgeFieldsManifestOutcome>;
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 serializeForgeFieldManifest(manifest: ForgeFieldManifest): string;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * `scan-forge-fields` subcommand entry point.
3
+ *
4
+ * Thin wrapper around {@link runScanCliBase} that supplies the forge-fields
5
+ * domain config.
6
+ */
7
+ import { type BuildForgeFieldsGlobber } from './forge-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 ForgeFieldsScanCliReadFile = ScanCliBaseReadFile;
13
+ /**
14
+ * Function shape used to write the produced manifest in write mode.
15
+ */
16
+ export type ForgeFieldsScanCliWriteFile = ScanCliBaseWriteFile;
17
+ /**
18
+ * Console-shaped sink for stdout and stderr lines.
19
+ */
20
+ export type ForgeFieldsScanCliLogger = ScanCliBaseLogger;
21
+ /**
22
+ * Input to {@link runForgeFieldsScanCli}.
23
+ */
24
+ export type RunForgeFieldsScanCliInput = RunScanCliBaseInput<BuildForgeFieldsGlobber>;
25
+ /**
26
+ * Result of one CLI invocation.
27
+ */
28
+ export type RunForgeFieldsScanCliResult = RunScanCliResult;
29
+ /**
30
+ * Runs one invocation of `scan-forge-fields`. Never throws on user errors —
31
+ * every failure path returns a structured exit code so callers can wire
32
+ * 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 runForgeFieldsScanCli(input: RunForgeFieldsScanCliInput): Promise<RunForgeFieldsScanCliResult>;
@@ -0,0 +1,165 @@
1
+ /**
2
+ * AST extraction for the `scan-forge-fields` generator.
3
+ *
4
+ * Walks every source file in the supplied ts-morph `Project` looking for
5
+ * top-level exported declarations (function or `const` arrow function) tagged
6
+ * with the `@dbxFormField` JSDoc marker. Each match is normalised into an
7
+ * {@link ExtractedForgeFieldEntry} that {@link buildForgeFieldsManifest}
8
+ * assembles into a `ForgeFieldManifest` entry.
9
+ *
10
+ * Config-interface property auto-extraction lives in this module too — given
11
+ * a tagged factory, the scanner walks the related config interface
12
+ * (`<FactoryName>Config` by convention or `@dbxFormConfigInterface` override)
13
+ * and emits one {@link UiPropertyEntry}-style record per `PropertySignature`.
14
+ * The extractor is intentionally syntactic — no type checker calls — so it
15
+ * runs cheaply on in-memory fixtures.
16
+ */
17
+ import { type Project } from 'ts-morph';
18
+ import { type ForgeFieldEntry, type ForgeFieldPropertyEntry } from '../manifest/forge-fields-schema.js';
19
+ /**
20
+ * One forge entry extracted from a source file. Mirrors {@link ForgeFieldEntry}
21
+ * for the persisted fields. `filePath` and `line` are kept for in-process
22
+ * warnings and never persisted to the manifest.
23
+ */
24
+ export interface ExtractedForgeFieldEntry {
25
+ readonly slug: string;
26
+ readonly factoryName: string;
27
+ readonly tier: ForgeFieldEntry['tier'];
28
+ readonly produces: string;
29
+ readonly arrayOutput: ForgeFieldEntry['arrayOutput'];
30
+ readonly description: string;
31
+ readonly example: string;
32
+ readonly properties: readonly ForgeFieldPropertyEntry[];
33
+ readonly wrapperPattern?: ForgeFieldEntry['wrapperPattern'];
34
+ readonly ngFormType?: string;
35
+ readonly generic?: string;
36
+ readonly suffix?: ForgeFieldEntry['suffix'];
37
+ readonly composesFromSlugs?: readonly string[];
38
+ readonly returns?: string;
39
+ readonly configInterface?: string;
40
+ readonly propsInterface?: string;
41
+ readonly deprecated?: boolean | string;
42
+ readonly since?: string;
43
+ readonly filePath: string;
44
+ readonly line: number;
45
+ }
46
+ /**
47
+ * Discriminated union of the non-fatal events the extractor emits when an
48
+ * entry can't be assembled. Build-manifest collates these into a structured
49
+ * warning array so missing/invalid tag combinations surface during generation
50
+ * rather than silently dropping entries.
51
+ */
52
+ export type ForgeExtractWarning = {
53
+ readonly kind: 'missing-required-tag';
54
+ readonly factoryName: string;
55
+ readonly tag: string;
56
+ readonly filePath: string;
57
+ readonly line: number;
58
+ } | {
59
+ readonly kind: 'unknown-tier';
60
+ readonly factoryName: string;
61
+ readonly tier: string;
62
+ readonly filePath: string;
63
+ readonly line: number;
64
+ } | {
65
+ readonly kind: 'unknown-array-output';
66
+ readonly factoryName: string;
67
+ readonly arrayOutput: string;
68
+ readonly filePath: string;
69
+ readonly line: number;
70
+ } | {
71
+ readonly kind: 'unknown-wrapper-pattern';
72
+ readonly factoryName: string;
73
+ readonly wrapperPattern: string;
74
+ readonly filePath: string;
75
+ readonly line: number;
76
+ } | {
77
+ readonly kind: 'unknown-suffix';
78
+ readonly factoryName: string;
79
+ readonly suffix: string;
80
+ readonly filePath: string;
81
+ readonly line: number;
82
+ } | {
83
+ readonly kind: 'config-interface-not-found';
84
+ readonly factoryName: string;
85
+ readonly configInterfaceName: string;
86
+ readonly filePath: string;
87
+ readonly line: number;
88
+ } | {
89
+ readonly kind: 'derivative-missing-base';
90
+ readonly factoryName: string;
91
+ readonly filePath: string;
92
+ readonly line: number;
93
+ } | {
94
+ readonly kind: 'derivative-multiple-bases';
95
+ readonly factoryName: string;
96
+ readonly providedCount: number;
97
+ readonly filePath: string;
98
+ readonly line: number;
99
+ } | {
100
+ readonly kind: 'template-missing-slugs';
101
+ readonly factoryName: string;
102
+ readonly filePath: string;
103
+ readonly line: number;
104
+ } | {
105
+ readonly kind: 'union-config-not-walked';
106
+ readonly factoryName: string;
107
+ readonly configInterfaceName: string;
108
+ readonly filePath: string;
109
+ readonly line: number;
110
+ };
111
+ /**
112
+ * Input to {@link extractForgeFieldEntries}. The caller is responsible for
113
+ * adding source files to `project` (either from disk, in-memory fixtures, or
114
+ * a tsconfig).
115
+ */
116
+ export interface ExtractForgeFieldEntriesInput {
117
+ readonly project: Project;
118
+ }
119
+ /**
120
+ * Result of {@link extractForgeFieldEntries}.
121
+ */
122
+ export interface ExtractForgeFieldEntriesResult {
123
+ readonly entries: readonly ExtractedForgeFieldEntry[];
124
+ readonly warnings: readonly ForgeExtractWarning[];
125
+ }
126
+ /**
127
+ * Walks the supplied project and returns every export tagged with the
128
+ * `@dbxFormField` JSDoc marker. Order is stable: source files in the order
129
+ * ts-morph reports them, declarations within a file in source order.
130
+ *
131
+ * @param input - The ts-morph project to scan.
132
+ * @returns The extracted entries plus any non-fatal warnings.
133
+ */
134
+ export declare function extractForgeFieldEntries(input: ExtractForgeFieldEntriesInput): ExtractForgeFieldEntriesResult;
135
+ /**
136
+ * Arktype validator that mirrors {@link ExtractedForgeFieldEntry}. Useful for
137
+ * tests and for runtime-validating fixture entries crafted by hand.
138
+ */
139
+ export declare const ExtractedForgeFieldEntrySchema: import("arktype/internal/variants/object.ts").ObjectType<{
140
+ slug: string;
141
+ factoryName: string;
142
+ tier: "field-factory" | "field-derivative" | "composite-builder" | "template-builder" | "primitive";
143
+ produces: string;
144
+ arrayOutput: "yes" | "no" | "optional";
145
+ description: string;
146
+ example: string;
147
+ properties: {
148
+ name: string;
149
+ type: string;
150
+ description: string;
151
+ required: boolean;
152
+ default?: string | undefined;
153
+ }[];
154
+ filePath: string;
155
+ line: number;
156
+ wrapperPattern?: "unwrapped" | "material-form-field-wrapped" | undefined;
157
+ ngFormType?: string | undefined;
158
+ generic?: string | undefined;
159
+ suffix?: "Row" | "Group" | "Fields" | "Field" | "Wrapper" | "Layout" | undefined;
160
+ composesFromSlugs?: string[] | undefined;
161
+ returns?: string | undefined;
162
+ configInterface?: string | undefined;
163
+ deprecated?: string | boolean | undefined;
164
+ since?: string | undefined;
165
+ }, {}>;