@dereekb/dbx-cli 13.11.18 → 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,58 @@
1
+ /**
2
+ * Orchestrator for the `scan-actions` generator.
3
+ *
4
+ * Composes a complete {@link ActionManifest} from a project root by reading
5
+ * `dbx-mcp.scan.json`, `package.json`, resolving include/exclude globs,
6
+ * feeding files into a ts-morph project, extracting entries via
7
+ * {@link extractActionEntries}, and assembling the manifest envelope.
8
+ */
9
+ import { ActionManifest } from '../manifest/actions-schema.js';
10
+ import { type ActionExtractWarning } from './actions-extract.js';
11
+ import { type ScanGlobber, type ScanReadFile } from '../../scan-helpers/scan-io.js';
12
+ export type BuildActionsReadFile = ScanReadFile;
13
+ export type BuildActionsGlobber = ScanGlobber;
14
+ export interface BuildActionsManifestInput {
15
+ readonly projectRoot: string;
16
+ readonly generator: string;
17
+ readonly now?: () => Date;
18
+ readonly readFile?: BuildActionsReadFile;
19
+ readonly globber?: BuildActionsGlobber;
20
+ }
21
+ export type BuildActionsManifestOutcome = {
22
+ readonly kind: 'success';
23
+ readonly manifest: ActionManifest;
24
+ readonly outPath: string;
25
+ readonly scannedFileCount: number;
26
+ readonly extractWarnings: readonly ActionExtractWarning[];
27
+ } | {
28
+ readonly kind: 'no-config';
29
+ readonly configPath: string;
30
+ } | {
31
+ readonly kind: 'invalid-scan-config';
32
+ readonly configPath: string;
33
+ readonly error: string;
34
+ } | {
35
+ readonly kind: 'no-package';
36
+ readonly packagePath: string;
37
+ } | {
38
+ readonly kind: 'invalid-package';
39
+ readonly packagePath: string;
40
+ readonly error: string;
41
+ } | {
42
+ readonly kind: 'invalid-manifest';
43
+ readonly error: string;
44
+ };
45
+ /**
46
+ * Loads the project's actions scan config, scans the configured files, extracts every action directive/store/state, and builds a validated {@link ActionManifest}.
47
+ *
48
+ * @param input - Build options including the project root, generator metadata, and optional file/glob/clock overrides.
49
+ * @returns A discriminated outcome describing success or the specific failure that occurred.
50
+ */
51
+ export declare function buildActionsManifest(input: BuildActionsManifestInput): Promise<BuildActionsManifestOutcome>;
52
+ /**
53
+ * Serializes a validated action manifest as pretty-printed JSON terminated with a newline.
54
+ *
55
+ * @param manifest - The validated action manifest to serialize.
56
+ * @returns A JSON string suitable for writing to disk.
57
+ */
58
+ export declare function serializeActionManifest(manifest: ActionManifest): string;
@@ -0,0 +1,38 @@
1
+ /**
2
+ * `scan-actions` subcommand entry point.
3
+ *
4
+ * Thin wrapper around {@link runScanCliBase} that supplies the actions
5
+ * domain config — USAGE block, `buildActionsManifest` build function,
6
+ * `serializeActionManifest` serializer, and the per-warning formatter.
7
+ */
8
+ import { type BuildActionsGlobber } from './actions-build-manifest.js';
9
+ import { type RunScanCliBaseInput, type RunScanCliResult, type ScanCliBaseLogger, type ScanCliBaseReadFile, type ScanCliBaseWriteFile } from './scan-cli-base.js';
10
+ /**
11
+ * Function shape used to read text files during `--check`.
12
+ */
13
+ export type ActionsScanCliReadFile = ScanCliBaseReadFile;
14
+ /**
15
+ * Function shape used to write the produced manifest in write mode.
16
+ */
17
+ export type ActionsScanCliWriteFile = ScanCliBaseWriteFile;
18
+ /**
19
+ * Console-shaped sink for stdout and stderr lines.
20
+ */
21
+ export type ActionsScanCliLogger = ScanCliBaseLogger;
22
+ /**
23
+ * Input to {@link runActionsScanCli}.
24
+ */
25
+ export type RunActionsScanCliInput = RunScanCliBaseInput<BuildActionsGlobber>;
26
+ /**
27
+ * Result of one CLI invocation.
28
+ */
29
+ export type RunActionsScanCliResult = RunScanCliResult;
30
+ /**
31
+ * Runs one invocation of `scan-actions`. Never throws on user errors —
32
+ * every failure path returns a structured exit code so callers can wire
33
+ * this into `process.exit` without try/catch.
34
+ *
35
+ * @param input - Argv plus injectable I/O hooks.
36
+ * @returns The CLI's exit code (0 on success, 1 on drift / build failure, 2 on usage error)
37
+ */
38
+ export declare function runActionsScanCli(input: RunActionsScanCliInput): Promise<RunActionsScanCliResult>;
@@ -0,0 +1,99 @@
1
+ /**
2
+ * AST extraction for the `scan-actions` generator.
3
+ *
4
+ * Walks every source file in the supplied ts-morph `Project` looking for
5
+ * three entry shapes:
6
+ *
7
+ * - Classes with `@Directive()` decorator and `@dbxAction` JSDoc marker → directive entries
8
+ * - Classes with `@dbxAction` JSDoc marker and `@dbxActionRole store` tag → store entries
9
+ * - Enum declarations with `@dbxActionStateEnum` JSDoc marker → one state entry per member
10
+ */
11
+ import { type Project } from 'ts-morph';
12
+ import type { ActionInputEntry, ActionOutputEntry, ActionStoreMethodEntry, ActionStoreObservableEntry, DbxActionStateValue } from '../manifest/actions-schema.js';
13
+ /**
14
+ * One action entry extracted from a source file. `module` is supplied by the
15
+ * build phase. `filePath` and `line` are kept here for in-process warnings
16
+ * and never persisted to the manifest.
17
+ */
18
+ export type ExtractedActionEntry = ExtractedActionDirective | ExtractedActionStore | ExtractedActionState;
19
+ export interface ExtractedActionDirective {
20
+ readonly role: 'directive';
21
+ readonly slug: string;
22
+ readonly selector: string;
23
+ readonly className: string;
24
+ readonly description: string;
25
+ readonly inputs: readonly ActionInputEntry[];
26
+ readonly outputs: readonly ActionOutputEntry[];
27
+ readonly producesContext: boolean;
28
+ readonly consumesContext: boolean;
29
+ readonly stateInteraction: readonly DbxActionStateValue[];
30
+ readonly skillRefs: readonly string[];
31
+ readonly example: string;
32
+ readonly filePath: string;
33
+ readonly line: number;
34
+ }
35
+ export interface ExtractedActionStore {
36
+ readonly role: 'store';
37
+ readonly slug: string;
38
+ readonly className: string;
39
+ readonly description: string;
40
+ readonly methods: readonly ActionStoreMethodEntry[];
41
+ readonly observables: readonly ActionStoreObservableEntry[];
42
+ readonly disabledKeyDefaults: readonly string[];
43
+ readonly skillRefs: readonly string[];
44
+ readonly example: string;
45
+ readonly filePath: string;
46
+ readonly line: number;
47
+ }
48
+ export interface ExtractedActionState {
49
+ readonly role: 'state';
50
+ readonly slug: string;
51
+ readonly stateValue: DbxActionStateValue;
52
+ readonly literal: string;
53
+ readonly description: string;
54
+ readonly transitionsFrom: readonly DbxActionStateValue[];
55
+ readonly transitionsTo: readonly DbxActionStateValue[];
56
+ readonly skillRefs: readonly string[];
57
+ readonly example: string;
58
+ readonly filePath: string;
59
+ readonly line: number;
60
+ }
61
+ export type ActionExtractWarning = {
62
+ readonly kind: 'missing-required-tag';
63
+ readonly className: string;
64
+ readonly tag: string;
65
+ readonly filePath: string;
66
+ readonly line: number;
67
+ } | {
68
+ readonly kind: 'unknown-role';
69
+ readonly className: string;
70
+ readonly role: string;
71
+ readonly filePath: string;
72
+ readonly line: number;
73
+ } | {
74
+ readonly kind: 'unknown-state-value';
75
+ readonly className: string;
76
+ readonly stateValue: string;
77
+ readonly filePath: string;
78
+ readonly line: number;
79
+ } | {
80
+ readonly kind: 'missing-directive-decorator';
81
+ readonly className: string;
82
+ readonly filePath: string;
83
+ readonly line: number;
84
+ };
85
+ export interface ExtractActionEntriesInput {
86
+ readonly project: Project;
87
+ }
88
+ export interface ExtractActionEntriesResult {
89
+ readonly entries: readonly ExtractedActionEntry[];
90
+ readonly warnings: readonly ActionExtractWarning[];
91
+ }
92
+ /**
93
+ * Walks the supplied project and returns every action entry. Order is stable.
94
+ *
95
+ * @param input - The extraction context.
96
+ * @param input.project - The ts-morph project containing source files to scan.
97
+ * @returns The collected action entries and any non-fatal warnings encountered during extraction.
98
+ */
99
+ export declare function extractActionEntries(input: ExtractActionEntriesInput): ExtractActionEntriesResult;
@@ -0,0 +1,42 @@
1
+ /**
2
+ * Arktype schema for the `actions` section of `dbx-mcp.scan.json`.
3
+ */
4
+ /**
5
+ * Inner config that drives one actions scan run.
6
+ */
7
+ export declare const ActionsScanSection: import("arktype/internal/variants/object.ts").ObjectType<{
8
+ include: string[];
9
+ source?: string | undefined;
10
+ module?: string | undefined;
11
+ exclude?: string[] | undefined;
12
+ out?: string | undefined;
13
+ }, {}>;
14
+ /**
15
+ * Static type inferred from {@link ActionsScanSection}.
16
+ */
17
+ export type ActionsScanSection = typeof ActionsScanSection.infer;
18
+ /**
19
+ * Top-level shape used by the actions builder.
20
+ */
21
+ export declare const ActionsScanConfig: import("arktype/internal/variants/object.ts").ObjectType<{
22
+ version: 1;
23
+ actions: {
24
+ include: string[];
25
+ source?: string | undefined;
26
+ module?: string | undefined;
27
+ exclude?: string[] | undefined;
28
+ out?: string | undefined;
29
+ };
30
+ }, {}>;
31
+ /**
32
+ * Static type inferred from {@link ActionsScanConfig}.
33
+ */
34
+ export type ActionsScanConfig = typeof ActionsScanConfig.infer;
35
+ /**
36
+ * Default value used when the scan config does not specify `out`.
37
+ */
38
+ export declare const DEFAULT_ACTIONS_SCAN_OUT_PATH = "actions.mcp.generated.json";
39
+ /**
40
+ * Filename the loader looks for at `${projectRoot}/`.
41
+ */
42
+ export declare const ACTIONS_SCAN_CONFIG_FILENAME = "dbx-mcp.scan.json";
@@ -0,0 +1,120 @@
1
+ /**
2
+ * AST extraction for the auth catalog.
3
+ *
4
+ * Walks the supplied ts-morph `Project` looking for:
5
+ *
6
+ * - Type aliases / interfaces tagged with `@dbxAuthClaimsApp <slug>` —
7
+ * each becomes one {@link ExtractedAuthApp} plus zero-or-more
8
+ * {@link ExtractedAuthClaim} entries (one per property tagged with
9
+ * `@dbxAuthClaim`).
10
+ *
11
+ * - Variable declarations tagged with `@dbxAuthClaimsService <slug>` —
12
+ * each provides the role-mapping payload for the matching app's
13
+ * claims by inspecting the call to `authRoleClaimsService({ ... })`.
14
+ *
15
+ * The extractor is intentionally syntactic — no type checker calls — so it
16
+ * runs cheaply on in-memory fixtures and the demo's `claims.ts`. Role
17
+ * constants like `AUTH_ADMIN_ROLE` are resolved through the supplied
18
+ * {@link AuthExtractKnownRoles} map; unresolved identifiers fall through as
19
+ * the identifier text so callers can still see them in registry output.
20
+ */
21
+ import { type Project } from 'ts-morph';
22
+ import type { AuthClaimRoleMappingInfo } from '../registry/auth-runtime.js';
23
+ /**
24
+ * One claim extracted from an app's `*ApiAuthClaims` interface.
25
+ */
26
+ export interface ExtractedAuthClaim {
27
+ readonly key: string;
28
+ readonly type: string;
29
+ readonly description: string;
30
+ readonly app: string;
31
+ readonly interfaceName: string;
32
+ readonly tags: readonly string[];
33
+ readonly mapping: AuthClaimRoleMappingInfo;
34
+ readonly filePath: string;
35
+ readonly line: number;
36
+ }
37
+ /**
38
+ * One app-level entry extracted from a downstream claims module. Mirrors
39
+ * {@link AuthAppInfo} but uses workspace-relative file paths populated by
40
+ * the loader.
41
+ */
42
+ export interface ExtractedAuthApp {
43
+ readonly app: string;
44
+ readonly claimsInterfaceName: string;
45
+ readonly serviceConstName?: string;
46
+ readonly inheritedInterfaceNames: readonly string[];
47
+ readonly ownClaimKeys: readonly string[];
48
+ readonly filePath: string;
49
+ readonly line: number;
50
+ }
51
+ /**
52
+ * Discriminated union of non-fatal events the extractor emits when a
53
+ * tagged decl can't be assembled into a complete entry. The loader
54
+ * forwards these to the server bootstrap so operators can spot
55
+ * mis-tagged downstream files at startup.
56
+ */
57
+ export type AuthExtractWarning = {
58
+ readonly kind: 'app-missing-slug';
59
+ readonly interfaceName: string;
60
+ readonly filePath: string;
61
+ readonly line: number;
62
+ } | {
63
+ readonly kind: 'service-missing-slug';
64
+ readonly constName: string;
65
+ readonly filePath: string;
66
+ readonly line: number;
67
+ } | {
68
+ readonly kind: 'service-without-app';
69
+ readonly constName: string;
70
+ readonly slug: string;
71
+ readonly filePath: string;
72
+ readonly line: number;
73
+ } | {
74
+ readonly kind: 'claim-missing-mapping';
75
+ readonly app: string;
76
+ readonly key: string;
77
+ readonly filePath: string;
78
+ readonly line: number;
79
+ } | {
80
+ readonly kind: 'unresolved-role-const';
81
+ readonly app: string;
82
+ readonly key: string;
83
+ readonly constName: string;
84
+ readonly filePath: string;
85
+ readonly line: number;
86
+ };
87
+ /**
88
+ * Map from role-constant name (e.g. `AUTH_ADMIN_ROLE`) to its resolved
89
+ * role string (`'admin'`). The built-in roles populate this; downstream
90
+ * apps that introduce their own role constants can extend the map at the
91
+ * loader layer once that becomes a workflow.
92
+ */
93
+ export type AuthExtractKnownRoles = ReadonlyMap<string, string>;
94
+ /**
95
+ * Input to {@link extractAuthEntries}. The caller is responsible for adding
96
+ * source files to `project` (either from disk, in-memory fixtures, or
97
+ * a tsconfig). `knownRoles` is consulted when resolving identifier-style
98
+ * role references like `AUTH_ADMIN_ROLE`.
99
+ */
100
+ export interface ExtractAuthEntriesInput {
101
+ readonly project: Project;
102
+ readonly knownRoles: AuthExtractKnownRoles;
103
+ }
104
+ /**
105
+ * Aggregated outcome of {@link extractAuthEntries}.
106
+ */
107
+ export interface ExtractAuthEntriesResult {
108
+ readonly apps: readonly ExtractedAuthApp[];
109
+ readonly claims: readonly ExtractedAuthClaim[];
110
+ readonly warnings: readonly AuthExtractWarning[];
111
+ }
112
+ /**
113
+ * Walks the supplied project and returns every app/claim entry tagged with
114
+ * the auth JSDoc markers. Order is stable: source files in the order
115
+ * ts-morph reports them, declarations within a file in source order.
116
+ *
117
+ * @param input - The ts-morph project plus the known-roles resolution map.
118
+ * @returns The extracted apps, claims, and any non-fatal warnings.
119
+ */
120
+ export declare function extractAuthEntries(input: ExtractAuthEntriesInput): ExtractAuthEntriesResult;
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Orchestrator for the `scan-semantic-types` generator.
3
+ *
4
+ * Composes a complete {@link SemanticTypeManifest} from a project root by
5
+ *
6
+ * 1. reading `dbx-mcp.scan.json` against {@link SemanticTypeScanConfig}
7
+ * 2. reading `package.json` to derive the entry-level `package` 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 extractEntries}
11
+ * 6. assembling the manifest envelope and validating it against
12
+ * {@link SemanticTypeManifest}
13
+ *
14
+ * I/O is fully injectable so tests drive every code path without
15
+ * touching the real filesystem.
16
+ */
17
+ import { SemanticTypeManifest } from '../manifest/semantic-types-schema.js';
18
+ import { type ScanGlobber, type ScanReadFile } from '../../scan-helpers/scan-io.js';
19
+ export type BuildManifestReadFile = ScanReadFile;
20
+ export type BuildManifestGlobber = ScanGlobber;
21
+ /**
22
+ * Input to {@link buildManifest}.
23
+ */
24
+ export interface BuildManifestInput {
25
+ readonly projectRoot: string;
26
+ readonly generator: string;
27
+ readonly now?: () => Date;
28
+ readonly readFile?: BuildManifestReadFile;
29
+ readonly globber?: BuildManifestGlobber;
30
+ }
31
+ /**
32
+ * Outcome of one generator run. The success payload carries everything
33
+ * the caller needs to write the manifest to disk or run a freshness
34
+ * diff against an existing on-disk version.
35
+ */
36
+ export type BuildManifestOutcome = {
37
+ readonly kind: 'success';
38
+ readonly manifest: SemanticTypeManifest;
39
+ readonly outPath: string;
40
+ readonly scannedFileCount: number;
41
+ } | {
42
+ readonly kind: 'no-config';
43
+ readonly configPath: string;
44
+ } | {
45
+ readonly kind: 'invalid-scan-config';
46
+ readonly configPath: string;
47
+ readonly error: string;
48
+ } | {
49
+ readonly kind: 'no-package';
50
+ readonly packagePath: string;
51
+ } | {
52
+ readonly kind: 'invalid-package';
53
+ readonly packagePath: string;
54
+ readonly error: string;
55
+ } | {
56
+ readonly kind: 'invalid-manifest';
57
+ readonly error: string;
58
+ };
59
+ /**
60
+ * Builds a {@link SemanticTypeManifest} from the supplied project root.
61
+ * The function is pure with respect to the injected I/O hooks, so unit
62
+ * tests can drive every branch without disk access.
63
+ *
64
+ * @param input - The project root + injection hooks for testing.
65
+ * @returns A discriminated outcome describing the result.
66
+ */
67
+ export declare function buildManifest(input: BuildManifestInput): Promise<BuildManifestOutcome>;
68
+ /**
69
+ * JSON-stringifies a manifest with stable key ordering and trailing
70
+ * newline so `--check` mode can byte-compare against a committed file
71
+ * without false-positive diffs from key reordering.
72
+ *
73
+ * @param manifest - The manifest to serialise.
74
+ * @returns The canonical string form.
75
+ */
76
+ export declare function serializeManifest(manifest: SemanticTypeManifest): string;
@@ -0,0 +1,60 @@
1
+ /**
2
+ * `scan-semantic-types` subcommand entry point.
3
+ *
4
+ * Parses argv, runs {@link buildManifest}, and either writes the
5
+ * resulting JSON to disk or compares it to the existing on-disk
6
+ * manifest (`--check` mode) and exits non-zero on drift.
7
+ *
8
+ * The CLI is exposed via the `dbx-components-mcp` binary's argv
9
+ * dispatcher in `bin/dbx-components-mcp.ts`. All I/O is injectable so
10
+ * unit tests can drive the entire control flow without disk access.
11
+ */
12
+ import { type BuildManifestGlobber } from './build-manifest.js';
13
+ /**
14
+ * Function shape used to read text files during `--check`.
15
+ */
16
+ export type ScanCliReadFile = (absolutePath: string) => Promise<string>;
17
+ /**
18
+ * Function shape used to write the produced manifest in write mode.
19
+ */
20
+ export type ScanCliWriteFile = (absolutePath: string, data: string) => Promise<void>;
21
+ /**
22
+ * Console-shaped sink for stdout and stderr lines. Tests inject a
23
+ * collecting implementation.
24
+ */
25
+ export type ScanCliLogger = (message: string) => void;
26
+ /**
27
+ * Input to {@link runScanCli}. `argv` is `process.argv` after the
28
+ * subcommand token (so `['--project', 'apps/hellosubs']`). When
29
+ * `readFile` / `writeFile` / `globber` are supplied they are also
30
+ * forwarded into {@link buildManifest} so unit tests can drive the
31
+ * full pipeline without disk access.
32
+ */
33
+ export interface RunScanCliInput {
34
+ readonly argv: readonly string[];
35
+ readonly cwd: string;
36
+ readonly generator: string;
37
+ readonly readFile?: ScanCliReadFile;
38
+ readonly writeFile?: ScanCliWriteFile;
39
+ readonly globber?: BuildManifestGlobber;
40
+ readonly now?: () => Date;
41
+ readonly log?: ScanCliLogger;
42
+ readonly errorLog?: ScanCliLogger;
43
+ }
44
+ /**
45
+ * Result of one CLI invocation. The returned `exitCode` is what the
46
+ * `bin/` shim should pass to `process.exit`.
47
+ */
48
+ export interface RunScanCliResult {
49
+ readonly exitCode: number;
50
+ }
51
+ /**
52
+ * Runs one invocation of `scan-semantic-types`. The function never
53
+ * throws on user errors — every failure path returns a structured
54
+ * exit code so callers can wire this into `process.exit` without
55
+ * try/catch.
56
+ *
57
+ * @param input - Argv plus injectable I/O hooks.
58
+ * @returns The CLI's exit code (0 on success, 1 on drift / build failure, 2 on usage error)
59
+ */
60
+ export declare function runScanCli(input: RunScanCliInput): Promise<RunScanCliResult>;
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Orchestrator for the `scan-css-utilities` generator.
3
+ *
4
+ * Composes a complete {@link CssUtilityManifest} from a project root by
5
+ *
6
+ * 1. reading `dbx-mcp.scan.json` against {@link CssUtilitiesScanConfig}
7
+ * 2. reading `package.json` to derive the entry-level `module` field
8
+ * 3. resolving include/exclude globs against the project root
9
+ * 4. extracting every annotated utility class via
10
+ * {@link extractCssUtilityEntries}
11
+ * 5. assembling the manifest envelope and validating it against
12
+ * {@link CssUtilityManifest}
13
+ *
14
+ * I/O is fully injectable so tests drive every code path without
15
+ * touching the real filesystem.
16
+ */
17
+ import { CssUtilityManifest } from '../manifest/css-utilities-schema.js';
18
+ import { type ExtractWarning } from './css-utilities-extract.js';
19
+ import { type ScanGlobber, type ScanReadFile } from '../../scan-helpers/scan-io.js';
20
+ export type BuildCssUtilitiesReadFile = ScanReadFile;
21
+ export type BuildCssUtilitiesGlobber = ScanGlobber;
22
+ /**
23
+ * Input to {@link buildCssUtilitiesManifest}.
24
+ */
25
+ export interface BuildCssUtilitiesManifestInput {
26
+ readonly projectRoot: string;
27
+ readonly generator: string;
28
+ readonly now?: () => Date;
29
+ readonly readFile?: BuildCssUtilitiesReadFile;
30
+ readonly globber?: BuildCssUtilitiesGlobber;
31
+ }
32
+ /**
33
+ * Outcome of one generator run.
34
+ */
35
+ export type BuildCssUtilitiesManifestOutcome = {
36
+ readonly kind: 'success';
37
+ readonly manifest: CssUtilityManifest;
38
+ readonly outPath: string;
39
+ readonly scannedFileCount: number;
40
+ readonly extractWarnings: readonly ExtractWarning[];
41
+ } | {
42
+ readonly kind: 'no-config';
43
+ readonly configPath: string;
44
+ } | {
45
+ readonly kind: 'invalid-scan-config';
46
+ readonly configPath: string;
47
+ readonly error: string;
48
+ } | {
49
+ readonly kind: 'no-package';
50
+ readonly packagePath: string;
51
+ } | {
52
+ readonly kind: 'invalid-package';
53
+ readonly packagePath: string;
54
+ readonly error: string;
55
+ } | {
56
+ readonly kind: 'invalid-manifest';
57
+ readonly error: string;
58
+ };
59
+ /**
60
+ * Builds a {@link CssUtilityManifest} from the supplied project root. The
61
+ * function is pure with respect to the injected I/O hooks, so unit tests
62
+ * can drive every branch without disk access.
63
+ *
64
+ * @param input - The project root + injection hooks for testing.
65
+ * @returns A discriminated outcome describing the result.
66
+ */
67
+ export declare function buildCssUtilitiesManifest(input: BuildCssUtilitiesManifestInput): Promise<BuildCssUtilitiesManifestOutcome>;
68
+ /**
69
+ * JSON-stringifies a manifest with stable key ordering and trailing newline
70
+ * so `--check` mode can byte-compare against a committed file without
71
+ * false-positive diffs from key reordering.
72
+ *
73
+ * @param manifest - The manifest to serialise.
74
+ * @returns The canonical string form.
75
+ */
76
+ export declare function serializeCssUtilityManifest(manifest: CssUtilityManifest): string;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * `scan-css-utilities` subcommand entry point.
3
+ *
4
+ * Thin wrapper around {@link runScanCliBase} that supplies the
5
+ * css-utilities domain config.
6
+ */
7
+ import { type BuildCssUtilitiesGlobber } from './css-utilities-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 CssUtilitiesScanCliReadFile = ScanCliBaseReadFile;
13
+ /**
14
+ * Function shape used to write the produced manifest in write mode.
15
+ */
16
+ export type CssUtilitiesScanCliWriteFile = ScanCliBaseWriteFile;
17
+ /**
18
+ * Console-shaped sink for stdout and stderr lines.
19
+ */
20
+ export type CssUtilitiesScanCliLogger = ScanCliBaseLogger;
21
+ /**
22
+ * Input to {@link runCssUtilitiesScanCli}.
23
+ */
24
+ export type RunCssUtilitiesScanCliInput = RunScanCliBaseInput<BuildCssUtilitiesGlobber>;
25
+ /**
26
+ * Result of one CLI invocation.
27
+ */
28
+ export type RunCssUtilitiesScanCliResult = RunScanCliResult;
29
+ /**
30
+ * Runs one invocation of `scan-css-utilities`. Never throws on user errors —
31
+ * every failure path returns a structured exit code.
32
+ *
33
+ * @param input - Argv plus injectable I/O hooks.
34
+ * @returns The CLI's exit code (0 on success, 1 on drift / build failure, 2 on usage error)
35
+ */
36
+ export declare function runCssUtilitiesScanCli(input: RunCssUtilitiesScanCliInput): Promise<RunCssUtilitiesScanCliResult>;