@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,37 @@
1
+ /**
2
+ * `scan-pipes` subcommand entry point.
3
+ *
4
+ * Thin wrapper around {@link runScanCliBase} that supplies the pipes
5
+ * domain config.
6
+ */
7
+ import { type BuildPipesGlobber } from './pipes-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 PipesScanCliReadFile = ScanCliBaseReadFile;
13
+ /**
14
+ * Function shape used to write the produced manifest in write mode.
15
+ */
16
+ export type PipesScanCliWriteFile = ScanCliBaseWriteFile;
17
+ /**
18
+ * Console-shaped sink for stdout and stderr lines.
19
+ */
20
+ export type PipesScanCliLogger = ScanCliBaseLogger;
21
+ /**
22
+ * Input to {@link runPipesScanCli}.
23
+ */
24
+ export type RunPipesScanCliInput = RunScanCliBaseInput<BuildPipesGlobber>;
25
+ /**
26
+ * Result of one CLI invocation.
27
+ */
28
+ export type RunPipesScanCliResult = RunScanCliResult;
29
+ /**
30
+ * Runs one invocation of `scan-pipes`. Never throws on user errors — every
31
+ * failure path returns a structured exit code so callers can wire this
32
+ * 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 runPipesScanCli(input: RunPipesScanCliInput): Promise<RunPipesScanCliResult>;
@@ -0,0 +1,90 @@
1
+ /**
2
+ * AST extraction for the `scan-pipes` generator.
3
+ *
4
+ * Walks every source file in the supplied ts-morph `Project` looking for
5
+ * top-level exported class declarations tagged with the `@dbxPipe` JSDoc
6
+ * marker. Each match is normalised into an {@link ExtractedPipeEntry} that
7
+ * {@link buildPipesManifest} assembles into a `PipeManifest` entry.
8
+ *
9
+ * `@Pipe({ name, pure })` decorator metadata, the `transform()` method
10
+ * signature, and `@param` JSDoc tags on `transform()` are auto-extracted;
11
+ * JSDoc tags only supply registry metadata that can't be derived from
12
+ * source (slug, category, related slugs, skill refs).
13
+ */
14
+ import { type Project } from 'ts-morph';
15
+ import type { PipeArgEntry, PipeEntry } from '../manifest/pipes-schema.js';
16
+ /**
17
+ * One pipe entry extracted from a source file. Mirrors {@link PipeEntry}
18
+ * minus `module` (derived from the package being scanned in build-manifest).
19
+ * `filePath` and `line` are kept for in-process warnings and never persisted.
20
+ */
21
+ export interface ExtractedPipeEntry {
22
+ readonly slug: string;
23
+ readonly category: PipeEntry['category'];
24
+ readonly pipeName: string;
25
+ readonly className: string;
26
+ readonly inputType: string;
27
+ readonly outputType: string;
28
+ readonly purity: PipeEntry['purity'];
29
+ readonly description: string;
30
+ readonly args: readonly PipeArgEntry[];
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
+ * Discriminated union of the non-fatal events the extractor emits when an
41
+ * entry can't be assembled. Build-manifest collates these into a structured
42
+ * warning array so missing/invalid tag combinations surface during
43
+ * generation rather than silently dropping entries.
44
+ */
45
+ export type PipeExtractWarning = {
46
+ readonly kind: 'missing-required-tag';
47
+ readonly className: string;
48
+ readonly tag: string;
49
+ readonly filePath: string;
50
+ readonly line: number;
51
+ } | {
52
+ readonly kind: 'unknown-category';
53
+ readonly className: string;
54
+ readonly category: string;
55
+ readonly filePath: string;
56
+ readonly line: number;
57
+ } | {
58
+ readonly kind: 'missing-pipe-decorator';
59
+ readonly className: string;
60
+ readonly filePath: string;
61
+ readonly line: number;
62
+ } | {
63
+ readonly kind: 'missing-transform-method';
64
+ readonly className: string;
65
+ readonly filePath: string;
66
+ readonly line: number;
67
+ };
68
+ /**
69
+ * Input to {@link extractPipeEntries}. The caller is responsible for adding
70
+ * source files to `project`.
71
+ */
72
+ export interface ExtractPipeEntriesInput {
73
+ readonly project: Project;
74
+ }
75
+ /**
76
+ * Result of {@link extractPipeEntries}.
77
+ */
78
+ export interface ExtractPipeEntriesResult {
79
+ readonly entries: readonly ExtractedPipeEntry[];
80
+ readonly warnings: readonly PipeExtractWarning[];
81
+ }
82
+ /**
83
+ * Walks the supplied project and returns every class tagged with the
84
+ * `@dbxPipe` JSDoc marker. Order is stable: source files in the order
85
+ * ts-morph reports them, declarations within a file in source order.
86
+ *
87
+ * @param input - The ts-morph project to scan.
88
+ * @returns The extracted entries plus any non-fatal warnings.
89
+ */
90
+ export declare function extractPipeEntries(input: ExtractPipeEntriesInput): ExtractPipeEntriesResult;
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Arktype schema for the `pipes` section of `dbx-mcp.scan.json`.
3
+ *
4
+ * Pipes scanning lives next to the existing semantic-types, ui-components,
5
+ * and forge-fields sections — all 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-pipes` reads only the `pipes`
8
+ * field; sibling subcommands continue to read their own top-level fields
9
+ * unchanged.
10
+ */
11
+ /**
12
+ * Inner config that drives one pipes 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 PipesScanSection: 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 PipesScanSection}.
26
+ */
27
+ export type PipesScanSection = typeof PipesScanSection.infer;
28
+ /**
29
+ * Top-level shape used by the pipes builder. Only the `pipes` 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 PipesScanConfig: import("arktype/internal/variants/object.ts").ObjectType<{
34
+ version: 1;
35
+ pipes: {
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 PipesScanConfig}.
45
+ */
46
+ export type PipesScanConfig = typeof PipesScanConfig.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_PIPES_SCAN_OUT_PATH = "pipes.mcp.generated.json";
52
+ /**
53
+ * Filename the loader looks for at `${projectRoot}/`. Re-exported here so
54
+ * the pipes CLI does not have to import from a sibling scan config module.
55
+ */
56
+ export declare const PIPES_SCAN_CONFIG_FILENAME = "dbx-mcp.scan.json";
@@ -0,0 +1,89 @@
1
+ /**
2
+ * Generic Angular `@Input`/`input()`/`@Output`/`output()` AST parsing.
3
+ *
4
+ * The five `*-extract.ts` modules each need to walk Angular class members and
5
+ * normalise inputs/outputs into a domain-specific entry shape. The mechanics
6
+ * of that walk (decorator vs. signal call detection, alias extraction, type
7
+ * fallback rules) are identical; only the resulting record shape and dedupe
8
+ * key differ. This module exposes that walk as a generic helper that takes a
9
+ * per-domain entry-builder callback.
10
+ */
11
+ import { type ClassDeclaration, type PropertyDeclaration } from 'ts-morph';
12
+ /**
13
+ * Normalised view of a single `@Input`-decorated property or signal `input()`
14
+ * call. Each `*-extract.ts` module maps this into its own domain entry shape
15
+ * via the {@link ExtractAngularInputsOptions.buildEntry} callback.
16
+ */
17
+ export interface ParsedAngularInput {
18
+ readonly propertyName: string;
19
+ readonly alias: string;
20
+ readonly type: string;
21
+ readonly required: boolean;
22
+ readonly defaultValue?: string;
23
+ readonly description: string;
24
+ }
25
+ /**
26
+ * Normalised view of a single `@Output`-decorated property or signal
27
+ * `output()` call. Each `*-extract.ts` module maps this into its own domain
28
+ * entry shape via the {@link ExtractAngularOutputsOptions.buildEntry}
29
+ * callback.
30
+ */
31
+ export interface ParsedAngularOutput {
32
+ readonly propertyName: string;
33
+ readonly name: string;
34
+ readonly type: string;
35
+ readonly description: string;
36
+ }
37
+ /**
38
+ * Options for {@link extractAngularInputs}. The caller supplies a
39
+ * per-domain entry builder and dedupe key extractor; everything else is
40
+ * defaulted.
41
+ */
42
+ export interface ExtractAngularInputsOptions<TEntry> {
43
+ readonly buildEntry: (parsed: ParsedAngularInput, property: PropertyDeclaration) => TEntry;
44
+ readonly dedupeBy: (entry: TEntry) => string;
45
+ readonly propertySource?: (decl: ClassDeclaration) => Iterable<PropertyDeclaration>;
46
+ readonly skipProperty?: (property: PropertyDeclaration) => boolean;
47
+ }
48
+ /**
49
+ * Options for {@link extractAngularOutputs}. Mirrors
50
+ * {@link ExtractAngularInputsOptions} for the output side.
51
+ */
52
+ export interface ExtractAngularOutputsOptions<TEntry> {
53
+ readonly buildEntry: (parsed: ParsedAngularOutput, property: PropertyDeclaration) => TEntry;
54
+ readonly dedupeBy: (entry: TEntry) => string;
55
+ readonly propertySource?: (decl: ClassDeclaration) => Iterable<PropertyDeclaration>;
56
+ readonly skipProperty?: (property: PropertyDeclaration) => boolean;
57
+ }
58
+ /**
59
+ * Walks the supplied class's properties looking for Angular inputs (either
60
+ * `@Input()` decorated or initialised with a signal `input()` call) and
61
+ * builds a per-domain entry for each visible match. Returns entries in
62
+ * source order with duplicates (per `dedupeBy`) dropped.
63
+ *
64
+ * @param decl - The Angular class declaration to scan.
65
+ * @param options - Per-domain entry builder, dedupe key extractor, and optional property-source/skip overrides.
66
+ * @returns The collected per-domain entries for each visible input.
67
+ */
68
+ export declare function extractAngularInputs<TEntry>(decl: ClassDeclaration, options: ExtractAngularInputsOptions<TEntry>): readonly TEntry[];
69
+ /**
70
+ * Walks the supplied class's properties looking for Angular outputs (either
71
+ * `@Output()` decorated or initialised with a signal `output()` call) and
72
+ * builds a per-domain entry for each visible match. Returns entries in
73
+ * source order with duplicates (per `dedupeBy`) dropped.
74
+ *
75
+ * @param decl - The Angular class declaration to scan.
76
+ * @param options - Per-domain entry builder, dedupe key extractor, and optional property-source/skip overrides.
77
+ * @returns The collected per-domain entries for each visible output.
78
+ */
79
+ export declare function extractAngularOutputs<TEntry>(decl: ClassDeclaration, options: ExtractAngularOutputsOptions<TEntry>): readonly TEntry[];
80
+ /**
81
+ * Walks `decl` and every reachable base class, returning their direct
82
+ * `getProperties()` in superclass-first ... err, subclass-first order, with
83
+ * cycle protection. Useful for {@link ExtractAngularInputsOptions.propertySource}
84
+ * when a domain wants to inherit decorated properties from base classes.
85
+ *
86
+ * @param decl - The class declaration to walk, including all base classes.
87
+ * @returns Properties from `decl` and every base class in subclass-first order with cycle protection.
88
+ */
89
+ export declare function collectClassPropertiesWithInheritance(decl: ClassDeclaration): readonly PropertyDeclaration[];
@@ -0,0 +1,162 @@
1
+ /**
2
+ * Generic core for the per-domain scan CLIs (actions, filters, forge-fields,
3
+ * pipes, ui-components).
4
+ *
5
+ * Each domain CLI (`actions-cli.ts`, etc.) is a thin wrapper that supplies a
6
+ * subcommand label, USAGE block, build-manifest function, manifest
7
+ * serializer, and a domain-specific `formatExtractWarning`. The argv parser,
8
+ * outcome dispatcher, drift check, and exit-code mapping live here so the
9
+ * five domains do not duplicate ~100 lines of identical procedural code each.
10
+ *
11
+ * The semantic-types CLI (`cli.ts`) is intentionally not migrated to this
12
+ * base: it pre-dates the family pattern and would require touching its
13
+ * downstream wiring without removing meaningful additional duplication.
14
+ */
15
+ /**
16
+ * Function shape used to read text files during `--check`.
17
+ */
18
+ export type ScanCliBaseReadFile = (absolutePath: string) => Promise<string>;
19
+ /**
20
+ * Function shape used to write the produced manifest in write mode.
21
+ */
22
+ export type ScanCliBaseWriteFile = (absolutePath: string, data: string) => Promise<void>;
23
+ /**
24
+ * Console-shaped sink for stdout and stderr lines.
25
+ */
26
+ export type ScanCliBaseLogger = (message: string) => void;
27
+ /**
28
+ * Result of one CLI invocation.
29
+ */
30
+ export interface RunScanCliResult {
31
+ readonly exitCode: number;
32
+ }
33
+ /**
34
+ * Minimum manifest shape the base CLI needs — `entries.length` is reported in
35
+ * the success log.
36
+ */
37
+ export interface ScanCliManifestLike {
38
+ readonly entries: readonly unknown[];
39
+ }
40
+ /**
41
+ * Success branch of a `buildManifest` outcome.
42
+ */
43
+ export interface ScanCliBuildSuccess<TManifest extends ScanCliManifestLike, TWarning> {
44
+ readonly kind: 'success';
45
+ readonly manifest: TManifest;
46
+ readonly outPath: string;
47
+ readonly scannedFileCount: number;
48
+ readonly extractWarnings: readonly TWarning[];
49
+ }
50
+ /**
51
+ * Failure branches of a `buildManifest` outcome — shape shared verbatim by
52
+ * every domain build-manifest module today.
53
+ */
54
+ export type ScanCliBuildFailure = {
55
+ readonly kind: 'no-config';
56
+ readonly configPath: string;
57
+ } | {
58
+ readonly kind: 'invalid-scan-config';
59
+ readonly configPath: string;
60
+ readonly error: string;
61
+ } | {
62
+ readonly kind: 'no-package';
63
+ readonly packagePath: string;
64
+ } | {
65
+ readonly kind: 'invalid-package';
66
+ readonly packagePath: string;
67
+ readonly error: string;
68
+ } | {
69
+ readonly kind: 'invalid-manifest';
70
+ readonly error: string;
71
+ };
72
+ /**
73
+ * Discriminated union returned by a domain's `buildManifest` function.
74
+ */
75
+ export type ScanCliBuildOutcome<TManifest extends ScanCliManifestLike, TWarning> = ScanCliBuildSuccess<TManifest, TWarning> | ScanCliBuildFailure;
76
+ /**
77
+ * Input passed to the domain's `buildManifest` function. Each domain accepts
78
+ * a structural superset of this (e.g. its own globber type), so the base
79
+ * threads `TGlobber` through as a generic parameter.
80
+ */
81
+ export interface ScanCliBuildInput<TGlobber> {
82
+ readonly projectRoot: string;
83
+ readonly generator: string;
84
+ readonly readFile: ScanCliBaseReadFile;
85
+ readonly globber?: TGlobber;
86
+ readonly now?: () => Date;
87
+ }
88
+ /**
89
+ * Per-domain configuration for {@link runScanCliBase}.
90
+ */
91
+ export interface ScanCliConfig<TManifest extends ScanCliManifestLike, TWarning, TGlobber> {
92
+ /**
93
+ * Subcommand label printed in the regenerate hint, e.g. `scan-actions`.
94
+ */
95
+ readonly subcommand: string;
96
+ /**
97
+ * Pre-rendered USAGE block printed for `--help` and on parse errors.
98
+ */
99
+ readonly usage: string;
100
+ /**
101
+ * Suffix appended to the no-config error guidance — e.g. `with an actions
102
+ * section.` The full message becomes
103
+ * `Create a dbx-mcp.scan.json file in the project root <hint>`.
104
+ */
105
+ readonly configSectionHint: string;
106
+ /**
107
+ * Domain build-manifest entry point.
108
+ */
109
+ readonly buildManifest: (input: ScanCliBuildInput<TGlobber>) => Promise<ScanCliBuildOutcome<TManifest, TWarning>>;
110
+ /**
111
+ * Serializes the validated manifest to the exact bytes written to disk
112
+ * (including trailing newline). Tests rely on byte-equality for `--check`.
113
+ */
114
+ readonly serialize: (manifest: TManifest) => string;
115
+ /**
116
+ * Formats one extract warning for the `extract-warning: ...` log line.
117
+ */
118
+ readonly formatExtractWarning: (warning: TWarning) => string;
119
+ }
120
+ /**
121
+ * Input to {@link runScanCliBase}.
122
+ */
123
+ export interface RunScanCliBaseInput<TGlobber> {
124
+ readonly argv: readonly string[];
125
+ readonly cwd: string;
126
+ readonly generator: string;
127
+ readonly readFile?: ScanCliBaseReadFile;
128
+ readonly writeFile?: ScanCliBaseWriteFile;
129
+ readonly globber?: TGlobber;
130
+ readonly now?: () => Date;
131
+ readonly log?: ScanCliBaseLogger;
132
+ readonly errorLog?: ScanCliBaseLogger;
133
+ }
134
+ /**
135
+ * Runs one invocation of a scan subcommand. The function never throws on
136
+ * user errors — every failure path returns a structured exit code so callers
137
+ * can wire this into `process.exit` without try/catch.
138
+ *
139
+ * @param input - Argv plus injectable I/O hooks.
140
+ * @param config - Per-domain wiring (subcommand label, usage, build, serialize, warning formatter)
141
+ * @returns The CLI's exit code (0 on success, 1 on drift / build failure, 2 on usage error)
142
+ */
143
+ export declare function runScanCliBase<TManifest extends ScanCliManifestLike, TWarning, TGlobber>(input: RunScanCliBaseInput<TGlobber>, config: ScanCliConfig<TManifest, TWarning, TGlobber>): Promise<RunScanCliResult>;
144
+ type ParsedScanArgs = {
145
+ readonly kind: 'parsed';
146
+ readonly project: string | undefined;
147
+ readonly check: boolean;
148
+ readonly out: string | undefined;
149
+ readonly help: boolean;
150
+ } | {
151
+ readonly kind: 'parse-error';
152
+ readonly message: string;
153
+ };
154
+ /**
155
+ * Parses the shared scan CLI argv vocabulary (`--project`, `--check`,
156
+ * `--out`, `--help`).
157
+ *
158
+ * @param argv - Argument tokens, excluding the node binary and script paths.
159
+ * @returns Either the parsed flag bag or a `parse-error` describing the first malformed token.
160
+ */
161
+ export declare function parseScanArgs(argv: readonly string[]): ParsedScanArgs;
162
+ export {};
@@ -0,0 +1,44 @@
1
+ /**
2
+ * Arktype schema for `dbx-mcp.scan.json`.
3
+ *
4
+ * The scan config lives at the root of any package or app that wants the
5
+ * `scan-semantic-types` generator to produce a manifest for its semantic
6
+ * types. One scan config produces one manifest; if a workspace ships two
7
+ * sources (e.g. `@dereekb/util` and `@dereekb/model`) each gets its own
8
+ * scan config in its own directory.
9
+ *
10
+ * The schema mirrors {@link SemanticTypeManifest} where it can — `source`
11
+ * and `topicNamespace` carry through verbatim — but also adds the inputs
12
+ * the generator needs to actually walk source code (`include`, `exclude`)
13
+ * and decide where to emit the manifest (`out`).
14
+ */
15
+ /**
16
+ * Top-level scan config schema. `include` is required; everything else
17
+ * has a sensible default. The `declaredTopics` array advertises the
18
+ * namespaced topics this manifest will use — entries may still emit
19
+ * topics outside this list, but the loader uses it to decide which
20
+ * topics show up in `topics` field of the produced manifest.
21
+ */
22
+ export declare const SemanticTypeScanConfig: import("arktype/internal/variants/object.ts").ObjectType<{
23
+ version: 1;
24
+ source: string;
25
+ topicNamespace: string;
26
+ include: string[];
27
+ exclude?: string[] | undefined;
28
+ out?: string | undefined;
29
+ declaredTopics?: string[] | undefined;
30
+ }, {}>;
31
+ /**
32
+ * Static type inferred from {@link SemanticTypeScanConfig}.
33
+ */
34
+ export type SemanticTypeScanConfig = typeof SemanticTypeScanConfig.infer;
35
+ /**
36
+ * Default value used when the scan config does not specify `out`.
37
+ * Lives next to the scan config in the project root.
38
+ */
39
+ export declare const DEFAULT_SCAN_OUT_PATH = "semantic-types.mcp.generated.json";
40
+ /**
41
+ * Filename the loader looks for at `${projectRoot}/`. Constant so tests
42
+ * and the CLI agree on the discovery path.
43
+ */
44
+ export declare const SCAN_CONFIG_FILENAME = "dbx-mcp.scan.json";
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Orchestrator for the `scan-ui-components` generator.
3
+ *
4
+ * Composes a complete {@link UiComponentManifest} from a project root by
5
+ *
6
+ * 1. reading `dbx-mcp.scan.json` against {@link UiComponentsScanConfig}
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 extractUiEntries}
11
+ * 6. assembling the manifest envelope and validating it against
12
+ * {@link UiComponentManifest}
13
+ *
14
+ * I/O is fully injectable so tests drive every code path without
15
+ * touching the real filesystem.
16
+ */
17
+ import { UiComponentManifest } from '../manifest/ui-components-schema.js';
18
+ import { type ExtractWarning } from './ui-components-extract.js';
19
+ import { type ScanGlobber, type ScanReadFile } from '../../scan-helpers/scan-io.js';
20
+ export type BuildUiManifestReadFile = ScanReadFile;
21
+ export type BuildUiManifestGlobber = ScanGlobber;
22
+ /**
23
+ * Input to {@link buildUiComponentsManifest}.
24
+ */
25
+ export interface BuildUiManifestInput {
26
+ readonly projectRoot: string;
27
+ readonly generator: string;
28
+ readonly now?: () => Date;
29
+ readonly readFile?: BuildUiManifestReadFile;
30
+ readonly globber?: BuildUiManifestGlobber;
31
+ }
32
+ /**
33
+ * Outcome of one generator run. The success payload carries everything
34
+ * the caller needs to write the manifest to disk or run a freshness
35
+ * diff against an existing on-disk version.
36
+ */
37
+ export type BuildUiManifestOutcome = {
38
+ readonly kind: 'success';
39
+ readonly manifest: UiComponentManifest;
40
+ readonly outPath: string;
41
+ readonly scannedFileCount: number;
42
+ readonly extractWarnings: readonly ExtractWarning[];
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 UiComponentManifest} from the supplied project root.
63
+ * The function is pure with respect to the injected I/O hooks, so unit
64
+ * tests can 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 buildUiComponentsManifest(input: BuildUiManifestInput): Promise<BuildUiManifestOutcome>;
70
+ /**
71
+ * JSON-stringifies a manifest with stable key ordering and trailing
72
+ * newline so `--check` mode can byte-compare against a committed file
73
+ * without 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 serializeUiComponentManifest(manifest: UiComponentManifest): string;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * `scan-ui-components` subcommand entry point.
3
+ *
4
+ * Thin wrapper around {@link runScanCliBase} that supplies the
5
+ * ui-components domain config.
6
+ */
7
+ import { type BuildUiManifestGlobber } from './ui-components-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 UiScanCliReadFile = ScanCliBaseReadFile;
13
+ /**
14
+ * Function shape used to write the produced manifest in write mode.
15
+ */
16
+ export type UiScanCliWriteFile = ScanCliBaseWriteFile;
17
+ /**
18
+ * Console-shaped sink for stdout and stderr lines.
19
+ */
20
+ export type UiScanCliLogger = ScanCliBaseLogger;
21
+ /**
22
+ * Input to {@link runUiComponentsScanCli}.
23
+ */
24
+ export type RunUiComponentsScanCliInput = RunScanCliBaseInput<BuildUiManifestGlobber>;
25
+ /**
26
+ * Result of one CLI invocation.
27
+ */
28
+ export type RunUiComponentsScanCliResult = RunScanCliResult;
29
+ /**
30
+ * Runs one invocation of `scan-ui-components`. 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 runUiComponentsScanCli(input: RunUiComponentsScanCliInput): Promise<RunUiComponentsScanCliResult>;