@dereekb/dbx-cli 13.11.17 → 13.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (156) hide show
  1. package/firebase-api-manifest/main.js +70 -9
  2. package/firebase-api-manifest/package.json +1 -1
  3. package/firestore-indexes/src/firestore-indexes-generate.d.ts +125 -0
  4. package/firestore-indexes/src/firestore-model-identity-resolver.d.ts +93 -0
  5. package/firestore-indexes/src/firestore-query-helpers.d.ts +108 -0
  6. package/firestore-indexes/src/generate-firestore-indexes-cli.d.ts +94 -0
  7. package/firestore-indexes/src/index.d.ts +7 -0
  8. package/firestore-indexes/src/model-firebase-index-analyze.d.ts +68 -0
  9. package/firestore-indexes/src/model-firebase-index-build-manifest.d.ts +123 -0
  10. package/firestore-indexes/src/model-firebase-index-extract.d.ts +246 -0
  11. package/firestore-indexes/src/model-firebase-index-runtime.d.ts +126 -0
  12. package/firestore-indexes/src/model-firebase-index-scan-config-schema.d.ts +58 -0
  13. package/firestore-indexes/src/model-firebase-index-schema.d.ts +366 -0
  14. package/generate-firestore-indexes/main.js +1 -1
  15. package/generate-firestore-indexes/package.json +1 -1
  16. package/generate-mcp-manifest/src/generate-mcp-manifest/main.d.ts +26 -0
  17. package/generate-mcp-manifest/src/generate-mcp-manifest/render.d.ts +38 -0
  18. package/generated/firebase-models.generated.d.ts +3 -0
  19. package/index.cjs.js +45234 -640
  20. package/index.esm.js +44941 -643
  21. package/lint-cache/main.js +19 -19
  22. package/lint-cache/package.json +2 -2
  23. package/manifest-extract/index.cjs.js +169 -4
  24. package/manifest-extract/index.esm.js +169 -4
  25. package/manifest-extract/package.json +1 -1
  26. package/manifest-extract/src/lib/types.d.ts +26 -1
  27. package/package.json +14 -10
  28. package/src/lib/index.d.ts +3 -0
  29. package/src/lib/manifest/types.d.ts +155 -0
  30. package/src/lib/mcp-scan/config/config-schema.d.ts +226 -0
  31. package/src/lib/mcp-scan/config/load-config.d.ts +63 -0
  32. package/src/lib/mcp-scan/index.d.ts +16 -0
  33. package/src/lib/mcp-scan/manifest/actions-loader.d.ts +49 -0
  34. package/src/lib/mcp-scan/manifest/actions-schema.d.ts +328 -0
  35. package/src/lib/mcp-scan/manifest/core-topics.d.ts +38 -0
  36. package/src/lib/mcp-scan/manifest/css-utilities-loader.d.ts +55 -0
  37. package/src/lib/mcp-scan/manifest/css-utilities-schema.d.ts +168 -0
  38. package/src/lib/mcp-scan/manifest/dbx-docs-ui-examples-loader.d.ts +33 -0
  39. package/src/lib/mcp-scan/manifest/dbx-docs-ui-examples-schema.d.ts +133 -0
  40. package/src/lib/mcp-scan/manifest/filters-loader.d.ts +61 -0
  41. package/src/lib/mcp-scan/manifest/filters-schema.d.ts +190 -0
  42. package/src/lib/mcp-scan/manifest/forge-fields-loader.d.ts +53 -0
  43. package/src/lib/mcp-scan/manifest/forge-fields-schema.d.ts +170 -0
  44. package/src/lib/mcp-scan/manifest/index.d.ts +43 -0
  45. package/src/lib/mcp-scan/manifest/load-actions-registry.d.ts +38 -0
  46. package/src/lib/mcp-scan/manifest/load-auth-registry.d.ts +82 -0
  47. package/src/lib/mcp-scan/manifest/load-css-utilities-registry.d.ts +67 -0
  48. package/src/lib/mcp-scan/manifest/load-dbx-docs-ui-examples-registry.d.ts +45 -0
  49. package/src/lib/mcp-scan/manifest/load-filters-registry.d.ts +69 -0
  50. package/src/lib/mcp-scan/manifest/load-forge-fields-registry.d.ts +70 -0
  51. package/src/lib/mcp-scan/manifest/load-model-firebase-index-registry.d.ts +61 -0
  52. package/src/lib/mcp-scan/manifest/load-model-snapshot-fields-registry.d.ts +74 -0
  53. package/src/lib/mcp-scan/manifest/load-pipes-registry.d.ts +69 -0
  54. package/src/lib/mcp-scan/manifest/load-registry.d.ts +76 -0
  55. package/src/lib/mcp-scan/manifest/load-tokens-registry.d.ts +69 -0
  56. package/src/lib/mcp-scan/manifest/load-ui-components-registry.d.ts +70 -0
  57. package/src/lib/mcp-scan/manifest/load-utils-registry.d.ts +73 -0
  58. package/src/lib/mcp-scan/manifest/loader.d.ts +120 -0
  59. package/src/lib/mcp-scan/manifest/manifest-loader-base.d.ts +130 -0
  60. package/src/lib/mcp-scan/manifest/model-firebase-index-loader.d.ts +53 -0
  61. package/src/lib/mcp-scan/manifest/model-snapshot-fields-loader.d.ts +54 -0
  62. package/src/lib/mcp-scan/manifest/model-snapshot-fields-schema.d.ts +127 -0
  63. package/src/lib/mcp-scan/manifest/pipes-loader.d.ts +54 -0
  64. package/src/lib/mcp-scan/manifest/pipes-schema.d.ts +125 -0
  65. package/src/lib/mcp-scan/manifest/semantic-types-schema.d.ts +108 -0
  66. package/src/lib/mcp-scan/manifest/tokens-loader.d.ts +55 -0
  67. package/src/lib/mcp-scan/manifest/tokens-schema.d.ts +116 -0
  68. package/src/lib/mcp-scan/manifest/ui-components-loader.d.ts +54 -0
  69. package/src/lib/mcp-scan/manifest/ui-components-schema.d.ts +149 -0
  70. package/src/lib/mcp-scan/manifest/utils-loader.d.ts +54 -0
  71. package/src/lib/mcp-scan/manifest/utils-schema.d.ts +120 -0
  72. package/src/lib/mcp-scan/registry/actions-runtime.d.ts +173 -0
  73. package/src/lib/mcp-scan/registry/archetypes.d.ts +235 -0
  74. package/src/lib/mcp-scan/registry/auth-builtin.d.ts +59 -0
  75. package/src/lib/mcp-scan/registry/auth-runtime.d.ts +343 -0
  76. package/src/lib/mcp-scan/registry/css-utilities-runtime.d.ts +133 -0
  77. package/src/lib/mcp-scan/registry/dbx-docs-ui-examples-runtime.d.ts +58 -0
  78. package/src/lib/mcp-scan/registry/downstream-models-runtime.d.ts +93 -0
  79. package/src/lib/mcp-scan/registry/filters-runtime.d.ts +128 -0
  80. package/src/lib/mcp-scan/registry/firebase-models.d.ts +387 -0
  81. package/src/lib/mcp-scan/registry/forge-fields.d.ts +101 -0
  82. package/src/lib/mcp-scan/registry/form-fields.d.ts +203 -0
  83. package/src/lib/mcp-scan/registry/index.d.ts +165 -0
  84. package/src/lib/mcp-scan/registry/model-snapshot-fields-runtime.d.ts +138 -0
  85. package/src/lib/mcp-scan/registry/pipes-runtime.d.ts +136 -0
  86. package/src/lib/mcp-scan/registry/reserved-model-folders.d.ts +29 -0
  87. package/src/lib/mcp-scan/registry/semantic-types.d.ts +81 -0
  88. package/src/lib/mcp-scan/registry/tokens-runtime.d.ts +96 -0
  89. package/src/lib/mcp-scan/registry/ui-components-runtime.d.ts +90 -0
  90. package/src/lib/mcp-scan/registry/utils-runtime.d.ts +136 -0
  91. package/src/lib/mcp-scan/scan/_jsdoc-tagged-export/extract-base.d.ts +245 -0
  92. package/src/lib/mcp-scan/scan/actions-build-manifest.d.ts +58 -0
  93. package/src/lib/mcp-scan/scan/actions-cli.d.ts +38 -0
  94. package/src/lib/mcp-scan/scan/actions-extract.d.ts +99 -0
  95. package/src/lib/mcp-scan/scan/actions-scan-config-schema.d.ts +42 -0
  96. package/src/lib/mcp-scan/scan/auth-extract.d.ts +120 -0
  97. package/src/lib/mcp-scan/scan/build-manifest.d.ts +76 -0
  98. package/src/lib/mcp-scan/scan/cli.d.ts +60 -0
  99. package/src/lib/mcp-scan/scan/css-utilities-build-manifest.d.ts +76 -0
  100. package/src/lib/mcp-scan/scan/css-utilities-cli.d.ts +36 -0
  101. package/src/lib/mcp-scan/scan/css-utilities-extract.d.ts +187 -0
  102. package/src/lib/mcp-scan/scan/css-utilities-scan-config-schema.d.ts +57 -0
  103. package/src/lib/mcp-scan/scan/dbx-docs-ui-examples-build-manifest.d.ts +68 -0
  104. package/src/lib/mcp-scan/scan/dbx-docs-ui-examples-cli.d.ts +20 -0
  105. package/src/lib/mcp-scan/scan/dbx-docs-ui-examples-extract.d.ts +160 -0
  106. package/src/lib/mcp-scan/scan/dbx-docs-ui-examples-scan-config-schema.d.ts +56 -0
  107. package/src/lib/mcp-scan/scan/discover-downstream-packages.d.ts +76 -0
  108. package/src/lib/mcp-scan/scan/discover-firebase-packages.d.ts +58 -0
  109. package/src/lib/mcp-scan/scan/extract-models/assemble.d.ts +105 -0
  110. package/src/lib/mcp-scan/scan/extract-models/collect-inherited.d.ts +22 -0
  111. package/src/lib/mcp-scan/scan/extract-models/find-converters.d.ts +19 -0
  112. package/src/lib/mcp-scan/scan/extract-models/find-enums.d.ts +19 -0
  113. package/src/lib/mcp-scan/scan/extract-models/find-identities.d.ts +25 -0
  114. package/src/lib/mcp-scan/scan/extract-models/find-interfaces.d.ts +31 -0
  115. package/src/lib/mcp-scan/scan/extract-models/find-model-groups.d.ts +21 -0
  116. package/src/lib/mcp-scan/scan/extract-models/find-service-factories.d.ts +19 -0
  117. package/src/lib/mcp-scan/scan/extract-models/find-sub-object-consts.d.ts +20 -0
  118. package/src/lib/mcp-scan/scan/extract-models/index.d.ts +74 -0
  119. package/src/lib/mcp-scan/scan/extract-models/infer-collection-kind.d.ts +22 -0
  120. package/src/lib/mcp-scan/scan/extract-models/service-factory-constants.d.ts +6 -0
  121. package/src/lib/mcp-scan/scan/extract-models/types.d.ts +171 -0
  122. package/src/lib/mcp-scan/scan/extract.d.ts +82 -0
  123. package/src/lib/mcp-scan/scan/filters-build-manifest.d.ts +78 -0
  124. package/src/lib/mcp-scan/scan/filters-cli.d.ts +37 -0
  125. package/src/lib/mcp-scan/scan/filters-extract.d.ts +101 -0
  126. package/src/lib/mcp-scan/scan/filters-scan-config-schema.d.ts +56 -0
  127. package/src/lib/mcp-scan/scan/forge-fields-build-manifest.d.ts +78 -0
  128. package/src/lib/mcp-scan/scan/forge-fields-cli.d.ts +37 -0
  129. package/src/lib/mcp-scan/scan/forge-fields-extract.d.ts +165 -0
  130. package/src/lib/mcp-scan/scan/forge-fields-scan-config-schema.d.ts +61 -0
  131. package/src/lib/mcp-scan/scan/index.d.ts +60 -0
  132. package/src/lib/mcp-scan/scan/model-firebase-index-cli.d.ts +22 -0
  133. package/src/lib/mcp-scan/scan/model-firebase-index-dispatcher-credit.d.ts +47 -0
  134. package/src/lib/mcp-scan/scan/model-firebase-index-reference-scan.d.ts +100 -0
  135. package/src/lib/mcp-scan/scan/model-snapshot-fields-build-manifest.d.ts +79 -0
  136. package/src/lib/mcp-scan/scan/model-snapshot-fields-cli.d.ts +37 -0
  137. package/src/lib/mcp-scan/scan/model-snapshot-fields-extract.d.ts +115 -0
  138. package/src/lib/mcp-scan/scan/model-snapshot-fields-scan-config-schema.d.ts +59 -0
  139. package/src/lib/mcp-scan/scan/pipes-build-manifest.d.ts +78 -0
  140. package/src/lib/mcp-scan/scan/pipes-cli.d.ts +37 -0
  141. package/src/lib/mcp-scan/scan/pipes-extract.d.ts +90 -0
  142. package/src/lib/mcp-scan/scan/pipes-scan-config-schema.d.ts +56 -0
  143. package/src/lib/mcp-scan/scan/scan-angular-io.d.ts +89 -0
  144. package/src/lib/mcp-scan/scan/scan-cli-base.d.ts +162 -0
  145. package/src/lib/mcp-scan/scan/scan-config-schema.d.ts +44 -0
  146. package/src/lib/mcp-scan/scan/ui-components-build-manifest.d.ts +78 -0
  147. package/src/lib/mcp-scan/scan/ui-components-cli.d.ts +37 -0
  148. package/src/lib/mcp-scan/scan/ui-components-extract.d.ts +124 -0
  149. package/src/lib/mcp-scan/scan/ui-components-scan-config-schema.d.ts +62 -0
  150. package/src/lib/mcp-scan/scan/utils-build-manifest.d.ts +78 -0
  151. package/src/lib/mcp-scan/scan/utils-cli.d.ts +37 -0
  152. package/src/lib/mcp-scan/scan/utils-extract.d.ts +103 -0
  153. package/src/lib/mcp-scan/scan/utils-scan-config-schema.d.ts +57 -0
  154. package/test/package.json +9 -9
  155. package/index.cjs.default.js +0 -1
  156. package/index.cjs.mjs +0 -2
@@ -0,0 +1,124 @@
1
+ /**
2
+ * AST extraction for the `scan-ui-components` generator.
3
+ *
4
+ * Walks every source file in the supplied ts-morph `Project` looking for
5
+ * top-level exported class declarations tagged with the `@dbxWebComponent`
6
+ * JSDoc marker. Each match is normalised into an {@link ExtractedUiEntry}
7
+ * that {@link buildUiComponentsManifest} will assemble into a
8
+ * `UiComponentManifest` entry.
9
+ *
10
+ * Decorator metadata, signal `input()`/`output()` calls, and `@Input()`/
11
+ * `@Output()` decorated properties are auto-extracted; JSDoc tags only
12
+ * supply registry metadata that can't be derived from source (slug,
13
+ * category, related slugs, skill refs, content projection summary).
14
+ */
15
+ import { type Project } from 'ts-morph';
16
+ import { type UiComponentEntry, type UiComponentInputEntry, type UiComponentOutputEntry } from '../manifest/ui-components-schema.js';
17
+ /**
18
+ * One UI entry extracted from a source file. Mirrors {@link UiComponentEntry}
19
+ * minus `module` (derived from the package being scanned in build-manifest).
20
+ * `filePath` and `line` are kept here for in-process warning reporting but
21
+ * never persisted to the manifest — downstream consumers can't resolve them.
22
+ */
23
+ export interface ExtractedUiEntry {
24
+ readonly slug: string;
25
+ readonly category: UiComponentEntry['category'];
26
+ readonly kind: UiComponentEntry['kind'];
27
+ readonly selector: string;
28
+ readonly className: string;
29
+ readonly description: string;
30
+ readonly inputs: readonly UiComponentInputEntry[];
31
+ readonly outputs: readonly UiComponentOutputEntry[];
32
+ readonly contentProjection?: string;
33
+ readonly relatedSlugs?: readonly string[];
34
+ readonly skillRefs?: readonly string[];
35
+ readonly example?: string;
36
+ readonly minimalExample?: string;
37
+ readonly deprecated?: boolean | string;
38
+ readonly since?: string;
39
+ readonly filePath: string;
40
+ readonly line: number;
41
+ }
42
+ /**
43
+ * Discriminated union of the non-fatal events the extractor emits when an
44
+ * entry can't be assembled. The caller (build-manifest) collates these
45
+ * into a structured warning array so missing/invalid tag combinations
46
+ * surface during generation rather than silently dropping entries.
47
+ */
48
+ export type ExtractWarning = {
49
+ readonly kind: 'missing-required-tag';
50
+ readonly className: string;
51
+ readonly tag: string;
52
+ readonly filePath: string;
53
+ readonly line: number;
54
+ } | {
55
+ readonly kind: 'unknown-category';
56
+ readonly className: string;
57
+ readonly category: string;
58
+ readonly filePath: string;
59
+ readonly line: number;
60
+ } | {
61
+ readonly kind: 'unknown-kind';
62
+ readonly className: string;
63
+ readonly kindValue: string;
64
+ readonly filePath: string;
65
+ readonly line: number;
66
+ };
67
+ /**
68
+ * Input to {@link extractUiEntries}. The caller is responsible for adding
69
+ * source files to `project` (either from disk, in-memory fixtures, or a
70
+ * tsconfig).
71
+ */
72
+ export interface ExtractUiEntriesInput {
73
+ readonly project: Project;
74
+ }
75
+ /**
76
+ * Result of {@link extractUiEntries}.
77
+ */
78
+ export interface ExtractUiEntriesResult {
79
+ readonly entries: readonly ExtractedUiEntry[];
80
+ readonly warnings: readonly ExtractWarning[];
81
+ }
82
+ /**
83
+ * Walks the supplied project and returns every class tagged with the
84
+ * `@dbxWebComponent` JSDoc marker. Order is stable: source files in the
85
+ * order ts-morph reports them, declarations within a file in source
86
+ * order.
87
+ *
88
+ * @param input - The ts-morph project to scan.
89
+ * @returns The extracted entries plus any non-fatal warnings.
90
+ */
91
+ export declare function extractUiEntries(input: ExtractUiEntriesInput): ExtractUiEntriesResult;
92
+ /**
93
+ * Arktype validator that mirrors {@link ExtractedUiEntry}. Useful for tests
94
+ * and for runtime-validating fixture entries crafted by hand.
95
+ */
96
+ export declare const ExtractedUiEntrySchema: import("arktype/internal/variants/object.ts").ObjectType<{
97
+ slug: string;
98
+ category: "action" | "list" | "screen" | "text" | "layout" | "button" | "card" | "feedback" | "overlay" | "navigation" | "router" | "misc";
99
+ kind: "pipe" | "component" | "directive" | "service";
100
+ selector: string;
101
+ className: string;
102
+ description: string;
103
+ inputs: {
104
+ name: string;
105
+ type: string;
106
+ description: string;
107
+ required: boolean;
108
+ default?: string | undefined;
109
+ }[];
110
+ outputs: {
111
+ name: string;
112
+ emits: string;
113
+ description: string;
114
+ }[];
115
+ filePath: string;
116
+ line: number;
117
+ contentProjection?: string | undefined;
118
+ relatedSlugs?: string[] | undefined;
119
+ skillRefs?: string[] | undefined;
120
+ example?: string | undefined;
121
+ minimalExample?: string | undefined;
122
+ deprecated?: string | boolean | undefined;
123
+ since?: string | undefined;
124
+ }, {}>;
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Arktype schema for the `uiComponents` section of `dbx-mcp.scan.json`.
3
+ *
4
+ * UI scanning lives next to the existing semantic-types section — both use
5
+ * the same `dbx-mcp.scan.json` filename so a project that opts into both
6
+ * pipelines keeps a single config file. The CLI subcommand
7
+ * `scan-ui-components` reads only the `uiComponents` field; the
8
+ * `scan-semantic-types` subcommand continues to read the top-level fields
9
+ * unchanged.
10
+ *
11
+ * The schema is intentionally permissive at the root (extra keys are
12
+ * preserved untouched) so semantic-types and forge-fields configs can
13
+ * coexist without cross-section validation.
14
+ */
15
+ /**
16
+ * Inner config that drives one ui-components 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 UiComponentsScanSection: 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 UiComponentsScanSection}.
30
+ */
31
+ export type UiComponentsScanSection = typeof UiComponentsScanSection.infer;
32
+ /**
33
+ * Top-level shape used by the ui-components builder. Only the
34
+ * `uiComponents` key is consumed; the rest of the document is ignored so
35
+ * a single `dbx-mcp.scan.json` can house both semantic-types and
36
+ * ui-components configurations.
37
+ */
38
+ export declare const UiComponentsScanConfig: import("arktype/internal/variants/object.ts").ObjectType<{
39
+ version: 1;
40
+ uiComponents: {
41
+ include: string[];
42
+ source?: string | undefined;
43
+ module?: string | undefined;
44
+ exclude?: string[] | undefined;
45
+ out?: string | undefined;
46
+ };
47
+ }, {}>;
48
+ /**
49
+ * Static type inferred from {@link UiComponentsScanConfig}.
50
+ */
51
+ export type UiComponentsScanConfig = typeof UiComponentsScanConfig.infer;
52
+ /**
53
+ * Default value used when the scan config does not specify `out`.
54
+ * Lives next to the scan config in the project root.
55
+ */
56
+ export declare const DEFAULT_UI_COMPONENTS_SCAN_OUT_PATH = "ui-components.mcp.generated.json";
57
+ /**
58
+ * Filename the loader looks for at `${projectRoot}/`. Re-exported here so
59
+ * the ui-components CLI does not have to import from the semantic-types
60
+ * scan config module.
61
+ */
62
+ export declare const UI_COMPONENTS_SCAN_CONFIG_FILENAME = "dbx-mcp.scan.json";
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Orchestrator for the `scan-utils` generator.
3
+ *
4
+ * Composes a complete {@link UtilManifest} from a project root by
5
+ *
6
+ * 1. reading `dbx-mcp.scan.json` against {@link UtilsScanConfig}
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 extractUtilEntries}
11
+ * 6. assembling the manifest envelope and validating it against
12
+ * {@link UtilManifest}
13
+ *
14
+ * I/O is fully injectable so tests drive every code path without
15
+ * touching the real filesystem.
16
+ */
17
+ import { UtilManifest } from '../manifest/utils-schema.js';
18
+ import { type UtilExtractWarning } from './utils-extract.js';
19
+ import { type ScanGlobber, type ScanReadFile } from '../../scan-helpers/scan-io.js';
20
+ export type BuildUtilsReadFile = ScanReadFile;
21
+ export type BuildUtilsGlobber = ScanGlobber;
22
+ /**
23
+ * Input to {@link buildUtilsManifest}.
24
+ */
25
+ export interface BuildUtilsManifestInput {
26
+ readonly projectRoot: string;
27
+ readonly generator: string;
28
+ readonly now?: () => Date;
29
+ readonly readFile?: BuildUtilsReadFile;
30
+ readonly globber?: BuildUtilsGlobber;
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 diff
35
+ * against an existing on-disk version.
36
+ */
37
+ export type BuildUtilsManifestOutcome = {
38
+ readonly kind: 'success';
39
+ readonly manifest: UtilManifest;
40
+ readonly outPath: string;
41
+ readonly scannedFileCount: number;
42
+ readonly extractWarnings: readonly UtilExtractWarning[];
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 UtilManifest} from the supplied project root. The
63
+ * function is pure with respect to the injected I/O hooks, so unit tests
64
+ * 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 buildUtilsManifest(input: BuildUtilsManifestInput): Promise<BuildUtilsManifestOutcome>;
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 serializeUtilManifest(manifest: UtilManifest): string;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * `scan-utils` subcommand entry point.
3
+ *
4
+ * Thin wrapper around {@link runScanCliBase} that supplies the utils
5
+ * domain config.
6
+ */
7
+ import { type BuildUtilsGlobber } from './utils-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 UtilsScanCliReadFile = ScanCliBaseReadFile;
13
+ /**
14
+ * Function shape used to write the produced manifest in write mode.
15
+ */
16
+ export type UtilsScanCliWriteFile = ScanCliBaseWriteFile;
17
+ /**
18
+ * Console-shaped sink for stdout and stderr lines.
19
+ */
20
+ export type UtilsScanCliLogger = ScanCliBaseLogger;
21
+ /**
22
+ * Input to {@link runUtilsScanCli}.
23
+ */
24
+ export type RunUtilsScanCliInput = RunScanCliBaseInput<BuildUtilsGlobber>;
25
+ /**
26
+ * Result of one CLI invocation.
27
+ */
28
+ export type RunUtilsScanCliResult = RunScanCliResult;
29
+ /**
30
+ * Runs one invocation of `scan-utils`. 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 runUtilsScanCli(input: RunUtilsScanCliInput): Promise<RunUtilsScanCliResult>;
@@ -0,0 +1,103 @@
1
+ /**
2
+ * AST extraction for the `scan-utils` generator.
3
+ *
4
+ * Walks every source file in the supplied ts-morph `Project` looking for
5
+ * top-level exported declarations (functions, classes, `const` variable
6
+ * statements) tagged with the `@dbxUtil` JSDoc marker. Each match is
7
+ * normalised into an {@link ExtractedUtilEntry} that
8
+ * {@link buildUtilsManifest} assembles into a `UtilManifest` entry.
9
+ *
10
+ * Optional sub-tags supply overrides that can't be reliably auto-derived
11
+ * (slug, category, tags, related slugs, skill refs, kind). Sensible
12
+ * defaults are computed for each from the source — kebab-case of the
13
+ * export name, the parent folder of the source file, the export name +
14
+ * first JSDoc paragraph tokens, etc.
15
+ *
16
+ * The extractor prefers syntactic nodes (`getReturnTypeNode()`,
17
+ * `getTypeNode()`) and only falls back to type-checker inference
18
+ * (`getReturnType()`, `getType()`) when an explicit type annotation is
19
+ * absent. The syntactic-first path keeps the common case cheap on
20
+ * in-memory fixtures while still surfacing inferred types when authors
21
+ * elide them.
22
+ */
23
+ import { type Project } from 'ts-morph';
24
+ import type { UtilKindValue, UtilParamEntry } from '../manifest/utils-schema.js';
25
+ /**
26
+ * One util entry extracted from a source file. Mirrors {@link UtilEntry}
27
+ * minus `module` (derived from the package being scanned in
28
+ * build-manifest) and `subpath` (also derived in build-manifest from the
29
+ * project root). `filePath` and `line` are kept for in-process warnings
30
+ * and never persisted to the manifest.
31
+ */
32
+ export interface ExtractedUtilEntry {
33
+ readonly slug: string;
34
+ readonly name: string;
35
+ readonly kind: UtilKindValue;
36
+ readonly category: string;
37
+ readonly signature: string;
38
+ readonly description: string;
39
+ readonly params: readonly UtilParamEntry[];
40
+ readonly returns: string;
41
+ readonly tags: readonly string[];
42
+ readonly relatedSlugs?: readonly string[];
43
+ readonly skillRefs?: readonly string[];
44
+ readonly example: string;
45
+ readonly deprecated?: boolean | string;
46
+ readonly since?: string;
47
+ readonly filePath: string;
48
+ readonly line: number;
49
+ }
50
+ /**
51
+ * Discriminated union of the non-fatal events the extractor emits when an
52
+ * entry can't be assembled. Build-manifest collates these into a
53
+ * structured warning array so missing/invalid tag combinations surface
54
+ * during generation rather than silently dropping entries.
55
+ */
56
+ export type UtilExtractWarning = {
57
+ readonly kind: 'unsupported-kind-override';
58
+ readonly name: string;
59
+ readonly override: string;
60
+ readonly filePath: string;
61
+ readonly line: number;
62
+ } | {
63
+ readonly kind: 'missing-name';
64
+ readonly filePath: string;
65
+ readonly line: number;
66
+ } | {
67
+ readonly kind: 'duplicate-slug';
68
+ readonly name: string;
69
+ readonly slug: string;
70
+ readonly previousName: string;
71
+ readonly filePath: string;
72
+ readonly line: number;
73
+ };
74
+ /**
75
+ * Input to {@link extractUtilEntries}. The caller is responsible for
76
+ * adding source files to `project`.
77
+ */
78
+ export interface ExtractUtilEntriesInput {
79
+ readonly project: Project;
80
+ /**
81
+ * Repo-relative project root (e.g. `packages/util`). The extractor uses
82
+ * this so it can drop the project prefix from the warning `filePath`
83
+ * fields and so the build-manifest layer can compute `subpath` against
84
+ * a stable base.
85
+ */
86
+ readonly projectRoot?: string;
87
+ }
88
+ /**
89
+ * Result of {@link extractUtilEntries}.
90
+ */
91
+ export interface ExtractUtilEntriesResult {
92
+ readonly entries: readonly ExtractedUtilEntry[];
93
+ readonly warnings: readonly UtilExtractWarning[];
94
+ }
95
+ /**
96
+ * Walks the supplied project and returns every export tagged with the
97
+ * `@dbxUtil` JSDoc marker. Order is stable: source files in the order
98
+ * ts-morph reports them, declarations within a file in source order.
99
+ *
100
+ * @param input - The ts-morph project to scan.
101
+ * @returns The extracted entries plus any non-fatal warnings.
102
+ */
103
+ export declare function extractUtilEntries(input: ExtractUtilEntriesInput): ExtractUtilEntriesResult;
@@ -0,0 +1,57 @@
1
+ /**
2
+ * Arktype schema for the `utils` section of `dbx-mcp.scan.json`.
3
+ *
4
+ * Utils scanning lives next to the existing semantic-types, ui-components,
5
+ * forge-fields, and pipes 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-utils` reads only the `utils`
8
+ * field; sibling subcommands continue to read their own top-level fields
9
+ * unchanged.
10
+ */
11
+ /**
12
+ * Inner config that drives one utils 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
15
+ * produced entry. Both default to the project's `package.json#name` when
16
+ * omitted.
17
+ */
18
+ export declare const UtilsScanSection: 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 UtilsScanSection}.
27
+ */
28
+ export type UtilsScanSection = typeof UtilsScanSection.infer;
29
+ /**
30
+ * Top-level shape used by the utils builder. Only the `utils` key is
31
+ * consumed; the rest of the document is ignored so a single
32
+ * `dbx-mcp.scan.json` can house all the scan sections side-by-side.
33
+ */
34
+ export declare const UtilsScanConfig: import("arktype/internal/variants/object.ts").ObjectType<{
35
+ version: 1;
36
+ utils: {
37
+ include: string[];
38
+ source?: string | undefined;
39
+ module?: string | undefined;
40
+ exclude?: string[] | undefined;
41
+ out?: string | undefined;
42
+ };
43
+ }, {}>;
44
+ /**
45
+ * Static type inferred from {@link UtilsScanConfig}.
46
+ */
47
+ export type UtilsScanConfig = typeof UtilsScanConfig.infer;
48
+ /**
49
+ * Default value used when the scan config does not specify `out`.
50
+ * Lives next to the scan config in the project root.
51
+ */
52
+ export declare const DEFAULT_UTILS_SCAN_OUT_PATH = "utils.mcp.generated.json";
53
+ /**
54
+ * Filename the loader looks for at `${projectRoot}/`. Re-exported here so
55
+ * the utils CLI does not have to import from a sibling scan config module.
56
+ */
57
+ export declare const UTILS_SCAN_CONFIG_FILENAME = "dbx-mcp.scan.json";
package/test/package.json CHANGED
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "name": "@dereekb/dbx-cli/test",
3
- "version": "13.11.17",
3
+ "version": "13.12.0",
4
4
  "peerDependencies": {
5
- "@dereekb/date": "13.11.17",
6
- "@dereekb/dbx-cli": "13.11.17",
7
- "@dereekb/firebase": "13.11.17",
8
- "@dereekb/firebase-server/test": "13.11.17",
9
- "@dereekb/model": "13.11.17",
10
- "@dereekb/nestjs": "13.11.17",
11
- "@dereekb/rxjs": "13.11.17",
12
- "@dereekb/util": "13.11.17",
5
+ "@dereekb/date": "13.12.0",
6
+ "@dereekb/dbx-cli": "13.12.0",
7
+ "@dereekb/firebase": "13.12.0",
8
+ "@dereekb/firebase-server/test": "13.12.0",
9
+ "@dereekb/model": "13.12.0",
10
+ "@dereekb/nestjs": "13.12.0",
11
+ "@dereekb/rxjs": "13.12.0",
12
+ "@dereekb/util": "13.12.0",
13
13
  "@nestjs/common": "^11.1.19",
14
14
  "arktype": "^2.2.0",
15
15
  "yargs": "^18.0.0"
@@ -1 +0,0 @@
1
- exports._default = require('./index.cjs.js').default;
package/index.cjs.mjs DELETED
@@ -1,2 +0,0 @@
1
- export * from './index.cjs.js';
2
- export { _default as default } from './index.cjs.default.js';