@dereekb/dbx-components-mcp 13.11.3 → 13.11.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dbx-components-mcp.js
CHANGED
|
@@ -5,7 +5,7 @@ const require = __createRequire(import.meta.url);
|
|
|
5
5
|
// packages/dbx-components-mcp/package.json
|
|
6
6
|
var package_default = {
|
|
7
7
|
name: "@dereekb/dbx-components-mcp",
|
|
8
|
-
version: "13.11.
|
|
8
|
+
version: "13.11.4",
|
|
9
9
|
type: "module",
|
|
10
10
|
bin: {
|
|
11
11
|
"dbx-components-mcp": "dbx-components-mcp.js"
|
|
@@ -20,20 +20,20 @@ var package_default = {
|
|
|
20
20
|
"@angular/core": "21.2.11",
|
|
21
21
|
"@angular/forms": "21.2.11",
|
|
22
22
|
"@angular/material": "^21.2.9",
|
|
23
|
-
"@dereekb/dbx-cli": "13.11.
|
|
24
|
-
"@dereekb/dbx-core": "13.11.
|
|
25
|
-
"@dereekb/dbx-firebase": "13.11.
|
|
26
|
-
"@dereekb/dbx-form": "13.11.
|
|
27
|
-
"@dereekb/dbx-web": "13.11.
|
|
28
|
-
"@dereekb/firebase": "13.11.
|
|
29
|
-
"@dereekb/firebase-server": "13.11.
|
|
30
|
-
"@dereekb/rxjs": "13.11.
|
|
31
|
-
"@dereekb/util": "13.11.
|
|
23
|
+
"@dereekb/dbx-cli": "13.11.4",
|
|
24
|
+
"@dereekb/dbx-core": "13.11.4",
|
|
25
|
+
"@dereekb/dbx-firebase": "13.11.4",
|
|
26
|
+
"@dereekb/dbx-form": "13.11.4",
|
|
27
|
+
"@dereekb/dbx-web": "13.11.4",
|
|
28
|
+
"@dereekb/firebase": "13.11.4",
|
|
29
|
+
"@dereekb/firebase-server": "13.11.4",
|
|
30
|
+
"@dereekb/rxjs": "13.11.4",
|
|
31
|
+
"@dereekb/util": "13.11.4",
|
|
32
32
|
"@uirouter/angular": "21.0.0",
|
|
33
33
|
rxjs: "^7.8.2"
|
|
34
34
|
},
|
|
35
35
|
devDependencies: {
|
|
36
|
-
"@dereekb/model": "13.11.
|
|
36
|
+
"@dereekb/model": "13.11.4"
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
39
|
|
|
@@ -855,10 +855,10 @@ var defaultGlobber = async (input) => {
|
|
|
855
855
|
}
|
|
856
856
|
return matches;
|
|
857
857
|
};
|
|
858
|
-
async function loadPackageName(packagePath,
|
|
858
|
+
async function loadPackageName(packagePath, readFile23) {
|
|
859
859
|
let raw = null;
|
|
860
860
|
try {
|
|
861
|
-
raw = await
|
|
861
|
+
raw = await readFile23(packagePath);
|
|
862
862
|
} catch {
|
|
863
863
|
raw = null;
|
|
864
864
|
}
|
|
@@ -887,8 +887,8 @@ async function loadPackageName(packagePath, readFile22) {
|
|
|
887
887
|
return result;
|
|
888
888
|
}
|
|
889
889
|
async function loadScanSection(input) {
|
|
890
|
-
const { configPath, readFile:
|
|
891
|
-
const readResult = await readScanConfigRaw(configPath,
|
|
890
|
+
const { configPath, readFile: readFile23, parseSection } = input;
|
|
891
|
+
const readResult = await readScanConfigRaw(configPath, readFile23);
|
|
892
892
|
let result;
|
|
893
893
|
if (readResult.kind === "error") {
|
|
894
894
|
result = { kind: "fail", outcome: { kind: "invalid-scan-config", configPath, error: `failed to read config: ${readResult.error}` } };
|
|
@@ -899,10 +899,10 @@ async function loadScanSection(input) {
|
|
|
899
899
|
}
|
|
900
900
|
return result;
|
|
901
901
|
}
|
|
902
|
-
async function readScanConfigRaw(configPath,
|
|
902
|
+
async function readScanConfigRaw(configPath, readFile23) {
|
|
903
903
|
let result;
|
|
904
904
|
try {
|
|
905
|
-
const raw = await
|
|
905
|
+
const raw = await readFile23(configPath);
|
|
906
906
|
result = { kind: "ok", raw };
|
|
907
907
|
} catch (err) {
|
|
908
908
|
const code14 = err?.code;
|
|
@@ -939,11 +939,11 @@ function parseJsonString(raw) {
|
|
|
939
939
|
return result;
|
|
940
940
|
}
|
|
941
941
|
async function buildScanProject(input) {
|
|
942
|
-
const { projectRoot, filePaths, readFile:
|
|
942
|
+
const { projectRoot, filePaths, readFile: readFile23 } = input;
|
|
943
943
|
const project = new Project({ useInMemoryFileSystem: true, skipAddingFilesFromTsConfig: true });
|
|
944
944
|
for (const relPath of filePaths) {
|
|
945
945
|
const absolute = resolvePath(projectRoot, relPath);
|
|
946
|
-
const text = await
|
|
946
|
+
const text = await readFile23(absolute);
|
|
947
947
|
project.createSourceFile(absolute, text, { overwrite: true });
|
|
948
948
|
}
|
|
949
949
|
return project;
|
|
@@ -980,12 +980,12 @@ function globToRegex(pattern) {
|
|
|
980
980
|
var DEFAULT_READ_FILE = defaultReadFile;
|
|
981
981
|
var DEFAULT_GLOBBER = defaultGlobber;
|
|
982
982
|
async function buildForgeFieldsManifest(input) {
|
|
983
|
-
const { projectRoot, generator, readFile:
|
|
983
|
+
const { projectRoot, generator, readFile: readFile23 = DEFAULT_READ_FILE, globber = DEFAULT_GLOBBER, now = () => /* @__PURE__ */ new Date() } = input;
|
|
984
984
|
const configPath = resolve(projectRoot, FORGE_FIELDS_SCAN_CONFIG_FILENAME);
|
|
985
985
|
const packagePath = resolve(projectRoot, "package.json");
|
|
986
986
|
const configOutcome = await loadScanSection({
|
|
987
987
|
configPath,
|
|
988
|
-
readFile:
|
|
988
|
+
readFile: readFile23,
|
|
989
989
|
parseSection: (parsed) => {
|
|
990
990
|
const validated2 = ForgeFieldsScanConfig(parsed);
|
|
991
991
|
if (validated2 instanceof type4.errors) {
|
|
@@ -998,7 +998,7 @@ async function buildForgeFieldsManifest(input) {
|
|
|
998
998
|
return configOutcome.outcome;
|
|
999
999
|
}
|
|
1000
1000
|
const scanSection = configOutcome.section;
|
|
1001
|
-
const packageOutcome = await loadPackageName(packagePath,
|
|
1001
|
+
const packageOutcome = await loadPackageName(packagePath, readFile23);
|
|
1002
1002
|
if (packageOutcome.kind !== "ok") {
|
|
1003
1003
|
return packageOutcome.outcome;
|
|
1004
1004
|
}
|
|
@@ -1008,7 +1008,7 @@ async function buildForgeFieldsManifest(input) {
|
|
|
1008
1008
|
include: scanSection.include,
|
|
1009
1009
|
exclude: scanSection.exclude ?? []
|
|
1010
1010
|
});
|
|
1011
|
-
const project = await buildScanProject({ projectRoot, filePaths, readFile:
|
|
1011
|
+
const project = await buildScanProject({ projectRoot, filePaths, readFile: readFile23 });
|
|
1012
1012
|
const extractResult = extractForgeFieldEntries({ project });
|
|
1013
1013
|
const moduleName = scanSection.module ?? packageName;
|
|
1014
1014
|
const sourceLabel = scanSection.source ?? packageName;
|
|
@@ -1071,7 +1071,7 @@ import { resolve as resolve2 } from "node:path";
|
|
|
1071
1071
|
var DEFAULT_READ_FILE2 = (path) => nodeReadFile2(path, "utf-8");
|
|
1072
1072
|
var DEFAULT_WRITE_FILE = (path, data) => nodeWriteFile(path, data, "utf-8");
|
|
1073
1073
|
async function runScanCliBase(input, config) {
|
|
1074
|
-
const { argv, cwd, generator, readFile:
|
|
1074
|
+
const { argv, cwd, generator, readFile: readFile23 = DEFAULT_READ_FILE2, writeFile: writeFile2 = DEFAULT_WRITE_FILE, globber, now, log = console.log, errorLog = console.error } = input;
|
|
1075
1075
|
let result;
|
|
1076
1076
|
const args = parseScanArgs(argv);
|
|
1077
1077
|
if (args.kind === "parse-error") {
|
|
@@ -1087,8 +1087,8 @@ async function runScanCliBase(input, config) {
|
|
|
1087
1087
|
result = { exitCode: 2 };
|
|
1088
1088
|
} else {
|
|
1089
1089
|
const projectRoot = resolve2(cwd, args.project);
|
|
1090
|
-
const outcome = await config.buildManifest({ projectRoot, generator, readFile:
|
|
1091
|
-
result = await handleOutcome({ outcome, args, projectArg: args.project, readFile:
|
|
1090
|
+
const outcome = await config.buildManifest({ projectRoot, generator, readFile: readFile23, globber, now });
|
|
1091
|
+
result = await handleOutcome({ outcome, args, projectArg: args.project, readFile: readFile23, writeFile: writeFile2, log, errorLog, config });
|
|
1092
1092
|
}
|
|
1093
1093
|
return result;
|
|
1094
1094
|
}
|
|
@@ -1142,7 +1142,7 @@ function parseScanArgs(argv) {
|
|
|
1142
1142
|
return result;
|
|
1143
1143
|
}
|
|
1144
1144
|
async function handleOutcome(input) {
|
|
1145
|
-
const { outcome, args, projectArg, readFile:
|
|
1145
|
+
const { outcome, args, projectArg, readFile: readFile23, writeFile: writeFile2, log, errorLog, config } = input;
|
|
1146
1146
|
let result;
|
|
1147
1147
|
if (outcome.kind === "success") {
|
|
1148
1148
|
const finalOutPath = args.out === void 0 ? outcome.outPath : resolve2(outcome.outPath, "..", args.out);
|
|
@@ -1150,7 +1150,7 @@ async function handleOutcome(input) {
|
|
|
1150
1150
|
if (args.check) {
|
|
1151
1151
|
let existing = null;
|
|
1152
1152
|
try {
|
|
1153
|
-
existing = await
|
|
1153
|
+
existing = await readFile23(finalOutPath);
|
|
1154
1154
|
} catch {
|
|
1155
1155
|
existing = null;
|
|
1156
1156
|
}
|
|
@@ -1628,12 +1628,12 @@ var SCAN_CONFIG_FILENAME = "dbx-mcp.scan.json";
|
|
|
1628
1628
|
var DEFAULT_READ_FILE3 = defaultReadFile;
|
|
1629
1629
|
var DEFAULT_GLOBBER2 = defaultGlobber;
|
|
1630
1630
|
async function buildManifest(input) {
|
|
1631
|
-
const { projectRoot, generator, readFile:
|
|
1631
|
+
const { projectRoot, generator, readFile: readFile23 = DEFAULT_READ_FILE3, globber = DEFAULT_GLOBBER2, now = () => /* @__PURE__ */ new Date() } = input;
|
|
1632
1632
|
const configPath = resolve3(projectRoot, SCAN_CONFIG_FILENAME);
|
|
1633
1633
|
const packagePath = resolve3(projectRoot, "package.json");
|
|
1634
1634
|
const configOutcome = await loadScanSection({
|
|
1635
1635
|
configPath,
|
|
1636
|
-
readFile:
|
|
1636
|
+
readFile: readFile23,
|
|
1637
1637
|
parseSection: (parsed) => {
|
|
1638
1638
|
const validated2 = SemanticTypeScanConfig(parsed);
|
|
1639
1639
|
if (validated2 instanceof type8.errors) {
|
|
@@ -1646,7 +1646,7 @@ async function buildManifest(input) {
|
|
|
1646
1646
|
return configOutcome.outcome;
|
|
1647
1647
|
}
|
|
1648
1648
|
const scanConfig = configOutcome.section;
|
|
1649
|
-
const packageOutcome = await loadPackageName(packagePath,
|
|
1649
|
+
const packageOutcome = await loadPackageName(packagePath, readFile23);
|
|
1650
1650
|
if (packageOutcome.kind !== "ok") {
|
|
1651
1651
|
return packageOutcome.outcome;
|
|
1652
1652
|
}
|
|
@@ -1656,7 +1656,7 @@ async function buildManifest(input) {
|
|
|
1656
1656
|
include: scanConfig.include,
|
|
1657
1657
|
exclude: scanConfig.exclude ?? []
|
|
1658
1658
|
});
|
|
1659
|
-
const project = await buildScanProject({ projectRoot, filePaths, readFile:
|
|
1659
|
+
const project = await buildScanProject({ projectRoot, filePaths, readFile: readFile23 });
|
|
1660
1660
|
const extracted = extractEntries({ project });
|
|
1661
1661
|
const entries = extracted.map((entry) => assembleEntry2({ entry, packageName, projectRoot }));
|
|
1662
1662
|
const manifest = {
|
|
@@ -1726,7 +1726,7 @@ var USAGE2 = [
|
|
|
1726
1726
|
var DEFAULT_READ_FILE4 = (path) => nodeReadFile3(path, "utf-8");
|
|
1727
1727
|
var DEFAULT_WRITE_FILE2 = (path, data) => nodeWriteFile2(path, data, "utf-8");
|
|
1728
1728
|
async function runScanCli(input) {
|
|
1729
|
-
const { argv, cwd, generator, readFile:
|
|
1729
|
+
const { argv, cwd, generator, readFile: readFile23 = DEFAULT_READ_FILE4, writeFile: writeFile2 = DEFAULT_WRITE_FILE2, globber, now, log = console.log, errorLog = console.error } = input;
|
|
1730
1730
|
let result;
|
|
1731
1731
|
const args = parseArgs(argv);
|
|
1732
1732
|
if (args.kind === "parse-error") {
|
|
@@ -1742,8 +1742,8 @@ async function runScanCli(input) {
|
|
|
1742
1742
|
result = { exitCode: 2 };
|
|
1743
1743
|
} else {
|
|
1744
1744
|
const projectRoot = resolve4(cwd, args.project);
|
|
1745
|
-
const outcome = await buildManifest({ projectRoot, generator, readFile:
|
|
1746
|
-
result = await handleOutcome2({ outcome, args, projectArg: args.project, readFile:
|
|
1745
|
+
const outcome = await buildManifest({ projectRoot, generator, readFile: readFile23, globber, now });
|
|
1746
|
+
result = await handleOutcome2({ outcome, args, projectArg: args.project, readFile: readFile23, writeFile: writeFile2, log, errorLog });
|
|
1747
1747
|
}
|
|
1748
1748
|
return result;
|
|
1749
1749
|
}
|
|
@@ -1797,12 +1797,12 @@ function parseArgs(argv) {
|
|
|
1797
1797
|
return result;
|
|
1798
1798
|
}
|
|
1799
1799
|
async function handleSuccessOutcome(input) {
|
|
1800
|
-
const { outcome, args, projectArg, readFile:
|
|
1800
|
+
const { outcome, args, projectArg, readFile: readFile23, writeFile: writeFile2, log, errorLog } = input;
|
|
1801
1801
|
const finalOutPath = args.out === void 0 ? outcome.outPath : resolve4(outcome.outPath, "..", args.out);
|
|
1802
1802
|
const serialized = serializeManifest(outcome.manifest);
|
|
1803
1803
|
let result;
|
|
1804
1804
|
if (args.check) {
|
|
1805
|
-
result = await checkManifest({ finalOutPath, serialized, outcome, projectArg, readFile:
|
|
1805
|
+
result = await checkManifest({ finalOutPath, serialized, outcome, projectArg, readFile: readFile23, log, errorLog });
|
|
1806
1806
|
} else {
|
|
1807
1807
|
await writeFile2(finalOutPath, serialized);
|
|
1808
1808
|
log(`Wrote manifest: ${finalOutPath} (${outcome.manifest.entries.length} entries, ${outcome.scannedFileCount} files scanned)`);
|
|
@@ -1811,10 +1811,10 @@ async function handleSuccessOutcome(input) {
|
|
|
1811
1811
|
return result;
|
|
1812
1812
|
}
|
|
1813
1813
|
async function checkManifest(input) {
|
|
1814
|
-
const { finalOutPath, serialized, outcome, projectArg, readFile:
|
|
1814
|
+
const { finalOutPath, serialized, outcome, projectArg, readFile: readFile23, log, errorLog } = input;
|
|
1815
1815
|
let existing;
|
|
1816
1816
|
try {
|
|
1817
|
-
existing = await
|
|
1817
|
+
existing = await readFile23(finalOutPath);
|
|
1818
1818
|
} catch {
|
|
1819
1819
|
existing = null;
|
|
1820
1820
|
}
|
|
@@ -2504,12 +2504,12 @@ var UI_COMPONENTS_SCAN_CONFIG_FILENAME = "dbx-mcp.scan.json";
|
|
|
2504
2504
|
var DEFAULT_READ_FILE5 = defaultReadFile;
|
|
2505
2505
|
var DEFAULT_GLOBBER3 = defaultGlobber;
|
|
2506
2506
|
async function buildUiComponentsManifest(input) {
|
|
2507
|
-
const { projectRoot, generator, readFile:
|
|
2507
|
+
const { projectRoot, generator, readFile: readFile23 = DEFAULT_READ_FILE5, globber = DEFAULT_GLOBBER3, now = () => /* @__PURE__ */ new Date() } = input;
|
|
2508
2508
|
const configPath = resolve5(projectRoot, UI_COMPONENTS_SCAN_CONFIG_FILENAME);
|
|
2509
2509
|
const packagePath = resolve5(projectRoot, "package.json");
|
|
2510
2510
|
const configOutcome = await loadScanSection({
|
|
2511
2511
|
configPath,
|
|
2512
|
-
readFile:
|
|
2512
|
+
readFile: readFile23,
|
|
2513
2513
|
parseSection: (parsed) => {
|
|
2514
2514
|
const validated2 = UiComponentsScanConfig(parsed);
|
|
2515
2515
|
if (validated2 instanceof type12.errors) {
|
|
@@ -2522,7 +2522,7 @@ async function buildUiComponentsManifest(input) {
|
|
|
2522
2522
|
return configOutcome.outcome;
|
|
2523
2523
|
}
|
|
2524
2524
|
const scanSection = configOutcome.section;
|
|
2525
|
-
const packageOutcome = await loadPackageName(packagePath,
|
|
2525
|
+
const packageOutcome = await loadPackageName(packagePath, readFile23);
|
|
2526
2526
|
if (packageOutcome.kind !== "ok") {
|
|
2527
2527
|
return packageOutcome.outcome;
|
|
2528
2528
|
}
|
|
@@ -2532,7 +2532,7 @@ async function buildUiComponentsManifest(input) {
|
|
|
2532
2532
|
include: scanSection.include,
|
|
2533
2533
|
exclude: scanSection.exclude ?? []
|
|
2534
2534
|
});
|
|
2535
|
-
const project = await buildScanProject({ projectRoot, filePaths, readFile:
|
|
2535
|
+
const project = await buildScanProject({ projectRoot, filePaths, readFile: readFile23 });
|
|
2536
2536
|
const extractResult = extractUiEntries({ project });
|
|
2537
2537
|
const moduleName = scanSection.module ?? packageName;
|
|
2538
2538
|
const sourceLabel = scanSection.source ?? packageName;
|
|
@@ -3053,12 +3053,12 @@ var CSS_UTILITIES_SCAN_CONFIG_FILENAME = "dbx-mcp.scan.json";
|
|
|
3053
3053
|
var DEFAULT_READ_FILE6 = defaultReadFile;
|
|
3054
3054
|
var DEFAULT_GLOBBER4 = defaultGlobber;
|
|
3055
3055
|
async function buildCssUtilitiesManifest(input) {
|
|
3056
|
-
const { projectRoot, generator, readFile:
|
|
3056
|
+
const { projectRoot, generator, readFile: readFile23 = DEFAULT_READ_FILE6, globber = DEFAULT_GLOBBER4, now = () => /* @__PURE__ */ new Date() } = input;
|
|
3057
3057
|
const configPath = resolve6(projectRoot, CSS_UTILITIES_SCAN_CONFIG_FILENAME);
|
|
3058
3058
|
const packagePath = resolve6(projectRoot, "package.json");
|
|
3059
3059
|
const configOutcome = await loadScanSection({
|
|
3060
3060
|
configPath,
|
|
3061
|
-
readFile:
|
|
3061
|
+
readFile: readFile23,
|
|
3062
3062
|
parseSection: (parsed) => {
|
|
3063
3063
|
const validated2 = CssUtilitiesScanConfig(parsed);
|
|
3064
3064
|
if (validated2 instanceof type15.errors) {
|
|
@@ -3071,7 +3071,7 @@ async function buildCssUtilitiesManifest(input) {
|
|
|
3071
3071
|
return configOutcome.outcome;
|
|
3072
3072
|
}
|
|
3073
3073
|
const scanSection = configOutcome.section;
|
|
3074
|
-
const packageOutcome = await loadPackageName(packagePath,
|
|
3074
|
+
const packageOutcome = await loadPackageName(packagePath, readFile23);
|
|
3075
3075
|
if (packageOutcome.kind !== "ok") {
|
|
3076
3076
|
return packageOutcome.outcome;
|
|
3077
3077
|
}
|
|
@@ -3088,7 +3088,7 @@ async function buildCssUtilitiesManifest(input) {
|
|
|
3088
3088
|
const allWarnings = [];
|
|
3089
3089
|
for (const relPath of sortedFiles) {
|
|
3090
3090
|
const absolute = resolve6(projectRoot, relPath);
|
|
3091
|
-
const text = await
|
|
3091
|
+
const text = await readFile23(absolute);
|
|
3092
3092
|
const result = extractCssUtilityEntries({ file: relPath, source: text });
|
|
3093
3093
|
for (const entry of result.entries) {
|
|
3094
3094
|
extractedEntries.push({ entry });
|
|
@@ -3277,11 +3277,11 @@ var DbxMcpConfig = type16({
|
|
|
3277
3277
|
var CONFIG_FILENAME = "dbx-mcp.config.json";
|
|
3278
3278
|
var DEFAULT_READ_FILE7 = (path) => nodeReadFile4(path, "utf-8");
|
|
3279
3279
|
async function findAndLoadConfig(input) {
|
|
3280
|
-
const { cwd, readFile:
|
|
3280
|
+
const { cwd, readFile: readFile23 = DEFAULT_READ_FILE7 } = input;
|
|
3281
3281
|
const configPath = resolve7(cwd, CONFIG_FILENAME);
|
|
3282
3282
|
let raw = null;
|
|
3283
3283
|
try {
|
|
3284
|
-
raw = await
|
|
3284
|
+
raw = await readFile23(configPath);
|
|
3285
3285
|
} catch {
|
|
3286
3286
|
raw = null;
|
|
3287
3287
|
}
|
|
@@ -3544,10 +3544,10 @@ import { readFile as nodeReadFile5 } from "node:fs/promises";
|
|
|
3544
3544
|
import { type as type19 } from "arktype";
|
|
3545
3545
|
var DEFAULT_READ_FILE8 = (path) => nodeReadFile5(path, "utf-8");
|
|
3546
3546
|
var SUPPORTED_VERSION = 1;
|
|
3547
|
-
async function loadFromSource(source,
|
|
3547
|
+
async function loadFromSource(source, readFile23, schema) {
|
|
3548
3548
|
let raw = null;
|
|
3549
3549
|
try {
|
|
3550
|
-
raw = await
|
|
3550
|
+
raw = await readFile23(source.path);
|
|
3551
3551
|
} catch {
|
|
3552
3552
|
raw = null;
|
|
3553
3553
|
}
|
|
@@ -3604,12 +3604,12 @@ function warningSortKey(warning) {
|
|
|
3604
3604
|
return key;
|
|
3605
3605
|
}
|
|
3606
3606
|
async function loadManifestsBase(input, config) {
|
|
3607
|
-
const { sources, readFile:
|
|
3607
|
+
const { sources, readFile: readFile23 = DEFAULT_READ_FILE8 } = input;
|
|
3608
3608
|
const { name, schema, extractIndexValue, buildEntryKey } = config;
|
|
3609
3609
|
const successes = [];
|
|
3610
3610
|
const warnings = [];
|
|
3611
3611
|
for (const source of sources) {
|
|
3612
|
-
const outcome = await loadFromSource(source,
|
|
3612
|
+
const outcome = await loadFromSource(source, readFile23, schema);
|
|
3613
3613
|
if (outcome.kind === "success") {
|
|
3614
3614
|
successes.push({ source, manifest: outcome.manifest });
|
|
3615
3615
|
} else if (isStrictSource(source)) {
|
|
@@ -3713,9 +3713,9 @@ var DEFAULT_BUNDLED_PATHS = () => {
|
|
|
3713
3713
|
return DEFAULT_BUNDLED_FILENAMES.map((name) => resolve8(packageRoot, "generated", name));
|
|
3714
3714
|
};
|
|
3715
3715
|
async function loadActionRegistry(input) {
|
|
3716
|
-
const { cwd, bundledManifestPaths = DEFAULT_BUNDLED_PATHS, readFile:
|
|
3716
|
+
const { cwd, bundledManifestPaths = DEFAULT_BUNDLED_PATHS, readFile: readFile23 } = input;
|
|
3717
3717
|
const bundledSources = bundledManifestPaths().map((path) => ({ origin: "bundled", path }));
|
|
3718
|
-
const configResult = await findAndLoadConfig({ cwd, readFile:
|
|
3718
|
+
const configResult = await findAndLoadConfig({ cwd, readFile: readFile23 });
|
|
3719
3719
|
const externalSources = [];
|
|
3720
3720
|
if (configResult.config !== null && configResult.configPath !== null) {
|
|
3721
3721
|
const baseDir = dirname(configResult.configPath);
|
|
@@ -3729,7 +3729,7 @@ async function loadActionRegistry(input) {
|
|
|
3729
3729
|
let loaderWarnings = [];
|
|
3730
3730
|
const sources = [...bundledSources, ...externalSources];
|
|
3731
3731
|
if (sources.length > 0) {
|
|
3732
|
-
const loaded = await loadActionManifests({ sources, readFile:
|
|
3732
|
+
const loaded = await loadActionManifests({ sources, readFile: readFile23 });
|
|
3733
3733
|
registry = createActionRegistry(loaded);
|
|
3734
3734
|
loaderWarnings = loaded.warnings;
|
|
3735
3735
|
}
|
|
@@ -3925,9 +3925,9 @@ var DEFAULT_BUNDLED_PATHS2 = () => {
|
|
|
3925
3925
|
return DEFAULT_BUNDLED_FILENAMES2.map((name) => resolve9(packageRoot, "generated", name));
|
|
3926
3926
|
};
|
|
3927
3927
|
async function loadFilterRegistry(input) {
|
|
3928
|
-
const { cwd, bundledManifestPaths = DEFAULT_BUNDLED_PATHS2, readFile:
|
|
3928
|
+
const { cwd, bundledManifestPaths = DEFAULT_BUNDLED_PATHS2, readFile: readFile23 } = input;
|
|
3929
3929
|
const bundledSources = bundledManifestPaths().map((path) => ({ origin: "bundled", path }));
|
|
3930
|
-
const configResult = await findAndLoadConfig({ cwd, readFile:
|
|
3930
|
+
const configResult = await findAndLoadConfig({ cwd, readFile: readFile23 });
|
|
3931
3931
|
const externalSources = [];
|
|
3932
3932
|
if (configResult.config !== null && configResult.configPath !== null) {
|
|
3933
3933
|
const baseDir = dirname2(configResult.configPath);
|
|
@@ -3941,7 +3941,7 @@ async function loadFilterRegistry(input) {
|
|
|
3941
3941
|
let loaderWarnings = [];
|
|
3942
3942
|
const sources = [...bundledSources, ...externalSources];
|
|
3943
3943
|
if (sources.length > 0) {
|
|
3944
|
-
const loaded = await loadFilterManifests({ sources, readFile:
|
|
3944
|
+
const loaded = await loadFilterManifests({ sources, readFile: readFile23 });
|
|
3945
3945
|
registry = createFilterRegistry(loaded);
|
|
3946
3946
|
loaderWarnings = loaded.warnings;
|
|
3947
3947
|
}
|
|
@@ -4169,9 +4169,9 @@ var DEFAULT_BUNDLED_PATHS3 = () => {
|
|
|
4169
4169
|
return DEFAULT_BUNDLED_FILENAMES3.map((name) => resolve10(packageRoot, "generated", name));
|
|
4170
4170
|
};
|
|
4171
4171
|
async function loadForgeFieldRegistry(input) {
|
|
4172
|
-
const { cwd, bundledManifestPaths = DEFAULT_BUNDLED_PATHS3, readFile:
|
|
4172
|
+
const { cwd, bundledManifestPaths = DEFAULT_BUNDLED_PATHS3, readFile: readFile23 } = input;
|
|
4173
4173
|
const bundledSources = bundledManifestPaths().map((path) => ({ origin: "bundled", path }));
|
|
4174
|
-
const configResult = await findAndLoadConfig({ cwd, readFile:
|
|
4174
|
+
const configResult = await findAndLoadConfig({ cwd, readFile: readFile23 });
|
|
4175
4175
|
const externalSources = [];
|
|
4176
4176
|
if (configResult.config !== null && configResult.configPath !== null) {
|
|
4177
4177
|
const baseDir = dirname3(configResult.configPath);
|
|
@@ -4185,7 +4185,7 @@ async function loadForgeFieldRegistry(input) {
|
|
|
4185
4185
|
let loaderWarnings = [];
|
|
4186
4186
|
const sources = [...bundledSources, ...externalSources];
|
|
4187
4187
|
if (sources.length > 0) {
|
|
4188
|
-
const loaded = await loadForgeFieldManifests({ sources, readFile:
|
|
4188
|
+
const loaded = await loadForgeFieldManifests({ sources, readFile: readFile23 });
|
|
4189
4189
|
registry = createForgeFieldRegistry(loaded);
|
|
4190
4190
|
loaderWarnings = loaded.warnings;
|
|
4191
4191
|
}
|
|
@@ -4350,9 +4350,9 @@ var DEFAULT_BUNDLED_PATHS4 = () => {
|
|
|
4350
4350
|
return DEFAULT_BUNDLED_FILENAMES4.map((name) => resolve11(packageRoot, "generated", name));
|
|
4351
4351
|
};
|
|
4352
4352
|
async function loadPipeRegistry(input) {
|
|
4353
|
-
const { cwd, bundledManifestPaths = DEFAULT_BUNDLED_PATHS4, readFile:
|
|
4353
|
+
const { cwd, bundledManifestPaths = DEFAULT_BUNDLED_PATHS4, readFile: readFile23 } = input;
|
|
4354
4354
|
const bundledSources = bundledManifestPaths().map((path) => ({ origin: "bundled", path }));
|
|
4355
|
-
const configResult = await findAndLoadConfig({ cwd, readFile:
|
|
4355
|
+
const configResult = await findAndLoadConfig({ cwd, readFile: readFile23 });
|
|
4356
4356
|
const externalSources = [];
|
|
4357
4357
|
if (configResult.config !== null && configResult.configPath !== null) {
|
|
4358
4358
|
const baseDir = dirname4(configResult.configPath);
|
|
@@ -4366,7 +4366,7 @@ async function loadPipeRegistry(input) {
|
|
|
4366
4366
|
let loaderWarnings = [];
|
|
4367
4367
|
const sources = [...bundledSources, ...externalSources];
|
|
4368
4368
|
if (sources.length > 0) {
|
|
4369
|
-
const loaded = await loadPipeManifests({ sources, readFile:
|
|
4369
|
+
const loaded = await loadPipeManifests({ sources, readFile: readFile23 });
|
|
4370
4370
|
registry = createPipeRegistry(loaded);
|
|
4371
4371
|
loaderWarnings = loaded.warnings;
|
|
4372
4372
|
}
|
|
@@ -4550,9 +4550,9 @@ var DEFAULT_BUNDLED_PATHS5 = () => {
|
|
|
4550
4550
|
return DEFAULT_BUNDLED_FILENAMES5.map((name) => resolve12(packageRoot, "generated", name));
|
|
4551
4551
|
};
|
|
4552
4552
|
async function loadUtilRegistry(input) {
|
|
4553
|
-
const { cwd, bundledManifestPaths = DEFAULT_BUNDLED_PATHS5, readFile:
|
|
4553
|
+
const { cwd, bundledManifestPaths = DEFAULT_BUNDLED_PATHS5, readFile: readFile23 } = input;
|
|
4554
4554
|
const bundledSources = bundledManifestPaths().map((path) => ({ origin: "bundled", path, strict: false }));
|
|
4555
|
-
const configResult = await findAndLoadConfig({ cwd, readFile:
|
|
4555
|
+
const configResult = await findAndLoadConfig({ cwd, readFile: readFile23 });
|
|
4556
4556
|
const externalSources = [];
|
|
4557
4557
|
if (configResult.config !== null && configResult.configPath !== null) {
|
|
4558
4558
|
const baseDir = dirname5(configResult.configPath);
|
|
@@ -4567,7 +4567,7 @@ async function loadUtilRegistry(input) {
|
|
|
4567
4567
|
const sources = [...bundledSources, ...externalSources];
|
|
4568
4568
|
if (sources.length > 0) {
|
|
4569
4569
|
try {
|
|
4570
|
-
const loaded = await loadUtilManifests({ sources, readFile:
|
|
4570
|
+
const loaded = await loadUtilManifests({ sources, readFile: readFile23 });
|
|
4571
4571
|
registry = createUtilRegistry(loaded);
|
|
4572
4572
|
loaderWarnings = loaded.warnings;
|
|
4573
4573
|
} catch {
|
|
@@ -4756,9 +4756,9 @@ var DEFAULT_BUNDLED_PATHS6 = () => {
|
|
|
4756
4756
|
return DEFAULT_BUNDLED_FILENAMES6.map((name) => resolve13(packageRoot, "generated", name));
|
|
4757
4757
|
};
|
|
4758
4758
|
async function loadModelSnapshotFieldRegistry(input) {
|
|
4759
|
-
const { cwd, bundledManifestPaths = DEFAULT_BUNDLED_PATHS6, readFile:
|
|
4759
|
+
const { cwd, bundledManifestPaths = DEFAULT_BUNDLED_PATHS6, readFile: readFile23 } = input;
|
|
4760
4760
|
const bundledSources = bundledManifestPaths().map((path) => ({ origin: "bundled", path, strict: false }));
|
|
4761
|
-
const configResult = await findAndLoadConfig({ cwd, readFile:
|
|
4761
|
+
const configResult = await findAndLoadConfig({ cwd, readFile: readFile23 });
|
|
4762
4762
|
const externalSources = [];
|
|
4763
4763
|
if (configResult.config !== null && configResult.configPath !== null) {
|
|
4764
4764
|
const baseDir = dirname6(configResult.configPath);
|
|
@@ -4773,7 +4773,7 @@ async function loadModelSnapshotFieldRegistry(input) {
|
|
|
4773
4773
|
const sources = [...bundledSources, ...externalSources];
|
|
4774
4774
|
if (sources.length > 0) {
|
|
4775
4775
|
try {
|
|
4776
|
-
const loaded = await loadModelSnapshotFieldManifests({ sources, readFile:
|
|
4776
|
+
const loaded = await loadModelSnapshotFieldManifests({ sources, readFile: readFile23 });
|
|
4777
4777
|
registry = createModelSnapshotFieldRegistry(loaded);
|
|
4778
4778
|
loaderWarnings = loaded.warnings;
|
|
4779
4779
|
} catch {
|
|
@@ -4882,10 +4882,10 @@ function isCoreTopic(topic) {
|
|
|
4882
4882
|
// packages/dbx-components-mcp/src/manifest/loader.ts
|
|
4883
4883
|
var DEFAULT_READ_FILE9 = (path) => nodeReadFile6(path, "utf-8");
|
|
4884
4884
|
var SUPPORTED_VERSION2 = 1;
|
|
4885
|
-
async function loadFromSource2(source,
|
|
4885
|
+
async function loadFromSource2(source, readFile23) {
|
|
4886
4886
|
let raw = null;
|
|
4887
4887
|
try {
|
|
4888
|
-
raw = await
|
|
4888
|
+
raw = await readFile23(source.path);
|
|
4889
4889
|
} catch {
|
|
4890
4890
|
}
|
|
4891
4891
|
let result;
|
|
@@ -4972,11 +4972,11 @@ function warningSortKey2(warning) {
|
|
|
4972
4972
|
return key;
|
|
4973
4973
|
}
|
|
4974
4974
|
async function loadSemanticTypeManifests(input) {
|
|
4975
|
-
const { sources, readFile:
|
|
4975
|
+
const { sources, readFile: readFile23 = DEFAULT_READ_FILE9 } = input;
|
|
4976
4976
|
const successes = [];
|
|
4977
4977
|
const warnings = [];
|
|
4978
4978
|
for (const source of sources) {
|
|
4979
|
-
const outcome = await loadFromSource2(source,
|
|
4979
|
+
const outcome = await loadFromSource2(source, readFile23);
|
|
4980
4980
|
if (outcome.kind === "success") {
|
|
4981
4981
|
successes.push({ source, manifest: outcome.manifest });
|
|
4982
4982
|
} else if (isStrictSource2(source)) {
|
|
@@ -5073,9 +5073,9 @@ var DEFAULT_BUNDLED_PATHS7 = () => {
|
|
|
5073
5073
|
return DEFAULT_BUNDLED_FILENAMES7.map((name) => resolve14(packageRoot, "generated", name));
|
|
5074
5074
|
};
|
|
5075
5075
|
async function loadSemanticTypeRegistry(input) {
|
|
5076
|
-
const { cwd, bundledManifestPaths = DEFAULT_BUNDLED_PATHS7, readFile:
|
|
5076
|
+
const { cwd, bundledManifestPaths = DEFAULT_BUNDLED_PATHS7, readFile: readFile23 } = input;
|
|
5077
5077
|
const bundledSources = bundledManifestPaths().map((path) => ({ origin: "bundled", path }));
|
|
5078
|
-
const configResult = await findAndLoadConfig({ cwd, readFile:
|
|
5078
|
+
const configResult = await findAndLoadConfig({ cwd, readFile: readFile23 });
|
|
5079
5079
|
const externalSources = [];
|
|
5080
5080
|
if (configResult.config !== null && configResult.configPath !== null) {
|
|
5081
5081
|
const baseDir = dirname7(configResult.configPath);
|
|
@@ -5089,7 +5089,7 @@ async function loadSemanticTypeRegistry(input) {
|
|
|
5089
5089
|
let loaderWarnings = [];
|
|
5090
5090
|
const sources = [...bundledSources, ...externalSources];
|
|
5091
5091
|
if (sources.length > 0) {
|
|
5092
|
-
const loaded = await loadSemanticTypeManifests({ sources, readFile:
|
|
5092
|
+
const loaded = await loadSemanticTypeManifests({ sources, readFile: readFile23 });
|
|
5093
5093
|
registry = createSemanticTypeRegistry(loaded);
|
|
5094
5094
|
loaderWarnings = loaded.warnings;
|
|
5095
5095
|
}
|
|
@@ -5305,15 +5305,15 @@ var DEFAULT_BUNDLED_PATHS8 = () => {
|
|
|
5305
5305
|
return DEFAULT_BUNDLED_FILENAMES8.map((name) => resolve15(packageRoot, "generated", name));
|
|
5306
5306
|
};
|
|
5307
5307
|
async function loadTokenRegistry(input) {
|
|
5308
|
-
const { cwd, bundledManifestPaths = DEFAULT_BUNDLED_PATHS8, readFile:
|
|
5308
|
+
const { cwd, bundledManifestPaths = DEFAULT_BUNDLED_PATHS8, readFile: readFile23 } = input;
|
|
5309
5309
|
const bundledSources = bundledManifestPaths().map((path) => ({ origin: "bundled", path }));
|
|
5310
|
-
const configResult = await findAndLoadConfig({ cwd, readFile:
|
|
5310
|
+
const configResult = await findAndLoadConfig({ cwd, readFile: readFile23 });
|
|
5311
5311
|
const externalSources = collectExternalTokenSources(configResult);
|
|
5312
5312
|
let registry = EMPTY_TOKEN_REGISTRY;
|
|
5313
5313
|
let loaderWarnings = [];
|
|
5314
5314
|
const sources = [...bundledSources, ...externalSources];
|
|
5315
5315
|
if (sources.length > 0) {
|
|
5316
|
-
const loaded = await loadTokenManifests({ sources, readFile:
|
|
5316
|
+
const loaded = await loadTokenManifests({ sources, readFile: readFile23 });
|
|
5317
5317
|
registry = createTokenRegistry(loaded);
|
|
5318
5318
|
loaderWarnings = loaded.warnings;
|
|
5319
5319
|
}
|
|
@@ -5613,15 +5613,15 @@ var DEFAULT_BUNDLED_PATHS9 = () => {
|
|
|
5613
5613
|
return DEFAULT_BUNDLED_FILENAMES9.map((name) => resolve16(packageRoot, "generated", name));
|
|
5614
5614
|
};
|
|
5615
5615
|
async function loadCssUtilityRegistry(input) {
|
|
5616
|
-
const { cwd, bundledManifestPaths = DEFAULT_BUNDLED_PATHS9, readFile:
|
|
5616
|
+
const { cwd, bundledManifestPaths = DEFAULT_BUNDLED_PATHS9, readFile: readFile23 } = input;
|
|
5617
5617
|
const bundledSources = bundledManifestPaths().map((path) => ({ origin: "bundled", path }));
|
|
5618
|
-
const configResult = await findAndLoadConfig({ cwd, readFile:
|
|
5618
|
+
const configResult = await findAndLoadConfig({ cwd, readFile: readFile23 });
|
|
5619
5619
|
const externalSources = collectExternalCssUtilitySources(configResult);
|
|
5620
5620
|
let registry = EMPTY_CSS_UTILITY_REGISTRY;
|
|
5621
5621
|
let loaderWarnings = [];
|
|
5622
5622
|
const sources = [...bundledSources, ...externalSources];
|
|
5623
5623
|
if (sources.length > 0) {
|
|
5624
|
-
const loaded = await loadCssUtilityManifests({ sources, readFile:
|
|
5624
|
+
const loaded = await loadCssUtilityManifests({ sources, readFile: readFile23 });
|
|
5625
5625
|
registry = createCssUtilityRegistry(loaded);
|
|
5626
5626
|
loaderWarnings = loaded.warnings;
|
|
5627
5627
|
}
|
|
@@ -5786,9 +5786,9 @@ var DEFAULT_BUNDLED_PATHS10 = () => {
|
|
|
5786
5786
|
return DEFAULT_BUNDLED_FILENAMES10.map((name) => resolve17(packageRoot, "generated", name));
|
|
5787
5787
|
};
|
|
5788
5788
|
async function loadUiComponentRegistry(input) {
|
|
5789
|
-
const { cwd, bundledManifestPaths = DEFAULT_BUNDLED_PATHS10, readFile:
|
|
5789
|
+
const { cwd, bundledManifestPaths = DEFAULT_BUNDLED_PATHS10, readFile: readFile23 } = input;
|
|
5790
5790
|
const bundledSources = bundledManifestPaths().map((path) => ({ origin: "bundled", path }));
|
|
5791
|
-
const configResult = await findAndLoadConfig({ cwd, readFile:
|
|
5791
|
+
const configResult = await findAndLoadConfig({ cwd, readFile: readFile23 });
|
|
5792
5792
|
const externalSources = [];
|
|
5793
5793
|
if (configResult.config !== null && configResult.configPath !== null) {
|
|
5794
5794
|
const baseDir = dirname10(configResult.configPath);
|
|
@@ -5802,7 +5802,7 @@ async function loadUiComponentRegistry(input) {
|
|
|
5802
5802
|
let loaderWarnings = [];
|
|
5803
5803
|
const sources = [...bundledSources, ...externalSources];
|
|
5804
5804
|
if (sources.length > 0) {
|
|
5805
|
-
const loaded = await loadUiComponentManifests({ sources, readFile:
|
|
5805
|
+
const loaded = await loadUiComponentManifests({ sources, readFile: readFile23 });
|
|
5806
5806
|
registry = createUiComponentRegistry(loaded);
|
|
5807
5807
|
loaderWarnings = loaded.warnings;
|
|
5808
5808
|
}
|
|
@@ -5944,9 +5944,9 @@ var DEFAULT_BUNDLED_PATHS11 = () => {
|
|
|
5944
5944
|
return DEFAULT_BUNDLED_FILENAMES11.map((name) => resolve18(packageRoot, "generated", name));
|
|
5945
5945
|
};
|
|
5946
5946
|
async function loadDbxDocsUiExamplesRegistry(input) {
|
|
5947
|
-
const { cwd, bundledManifestPaths = DEFAULT_BUNDLED_PATHS11, readFile:
|
|
5947
|
+
const { cwd, bundledManifestPaths = DEFAULT_BUNDLED_PATHS11, readFile: readFile23 } = input;
|
|
5948
5948
|
const bundledSources = bundledManifestPaths().map((path) => ({ origin: "bundled", path }));
|
|
5949
|
-
const configResult = await findAndLoadConfig({ cwd, readFile:
|
|
5949
|
+
const configResult = await findAndLoadConfig({ cwd, readFile: readFile23 });
|
|
5950
5950
|
const externalSources = [];
|
|
5951
5951
|
if (configResult.config !== null && configResult.configPath !== null) {
|
|
5952
5952
|
const baseDir = dirname11(configResult.configPath);
|
|
@@ -5961,7 +5961,7 @@ async function loadDbxDocsUiExamplesRegistry(input) {
|
|
|
5961
5961
|
const sources = [...bundledSources, ...externalSources];
|
|
5962
5962
|
if (sources.length > 0) {
|
|
5963
5963
|
try {
|
|
5964
|
-
const loaded = await loadDbxDocsUiExamplesManifests({ sources, readFile:
|
|
5964
|
+
const loaded = await loadDbxDocsUiExamplesManifests({ sources, readFile: readFile23 });
|
|
5965
5965
|
registry = createDbxDocsUiExamplesRegistry(loaded);
|
|
5966
5966
|
loaderWarnings = loaded.warnings;
|
|
5967
5967
|
} catch {
|
|
@@ -6248,6 +6248,14 @@ var FIREBASE_MODELS = [
|
|
|
6248
6248
|
optional: true,
|
|
6249
6249
|
description: "Grant identifier for revocation support. Extracted from the payload for indexed queries."
|
|
6250
6250
|
},
|
|
6251
|
+
{
|
|
6252
|
+
name: "clientId",
|
|
6253
|
+
longName: "clientId",
|
|
6254
|
+
converter: "optionalFirestoreString()",
|
|
6255
|
+
tsType: "Maybe<string>",
|
|
6256
|
+
optional: true,
|
|
6257
|
+
description: "OAuth client identifier. Extracted from the payload for indexed queries (e.g. listing or revoking every grant/token issued to a particular client)."
|
|
6258
|
+
},
|
|
6251
6259
|
{
|
|
6252
6260
|
name: "userCode",
|
|
6253
6261
|
longName: "userCode",
|
|
@@ -6264,6 +6272,14 @@ var FIREBASE_MODELS = [
|
|
|
6264
6272
|
optional: true,
|
|
6265
6273
|
description: "Epoch timestamp when this entry was consumed. Extracted from the payload for indexed queries."
|
|
6266
6274
|
},
|
|
6275
|
+
{
|
|
6276
|
+
name: "createdAt",
|
|
6277
|
+
longName: "createdAt",
|
|
6278
|
+
converter: "optionalFirestoreDate()",
|
|
6279
|
+
tsType: "Maybe<Date>",
|
|
6280
|
+
optional: true,
|
|
6281
|
+
description: "When this entry was created. Derived from `payload.iat` on grantable tokens (AccessToken, RefreshToken, AuthorizationCode, Grant, etc.) and from `payload.created_at` on Client entries."
|
|
6282
|
+
},
|
|
6267
6283
|
{
|
|
6268
6284
|
name: "expiresAt",
|
|
6269
6285
|
longName: "expiresAt",
|
|
@@ -6274,7 +6290,7 @@ var FIREBASE_MODELS = [
|
|
|
6274
6290
|
}
|
|
6275
6291
|
],
|
|
6276
6292
|
enums: [],
|
|
6277
|
-
detectionHints: ["type", "payload", "grantId", "userCode", "consumed", "expiresAt"],
|
|
6293
|
+
detectionHints: ["type", "payload", "grantId", "clientId", "userCode", "consumed", "createdAt", "expiresAt"],
|
|
6278
6294
|
description: "oidc-provider adapter entry stored in Firestore.",
|
|
6279
6295
|
modelGroup: "OidcModel",
|
|
6280
6296
|
collectionKind: "root"
|
|
@@ -7770,7 +7786,7 @@ var DEFAULT_GLOB_PATTERNS = ["components/*-firebase/src/**/auth/**/*claims*.ts",
|
|
|
7770
7786
|
var APP_TAG_MARKER = "@dbxAuthClaimsApp";
|
|
7771
7787
|
var SERVICE_TAG_MARKER = "@dbxAuthClaimsService";
|
|
7772
7788
|
async function loadAuthRegistry(input) {
|
|
7773
|
-
const { cwd, readFile:
|
|
7789
|
+
const { cwd, readFile: readFile23 = defaultReadFile, extraFiles = [] } = input;
|
|
7774
7790
|
const discovered = await discoverClaimsFiles(cwd);
|
|
7775
7791
|
const candidatePaths = mergeAndNormalisePaths(discovered, extraFiles);
|
|
7776
7792
|
const fileWarnings = [];
|
|
@@ -7780,7 +7796,7 @@ async function loadAuthRegistry(input) {
|
|
|
7780
7796
|
const absolute = resolvePath2(cwd, relPath);
|
|
7781
7797
|
let text;
|
|
7782
7798
|
try {
|
|
7783
|
-
text = await
|
|
7799
|
+
text = await readFile23(absolute);
|
|
7784
7800
|
} catch (error) {
|
|
7785
7801
|
fileWarnings.push({ kind: "read-failed", relPath, error: error instanceof Error ? error.message : String(error) });
|
|
7786
7802
|
continue;
|
|
@@ -7916,8 +7932,8 @@ function toAuthAppInfo(input) {
|
|
|
7916
7932
|
};
|
|
7917
7933
|
}
|
|
7918
7934
|
function toRelative(absolutePath, cwd) {
|
|
7919
|
-
const
|
|
7920
|
-
const target =
|
|
7935
|
+
const isAbsolute16 = absolutePath.startsWith("/") || /^[A-Za-z]:[\\/]/.test(absolutePath);
|
|
7936
|
+
const target = isAbsolute16 ? absolutePath : resolvePath2(cwd, absolutePath);
|
|
7921
7937
|
const rel = relative2(cwd, target);
|
|
7922
7938
|
return toPosix(rel.length > 0 ? rel : absolutePath);
|
|
7923
7939
|
}
|
|
@@ -13255,22 +13271,22 @@ function formatFirebaseStoreShapeTaxonomy() {
|
|
|
13255
13271
|
// packages/dbx-components-mcp/src/tools/validate-input.ts
|
|
13256
13272
|
import { glob as fsGlob4, readFile as readFile3, stat as stat3 } from "node:fs/promises";
|
|
13257
13273
|
import { resolve as resolve21, sep as sep4 } from "node:path";
|
|
13258
|
-
function ensurePathInsideCwd(
|
|
13274
|
+
function ensurePathInsideCwd(relative15, cwd) {
|
|
13259
13275
|
const cwdPrefix = cwd.endsWith(sep4) ? cwd : cwd + sep4;
|
|
13260
|
-
const absolute = resolve21(cwd,
|
|
13276
|
+
const absolute = resolve21(cwd, relative15);
|
|
13261
13277
|
if (!absolute.startsWith(cwdPrefix) && absolute !== cwd) {
|
|
13262
|
-
throw new Error(`Path \`${
|
|
13278
|
+
throw new Error(`Path \`${relative15}\` resolves outside the server cwd and is not allowed.`);
|
|
13263
13279
|
}
|
|
13264
13280
|
}
|
|
13265
13281
|
async function resolveFolderPaths(config) {
|
|
13266
13282
|
const { paths, glob: glob2, cwd } = config;
|
|
13267
13283
|
const collected = [];
|
|
13268
13284
|
const seen = /* @__PURE__ */ new Set();
|
|
13269
|
-
const accept = (
|
|
13270
|
-
if (seen.has(
|
|
13271
|
-
ensurePathInsideCwd(
|
|
13272
|
-
seen.add(
|
|
13273
|
-
collected.push(
|
|
13285
|
+
const accept = (relative15) => {
|
|
13286
|
+
if (seen.has(relative15)) return;
|
|
13287
|
+
ensurePathInsideCwd(relative15, cwd);
|
|
13288
|
+
seen.add(relative15);
|
|
13289
|
+
collected.push(relative15);
|
|
13274
13290
|
};
|
|
13275
13291
|
if (paths) {
|
|
13276
13292
|
for (const p of paths) {
|
|
@@ -13313,13 +13329,13 @@ async function resolveValidatorSources(config) {
|
|
|
13313
13329
|
pathList.push(match);
|
|
13314
13330
|
}
|
|
13315
13331
|
}
|
|
13316
|
-
for (const
|
|
13317
|
-
if (seenNames.has(
|
|
13318
|
-
ensurePathInsideCwd(
|
|
13319
|
-
const absolute = resolve21(cwd,
|
|
13332
|
+
for (const relative15 of pathList) {
|
|
13333
|
+
if (seenNames.has(relative15)) continue;
|
|
13334
|
+
ensurePathInsideCwd(relative15, cwd);
|
|
13335
|
+
const absolute = resolve21(cwd, relative15);
|
|
13320
13336
|
const text = await readFile3(absolute, "utf8");
|
|
13321
|
-
seenNames.add(
|
|
13322
|
-
collected.push({ name:
|
|
13337
|
+
seenNames.add(relative15);
|
|
13338
|
+
collected.push({ name: relative15, text });
|
|
13323
13339
|
}
|
|
13324
13340
|
return collected;
|
|
13325
13341
|
}
|
|
@@ -14082,10 +14098,10 @@ function createFolderValidateTool(config) {
|
|
|
14082
14098
|
}
|
|
14083
14099
|
const inspections = [];
|
|
14084
14100
|
try {
|
|
14085
|
-
for (const
|
|
14086
|
-
const absolute = resolve22(cwd,
|
|
14101
|
+
for (const relative15 of paths) {
|
|
14102
|
+
const absolute = resolve22(cwd, relative15);
|
|
14087
14103
|
const inspection = await inspectFolder3(absolute);
|
|
14088
|
-
const relativized = { ...inspection, path:
|
|
14104
|
+
const relativized = { ...inspection, path: relative15 };
|
|
14089
14105
|
inspections.push(relativized);
|
|
14090
14106
|
}
|
|
14091
14107
|
} catch (err) {
|
|
@@ -19899,22 +19915,48 @@ function identityToModel2(identity) {
|
|
|
19899
19915
|
var modelApiLookupTool = { definition: TOOL2, run: run2 };
|
|
19900
19916
|
|
|
19901
19917
|
// packages/dbx-components-mcp/src/tools/model-api-validate-app.tool.ts
|
|
19902
|
-
import { resolve as
|
|
19918
|
+
import { resolve as resolve26 } from "node:path";
|
|
19903
19919
|
import { type as type40 } from "arktype";
|
|
19904
19920
|
|
|
19905
19921
|
// packages/dbx-components-mcp/src/tools/model-api-validate-app/extract-declarations.ts
|
|
19906
19922
|
import { readdir as readdir5, readFile as readFile7, stat as stat7 } from "node:fs/promises";
|
|
19907
19923
|
import { join as join7, relative as relative7, sep as sep8 } from "node:path";
|
|
19908
19924
|
var API_SUFFIX3 = ".api.ts";
|
|
19909
|
-
|
|
19910
|
-
|
|
19911
|
-
const
|
|
19925
|
+
async function extractDeclaredEntries(roots) {
|
|
19926
|
+
const seen = /* @__PURE__ */ new Set();
|
|
19927
|
+
const out = [];
|
|
19928
|
+
for (const root of roots) {
|
|
19929
|
+
const files = await collectApiFiles2(root.absDir);
|
|
19930
|
+
for (const fileAbs of files) {
|
|
19931
|
+
if (seen.has(fileAbs)) continue;
|
|
19932
|
+
seen.add(fileAbs);
|
|
19933
|
+
const text = await readFile7(fileAbs, "utf8");
|
|
19934
|
+
if (!text.includes("callModelFirebaseFunctionMapFactory")) continue;
|
|
19935
|
+
const fileRel = relative7(root.relativeBase, fileAbs).split(sep8).join("/");
|
|
19936
|
+
const extraction = extractCrudEntries({ name: fileRel, text });
|
|
19937
|
+
for (const entry of extraction.entries) {
|
|
19938
|
+
if (entry.verb === "standalone") continue;
|
|
19939
|
+
out.push({
|
|
19940
|
+
model: entry.model,
|
|
19941
|
+
verb: entry.verb,
|
|
19942
|
+
specifier: entry.specifier,
|
|
19943
|
+
paramsTypeName: entry.paramsTypeName,
|
|
19944
|
+
resultTypeName: entry.resultTypeName,
|
|
19945
|
+
sourceFile: fileRel,
|
|
19946
|
+
line: entry.line
|
|
19947
|
+
});
|
|
19948
|
+
}
|
|
19949
|
+
}
|
|
19950
|
+
}
|
|
19951
|
+
return out;
|
|
19952
|
+
}
|
|
19953
|
+
async function collectApiFiles2(rootAbs) {
|
|
19912
19954
|
const files = [];
|
|
19913
19955
|
const stack = [];
|
|
19914
19956
|
try {
|
|
19915
|
-
const stats = await stat7(
|
|
19957
|
+
const stats = await stat7(rootAbs);
|
|
19916
19958
|
if (!stats.isDirectory()) return [];
|
|
19917
|
-
stack.push(
|
|
19959
|
+
stack.push(rootAbs);
|
|
19918
19960
|
} catch {
|
|
19919
19961
|
return [];
|
|
19920
19962
|
}
|
|
@@ -19939,26 +19981,7 @@ async function extractDeclaredEntries(componentAbs) {
|
|
|
19939
19981
|
}
|
|
19940
19982
|
}
|
|
19941
19983
|
files.sort((a, b) => a.localeCompare(b));
|
|
19942
|
-
|
|
19943
|
-
for (const fileAbs of files) {
|
|
19944
|
-
const text = await readFile7(fileAbs, "utf8");
|
|
19945
|
-
if (!text.includes("callModelFirebaseFunctionMapFactory")) continue;
|
|
19946
|
-
const fileRel = relative7(componentAbs, fileAbs).split(sep8).join("/");
|
|
19947
|
-
const extraction = extractCrudEntries({ name: fileRel, text });
|
|
19948
|
-
for (const entry of extraction.entries) {
|
|
19949
|
-
if (entry.verb === "standalone") continue;
|
|
19950
|
-
out.push({
|
|
19951
|
-
model: entry.model,
|
|
19952
|
-
verb: entry.verb,
|
|
19953
|
-
specifier: entry.specifier,
|
|
19954
|
-
paramsTypeName: entry.paramsTypeName,
|
|
19955
|
-
resultTypeName: entry.resultTypeName,
|
|
19956
|
-
sourceFile: fileRel,
|
|
19957
|
-
line: entry.line
|
|
19958
|
-
});
|
|
19959
|
-
}
|
|
19960
|
-
}
|
|
19961
|
-
return out;
|
|
19984
|
+
return files;
|
|
19962
19985
|
}
|
|
19963
19986
|
|
|
19964
19987
|
// packages/dbx-components-mcp/src/tools/model-api-validate-app/extract-handlers.ts
|
|
@@ -20053,6 +20076,37 @@ function readBareHandlerName(node) {
|
|
|
20053
20076
|
return void 0;
|
|
20054
20077
|
}
|
|
20055
20078
|
|
|
20079
|
+
// packages/dbx-components-mcp/src/tools/model-api-validate-app/naming.ts
|
|
20080
|
+
function expectedHandlerNames(model, verb, specifier) {
|
|
20081
|
+
const modelCamel = lowerFirst(model);
|
|
20082
|
+
const verbCap = capitalize3(verb);
|
|
20083
|
+
if (specifier === void 0 || specifier === "_") {
|
|
20084
|
+
return [modelCamel + verbCap];
|
|
20085
|
+
}
|
|
20086
|
+
const specifierCap = capitalize3(specifier);
|
|
20087
|
+
return [modelCamel + verbCap + specifierCap, modelCamel + specifierCap];
|
|
20088
|
+
}
|
|
20089
|
+
function checkHandlerNaming(handler) {
|
|
20090
|
+
const expected = expectedHandlerNames(handler.model, handler.verb, handler.specifier);
|
|
20091
|
+
if (expected.includes(handler.handlerName)) return void 0;
|
|
20092
|
+
const specifierSuffix = handler.specifier ? `.${handler.specifier}` : "";
|
|
20093
|
+
const accepted = expected.map((n) => `\`${n}\``).join(" or ");
|
|
20094
|
+
return {
|
|
20095
|
+
code: "HANDLER_NAMING_MISMATCH",
|
|
20096
|
+
model: handler.model,
|
|
20097
|
+
verb: handler.verb,
|
|
20098
|
+
specifier: handler.specifier,
|
|
20099
|
+
message: `Handler \`${handler.handlerName}\` for \`${handler.model}.${handler.verb}${specifierSuffix}\` does not follow the \`<model><Verb>[<Specifier>]\` convention. Rename to ${accepted}.`,
|
|
20100
|
+
source: `${handler.sourceFile}:${handler.line}`
|
|
20101
|
+
};
|
|
20102
|
+
}
|
|
20103
|
+
function lowerFirst(value) {
|
|
20104
|
+
return value.length > 0 ? value.charAt(0).toLowerCase() + value.slice(1) : value;
|
|
20105
|
+
}
|
|
20106
|
+
function capitalize3(value) {
|
|
20107
|
+
return value.length > 0 ? value.charAt(0).toUpperCase() + value.slice(1) : value;
|
|
20108
|
+
}
|
|
20109
|
+
|
|
20056
20110
|
// packages/dbx-components-mcp/src/tools/model-api-validate-app/reconcile.ts
|
|
20057
20111
|
function keyOf(cell) {
|
|
20058
20112
|
return `${cell.model}|${cell.verb}|${cell.specifier ?? "__none__"}`;
|
|
@@ -20100,6 +20154,10 @@ function reconcile(input) {
|
|
|
20100
20154
|
source: `${h.sourceFile}:${h.line}`
|
|
20101
20155
|
});
|
|
20102
20156
|
}
|
|
20157
|
+
for (const h of handlersFiltered) {
|
|
20158
|
+
const namingIssue = checkHandlerNaming(h);
|
|
20159
|
+
if (namingIssue) issues.push(namingIssue);
|
|
20160
|
+
}
|
|
20103
20161
|
entries.sort(compareEntries);
|
|
20104
20162
|
issues.sort((a, b) => a.model.localeCompare(b.model) || (a.verb ?? "").localeCompare(b.verb ?? "") || (a.specifier ?? "").localeCompare(b.specifier ?? ""));
|
|
20105
20163
|
const summaries = buildSummaries(entries, issues);
|
|
@@ -20129,6 +20187,178 @@ function normalize3(value) {
|
|
|
20129
20187
|
return value.replace(/Identity$/i, "").toLowerCase();
|
|
20130
20188
|
}
|
|
20131
20189
|
|
|
20190
|
+
// packages/dbx-components-mcp/src/tools/model-api-validate-app/source-roots.ts
|
|
20191
|
+
import { readFile as readFile9, stat as stat8 } from "node:fs/promises";
|
|
20192
|
+
import { dirname as dirname12, isAbsolute as isAbsolute12, join as join9, relative as relative8, resolve as resolve25, sep as sep9 } from "node:path";
|
|
20193
|
+
var TSCONFIG_BASE = "tsconfig.base.json";
|
|
20194
|
+
var COMPONENT_PACKAGE_JSON = "package.json";
|
|
20195
|
+
var SRC_LIB_SUBPATH = "src/lib";
|
|
20196
|
+
var DBX_COMPONENTS_BASE_SCOPE = "@dereekb/";
|
|
20197
|
+
async function resolveApiSourceRoots(input) {
|
|
20198
|
+
const workspaceRoot = input.workspaceRoot ?? await findWorkspaceRoot(input.componentAbs);
|
|
20199
|
+
const componentLib = join9(input.componentAbs, SRC_LIB_SUBPATH);
|
|
20200
|
+
const seen = /* @__PURE__ */ new Set();
|
|
20201
|
+
const roots = [];
|
|
20202
|
+
if (await isDirectory(componentLib)) {
|
|
20203
|
+
seen.add(componentLib);
|
|
20204
|
+
roots.push({ absDir: componentLib, packageLabel: workspaceRoot ? toWorkspaceRel(workspaceRoot, input.componentAbs) : input.componentAbs });
|
|
20205
|
+
}
|
|
20206
|
+
if (workspaceRoot) {
|
|
20207
|
+
const upstream = await resolveUpstreamRoots({ componentAbs: input.componentAbs, workspaceRoot });
|
|
20208
|
+
for (const root of upstream) {
|
|
20209
|
+
if (seen.has(root.absDir)) continue;
|
|
20210
|
+
seen.add(root.absDir);
|
|
20211
|
+
roots.push(root);
|
|
20212
|
+
}
|
|
20213
|
+
}
|
|
20214
|
+
return { roots, workspaceRoot };
|
|
20215
|
+
}
|
|
20216
|
+
async function findWorkspaceRoot(startAbs) {
|
|
20217
|
+
let current = resolve25(startAbs);
|
|
20218
|
+
for (; ; ) {
|
|
20219
|
+
const candidate = join9(current, TSCONFIG_BASE);
|
|
20220
|
+
try {
|
|
20221
|
+
const s = await stat8(candidate);
|
|
20222
|
+
if (s.isFile()) return current;
|
|
20223
|
+
} catch {
|
|
20224
|
+
}
|
|
20225
|
+
const parent = dirname12(current);
|
|
20226
|
+
if (parent === current) return void 0;
|
|
20227
|
+
current = parent;
|
|
20228
|
+
}
|
|
20229
|
+
}
|
|
20230
|
+
async function resolveUpstreamRoots(input) {
|
|
20231
|
+
const deps = await readComponentDereekbDeps(input.componentAbs);
|
|
20232
|
+
if (deps.length === 0) return [];
|
|
20233
|
+
const paths = await readTsconfigPaths(input.workspaceRoot);
|
|
20234
|
+
if (!paths) return [];
|
|
20235
|
+
const seen = /* @__PURE__ */ new Set();
|
|
20236
|
+
const out = [];
|
|
20237
|
+
for (const dep of deps) {
|
|
20238
|
+
const pkgRoot = resolvePackageRoot({ packageName: dep, paths, workspaceRoot: input.workspaceRoot });
|
|
20239
|
+
if (!pkgRoot) continue;
|
|
20240
|
+
const libDir = join9(pkgRoot, SRC_LIB_SUBPATH);
|
|
20241
|
+
if (seen.has(libDir)) continue;
|
|
20242
|
+
if (!await isDirectory(libDir)) continue;
|
|
20243
|
+
seen.add(libDir);
|
|
20244
|
+
out.push({ absDir: libDir, packageLabel: dep });
|
|
20245
|
+
}
|
|
20246
|
+
return out;
|
|
20247
|
+
}
|
|
20248
|
+
async function readComponentDereekbDeps(componentAbs) {
|
|
20249
|
+
const pkgPath = join9(componentAbs, COMPONENT_PACKAGE_JSON);
|
|
20250
|
+
let raw;
|
|
20251
|
+
try {
|
|
20252
|
+
raw = await readFile9(pkgPath, "utf8");
|
|
20253
|
+
} catch {
|
|
20254
|
+
return [];
|
|
20255
|
+
}
|
|
20256
|
+
let json;
|
|
20257
|
+
try {
|
|
20258
|
+
json = JSON.parse(raw);
|
|
20259
|
+
} catch {
|
|
20260
|
+
return [];
|
|
20261
|
+
}
|
|
20262
|
+
if (!isRecord(json)) return [];
|
|
20263
|
+
const out = /* @__PURE__ */ new Set();
|
|
20264
|
+
for (const field of ["dependencies", "devDependencies", "peerDependencies"]) {
|
|
20265
|
+
const map = json[field];
|
|
20266
|
+
if (!isRecord(map)) continue;
|
|
20267
|
+
for (const name of Object.keys(map)) {
|
|
20268
|
+
if (name.startsWith(DBX_COMPONENTS_BASE_SCOPE)) out.add(name);
|
|
20269
|
+
}
|
|
20270
|
+
}
|
|
20271
|
+
return [...out];
|
|
20272
|
+
}
|
|
20273
|
+
async function readTsconfigPaths(workspaceRoot) {
|
|
20274
|
+
const tsconfigPath = join9(workspaceRoot, TSCONFIG_BASE);
|
|
20275
|
+
let raw;
|
|
20276
|
+
try {
|
|
20277
|
+
raw = await readFile9(tsconfigPath, "utf8");
|
|
20278
|
+
} catch {
|
|
20279
|
+
return void 0;
|
|
20280
|
+
}
|
|
20281
|
+
let json;
|
|
20282
|
+
try {
|
|
20283
|
+
json = JSON.parse(stripJsonComments(raw));
|
|
20284
|
+
} catch {
|
|
20285
|
+
return void 0;
|
|
20286
|
+
}
|
|
20287
|
+
if (!isRecord(json)) return void 0;
|
|
20288
|
+
const compilerOptions = json.compilerOptions;
|
|
20289
|
+
if (!isRecord(compilerOptions)) return void 0;
|
|
20290
|
+
const paths = compilerOptions.paths;
|
|
20291
|
+
if (!isRecord(paths)) return void 0;
|
|
20292
|
+
const entries = /* @__PURE__ */ new Map();
|
|
20293
|
+
for (const [alias, target] of Object.entries(paths)) {
|
|
20294
|
+
if (!Array.isArray(target) || target.length === 0) continue;
|
|
20295
|
+
const first = target[0];
|
|
20296
|
+
if (typeof first !== "string") continue;
|
|
20297
|
+
entries.set(alias, first);
|
|
20298
|
+
}
|
|
20299
|
+
return { entries };
|
|
20300
|
+
}
|
|
20301
|
+
function resolvePackageRoot(input) {
|
|
20302
|
+
const target = input.paths.entries.get(input.packageName);
|
|
20303
|
+
if (!target) return void 0;
|
|
20304
|
+
const targetAbs = isAbsolute12(target) ? target : resolve25(input.workspaceRoot, target);
|
|
20305
|
+
return dirname12(dirname12(targetAbs));
|
|
20306
|
+
}
|
|
20307
|
+
async function isDirectory(path) {
|
|
20308
|
+
try {
|
|
20309
|
+
const s = await stat8(path);
|
|
20310
|
+
return s.isDirectory();
|
|
20311
|
+
} catch {
|
|
20312
|
+
return false;
|
|
20313
|
+
}
|
|
20314
|
+
}
|
|
20315
|
+
function isRecord(value) {
|
|
20316
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
20317
|
+
}
|
|
20318
|
+
function toWorkspaceRel(workspaceRoot, abs) {
|
|
20319
|
+
const rel = relative8(workspaceRoot, abs);
|
|
20320
|
+
return rel.split(sep9).join("/");
|
|
20321
|
+
}
|
|
20322
|
+
function stripJsonComments(value) {
|
|
20323
|
+
let out = "";
|
|
20324
|
+
let i = 0;
|
|
20325
|
+
let inString = null;
|
|
20326
|
+
while (i < value.length) {
|
|
20327
|
+
const ch = value[i];
|
|
20328
|
+
const next = value[i + 1];
|
|
20329
|
+
if (inString) {
|
|
20330
|
+
out += ch;
|
|
20331
|
+
if (ch === "\\" && i + 1 < value.length) {
|
|
20332
|
+
out += next;
|
|
20333
|
+
i += 2;
|
|
20334
|
+
continue;
|
|
20335
|
+
}
|
|
20336
|
+
if (ch === inString) inString = null;
|
|
20337
|
+
i += 1;
|
|
20338
|
+
continue;
|
|
20339
|
+
}
|
|
20340
|
+
if (ch === '"' || ch === "'") {
|
|
20341
|
+
inString = ch;
|
|
20342
|
+
out += ch;
|
|
20343
|
+
i += 1;
|
|
20344
|
+
continue;
|
|
20345
|
+
}
|
|
20346
|
+
if (ch === "/" && next === "/") {
|
|
20347
|
+
while (i < value.length && value[i] !== "\n") i += 1;
|
|
20348
|
+
continue;
|
|
20349
|
+
}
|
|
20350
|
+
if (ch === "/" && next === "*") {
|
|
20351
|
+
i += 2;
|
|
20352
|
+
while (i < value.length && !(value[i] === "*" && value[i + 1] === "/")) i += 1;
|
|
20353
|
+
i += 2;
|
|
20354
|
+
continue;
|
|
20355
|
+
}
|
|
20356
|
+
out += ch;
|
|
20357
|
+
i += 1;
|
|
20358
|
+
}
|
|
20359
|
+
return out;
|
|
20360
|
+
}
|
|
20361
|
+
|
|
20132
20362
|
// packages/dbx-components-mcp/src/tools/model-api-validate-app/format.ts
|
|
20133
20363
|
function formatValidationAsMarkdown(report) {
|
|
20134
20364
|
const lines = [`# Model API validation \u2014 ${report.apiDir}`, "", `Component: \`${report.componentDir}\``, `Handler map: \`${report.handlerMapPath}\``];
|
|
@@ -20191,7 +20421,10 @@ function formatEntryRow2(entry) {
|
|
|
20191
20421
|
|
|
20192
20422
|
// packages/dbx-components-mcp/src/tools/model-api-validate-app/index.ts
|
|
20193
20423
|
async function validateAppModelApi(options) {
|
|
20194
|
-
const
|
|
20424
|
+
const { roots, workspaceRoot } = await resolveApiSourceRoots({ componentAbs: options.componentAbs, workspaceRoot: void 0 });
|
|
20425
|
+
const relativeBase = workspaceRoot ?? options.componentAbs;
|
|
20426
|
+
const declaredRoots = roots.map((r) => ({ absDir: r.absDir, relativeBase }));
|
|
20427
|
+
const declared = await extractDeclaredEntries(declaredRoots);
|
|
20195
20428
|
const handlerExtraction = await extractHandlerEntries(options.apiAbs, options.apiDir);
|
|
20196
20429
|
const reconciled = reconcile({ declared, handlers: handlerExtraction.entries, modelFilter: options.modelFilter });
|
|
20197
20430
|
const report = {
|
|
@@ -20230,6 +20463,7 @@ var TOOL3 = {
|
|
|
20230
20463
|
"- matched \u2014 declaration and handler agree.",
|
|
20231
20464
|
"- `MISSING_HANDLER` \u2014 declared but the verb-map has no entry.",
|
|
20232
20465
|
"- `ORPHAN_HANDLER` \u2014 handler is wired but no `*.api.ts` declares the entry.",
|
|
20466
|
+
"- `HANDLER_NAMING_MISMATCH` \u2014 handler name does not match the canonical `<model><Verb>[<Specifier>]` form (e.g. `guestbookEntryUpdateInsert`, with `guestbookEntryInsert` accepted as the verb-omitted shorthand).",
|
|
20233
20467
|
"",
|
|
20234
20468
|
"Inputs:",
|
|
20235
20469
|
"- `componentDir`: relative path to the firebase-component package (e.g. `components/demo-firebase`).",
|
|
@@ -20261,8 +20495,8 @@ async function run3(rawArgs) {
|
|
|
20261
20495
|
} catch (err) {
|
|
20262
20496
|
return toolError(err instanceof Error ? err.message : String(err));
|
|
20263
20497
|
}
|
|
20264
|
-
const componentAbs =
|
|
20265
|
-
const apiAbs =
|
|
20498
|
+
const componentAbs = resolve26(cwd, parsed.componentDir);
|
|
20499
|
+
const apiAbs = resolve26(cwd, parsed.apiDir);
|
|
20266
20500
|
const modelFilter = parsed.model ?? (parsed.identity ? identityToModel3(parsed.identity) : void 0);
|
|
20267
20501
|
let report;
|
|
20268
20502
|
try {
|
|
@@ -20287,8 +20521,8 @@ function formatResult3(result) {
|
|
|
20287
20521
|
}
|
|
20288
20522
|
|
|
20289
20523
|
// packages/dbx-components-mcp/src/tools/model-validate-folder/inspect.ts
|
|
20290
|
-
import { readdir as readdir6, readFile as
|
|
20291
|
-
import { basename as basename4, join as
|
|
20524
|
+
import { readdir as readdir6, readFile as readFile10, stat as stat9 } from "node:fs/promises";
|
|
20525
|
+
import { basename as basename4, join as join10 } from "node:path";
|
|
20292
20526
|
var CONTENT_VALIDATION_SKIP_SUFFIXES = [".spec.ts", ".id.ts", ".query.ts", ".action.ts", ".api.ts"];
|
|
20293
20527
|
async function inspectFolder(path) {
|
|
20294
20528
|
const name = basename4(path);
|
|
@@ -20296,7 +20530,7 @@ async function inspectFolder(path) {
|
|
|
20296
20530
|
let files = [];
|
|
20297
20531
|
let sources = [];
|
|
20298
20532
|
try {
|
|
20299
|
-
const stats = await
|
|
20533
|
+
const stats = await stat9(path);
|
|
20300
20534
|
if (stats.isDirectory()) {
|
|
20301
20535
|
status = "ok";
|
|
20302
20536
|
const entries = await readdir6(path, { withFileTypes: true });
|
|
@@ -20327,7 +20561,7 @@ async function readModelSources(folderPath, files) {
|
|
|
20327
20561
|
for (const filename of files) {
|
|
20328
20562
|
if (filename === "index.ts") continue;
|
|
20329
20563
|
if (CONTENT_VALIDATION_SKIP_SUFFIXES.some((suffix) => filename.endsWith(suffix))) continue;
|
|
20330
|
-
const text = await
|
|
20564
|
+
const text = await readFile10(join10(folderPath, filename), "utf8");
|
|
20331
20565
|
out.push({ filename, text });
|
|
20332
20566
|
}
|
|
20333
20567
|
return out;
|
|
@@ -21008,7 +21242,7 @@ var modelStoreScaffoldTool = {
|
|
|
21008
21242
|
};
|
|
21009
21243
|
|
|
21010
21244
|
// packages/dbx-components-mcp/src/tools/model-fixture-list-app.tool.ts
|
|
21011
|
-
import { resolve as
|
|
21245
|
+
import { resolve as resolve27 } from "node:path";
|
|
21012
21246
|
import { type as type42 } from "arktype";
|
|
21013
21247
|
|
|
21014
21248
|
// packages/dbx-components-mcp/src/tools/model-fixture-shared/archetype.ts
|
|
@@ -21503,13 +21737,13 @@ function collectIdentityImports(sourceFile) {
|
|
|
21503
21737
|
}
|
|
21504
21738
|
|
|
21505
21739
|
// packages/dbx-components-mcp/src/tools/model-fixture-shared/inspect.ts
|
|
21506
|
-
import { readFile as
|
|
21507
|
-
import { join as
|
|
21740
|
+
import { readFile as readFile11 } from "node:fs/promises";
|
|
21741
|
+
import { join as join11 } from "node:path";
|
|
21508
21742
|
var FIXTURE_RELATIVE_PATH = "src/test/fixture.ts";
|
|
21509
21743
|
async function inspectAppFixtures(apiAbs, apiRel) {
|
|
21510
|
-
const absolutePath =
|
|
21744
|
+
const absolutePath = join11(apiAbs, FIXTURE_RELATIVE_PATH);
|
|
21511
21745
|
const relativePath = `${apiRel}/${FIXTURE_RELATIVE_PATH}`;
|
|
21512
|
-
const text = await
|
|
21746
|
+
const text = await readFile11(absolutePath, "utf8");
|
|
21513
21747
|
return extractAppFixturesFromText({ text, fixturePath: relativePath });
|
|
21514
21748
|
}
|
|
21515
21749
|
|
|
@@ -22251,7 +22485,7 @@ async function run4(rawArgs) {
|
|
|
22251
22485
|
} catch (err) {
|
|
22252
22486
|
return toolError(err instanceof Error ? err.message : String(err));
|
|
22253
22487
|
}
|
|
22254
|
-
const apiAbs =
|
|
22488
|
+
const apiAbs = resolve27(cwd, parsed.apiDir);
|
|
22255
22489
|
let extraction;
|
|
22256
22490
|
try {
|
|
22257
22491
|
extraction = await inspectAppFixtures(apiAbs, parsed.apiDir);
|
|
@@ -22265,7 +22499,7 @@ async function run4(rawArgs) {
|
|
|
22265
22499
|
var modelFixtureListAppTool = { definition: TOOL4, run: run4 };
|
|
22266
22500
|
|
|
22267
22501
|
// packages/dbx-components-mcp/src/tools/model-fixture-lookup.tool.ts
|
|
22268
|
-
import { resolve as
|
|
22502
|
+
import { resolve as resolve28 } from "node:path";
|
|
22269
22503
|
import { type as type43 } from "arktype";
|
|
22270
22504
|
var LookupArgsType2 = type43({
|
|
22271
22505
|
apiDir: "string",
|
|
@@ -22311,7 +22545,7 @@ async function run5(rawArgs) {
|
|
|
22311
22545
|
} catch (err) {
|
|
22312
22546
|
return toolError(err instanceof Error ? err.message : String(err));
|
|
22313
22547
|
}
|
|
22314
|
-
const apiAbs =
|
|
22548
|
+
const apiAbs = resolve28(cwd, parsed.apiDir);
|
|
22315
22549
|
let extraction;
|
|
22316
22550
|
try {
|
|
22317
22551
|
extraction = await inspectAppFixtures(apiAbs, parsed.apiDir);
|
|
@@ -22337,7 +22571,7 @@ function identityToModel4(identity) {
|
|
|
22337
22571
|
var modelFixtureLookupTool = { definition: TOOL5, run: run5 };
|
|
22338
22572
|
|
|
22339
22573
|
// packages/dbx-components-mcp/src/tools/model-fixture-validate-app.tool.ts
|
|
22340
|
-
import { resolve as
|
|
22574
|
+
import { resolve as resolve29 } from "node:path";
|
|
22341
22575
|
import { type as type44 } from "arktype";
|
|
22342
22576
|
var ValidateArgsType2 = type44({
|
|
22343
22577
|
apiDir: "string",
|
|
@@ -22382,7 +22616,7 @@ function createModelFixtureValidateAppTool(config = {}) {
|
|
|
22382
22616
|
} catch (err) {
|
|
22383
22617
|
return toolError(err instanceof Error ? err.message : String(err));
|
|
22384
22618
|
}
|
|
22385
|
-
const apiAbs =
|
|
22619
|
+
const apiAbs = resolve29(cwd, parsed.apiDir);
|
|
22386
22620
|
let extraction;
|
|
22387
22621
|
try {
|
|
22388
22622
|
extraction = await inspectAppFixtures(apiAbs, parsed.apiDir);
|
|
@@ -22402,8 +22636,8 @@ function createModelFixtureValidateAppTool(config = {}) {
|
|
|
22402
22636
|
}
|
|
22403
22637
|
|
|
22404
22638
|
// packages/dbx-components-mcp/src/tools/model-fixture-scaffold.tool.ts
|
|
22405
|
-
import { readFile as
|
|
22406
|
-
import { join as
|
|
22639
|
+
import { readFile as readFile12, writeFile } from "node:fs/promises";
|
|
22640
|
+
import { join as join12, resolve as resolve30 } from "node:path";
|
|
22407
22641
|
import { type as type45 } from "arktype";
|
|
22408
22642
|
var ScaffoldArgsType3 = type45({
|
|
22409
22643
|
apiDir: "string",
|
|
@@ -22482,7 +22716,7 @@ async function run6(rawArgs) {
|
|
|
22482
22716
|
} catch (err) {
|
|
22483
22717
|
return toolError(err instanceof Error ? err.message : String(err));
|
|
22484
22718
|
}
|
|
22485
|
-
const apiAbs =
|
|
22719
|
+
const apiAbs = resolve30(cwd, parsed.apiDir);
|
|
22486
22720
|
let extraction;
|
|
22487
22721
|
try {
|
|
22488
22722
|
extraction = await inspectAppFixtures(apiAbs, parsed.apiDir);
|
|
@@ -22521,10 +22755,10 @@ async function run6(rawArgs) {
|
|
|
22521
22755
|
if (conflicts.length > 0) {
|
|
22522
22756
|
return toolError(["Refusing to scaffold \u2014 the following names already exist in `" + extraction.fixturePath + "`:", "", ...conflicts.map((c) => "- `" + c + "`"), "", "Rename, delete, or pick a different model name and retry."].join("\n"));
|
|
22523
22757
|
}
|
|
22524
|
-
const absolutePath =
|
|
22758
|
+
const absolutePath = join12(apiAbs, FIXTURE_RELATIVE_PATH);
|
|
22525
22759
|
let original;
|
|
22526
22760
|
try {
|
|
22527
|
-
original = await
|
|
22761
|
+
original = await readFile12(absolutePath, "utf8");
|
|
22528
22762
|
} catch (err) {
|
|
22529
22763
|
return toolError(`Failed to read fixture file: ${err instanceof Error ? err.message : String(err)}`);
|
|
22530
22764
|
}
|
|
@@ -22567,7 +22801,7 @@ function collectConflicts(extraction, rendered) {
|
|
|
22567
22801
|
var modelFixtureScaffoldTool = { definition: TOOL7, run: run6 };
|
|
22568
22802
|
|
|
22569
22803
|
// packages/dbx-components-mcp/src/tools/model-fixture-forward.tool.ts
|
|
22570
|
-
import { join as
|
|
22804
|
+
import { join as join13, resolve as resolve31 } from "node:path";
|
|
22571
22805
|
import { type as type46 } from "arktype";
|
|
22572
22806
|
import { Project as Project10 } from "ts-morph";
|
|
22573
22807
|
var ForwardArgsType = type46({
|
|
@@ -22603,7 +22837,7 @@ async function run7(rawArgs) {
|
|
|
22603
22837
|
} catch (err) {
|
|
22604
22838
|
return toolError(toErrorMessage(err));
|
|
22605
22839
|
}
|
|
22606
|
-
const apiAbs =
|
|
22840
|
+
const apiAbs = resolve31(cwd, parsed.apiDir);
|
|
22607
22841
|
let extraction;
|
|
22608
22842
|
try {
|
|
22609
22843
|
extraction = await inspectAppFixtures(apiAbs, parsed.apiDir);
|
|
@@ -22619,7 +22853,7 @@ async function run7(rawArgs) {
|
|
|
22619
22853
|
if (rendered.added.length === 0) {
|
|
22620
22854
|
return { content: [{ type: "text", text: renderNoOpReport(extraction.fixturePath, entry.fixtureClassName, rendered) }] };
|
|
22621
22855
|
}
|
|
22622
|
-
const absolutePath =
|
|
22856
|
+
const absolutePath = join13(apiAbs, FIXTURE_RELATIVE_PATH);
|
|
22623
22857
|
const writeError = await applyForwardersToFile(absolutePath, entry.fixtureClassName, rendered);
|
|
22624
22858
|
if (writeError) {
|
|
22625
22859
|
return toolError(writeError);
|
|
@@ -22677,7 +22911,7 @@ function appendListSection(lines, heading, names) {
|
|
|
22677
22911
|
var modelFixtureForwardTool = { definition: TOOL8, run: run7 };
|
|
22678
22912
|
|
|
22679
22913
|
// packages/dbx-components-mcp/src/tools/model-test-tree.tool.ts
|
|
22680
|
-
import { resolve as
|
|
22914
|
+
import { resolve as resolve32 } from "node:path";
|
|
22681
22915
|
import { type as type47 } from "arktype";
|
|
22682
22916
|
|
|
22683
22917
|
// packages/dbx-components-mcp/src/tools/model-test-shared/extract.ts
|
|
@@ -23020,10 +23254,10 @@ function scanForDescribeOrIt(node) {
|
|
|
23020
23254
|
}
|
|
23021
23255
|
|
|
23022
23256
|
// packages/dbx-components-mcp/src/tools/model-test-shared/inspect.ts
|
|
23023
|
-
import { readFile as
|
|
23257
|
+
import { readFile as readFile13 } from "node:fs/promises";
|
|
23024
23258
|
async function inspectSpecFile(config) {
|
|
23025
23259
|
const { specAbs, specRel, apiAbs, apiRel } = config;
|
|
23026
|
-
const text = await
|
|
23260
|
+
const text = await readFile13(specAbs, "utf8");
|
|
23027
23261
|
let prefix;
|
|
23028
23262
|
let knownFixtureNames;
|
|
23029
23263
|
if (apiAbs !== void 0 && apiRel !== void 0) {
|
|
@@ -23499,8 +23733,8 @@ async function run8(rawArgs) {
|
|
|
23499
23733
|
} catch (err) {
|
|
23500
23734
|
return toolError(err instanceof Error ? err.message : String(err));
|
|
23501
23735
|
}
|
|
23502
|
-
const specAbs =
|
|
23503
|
-
const apiAbs = parsed.apiDir === void 0 ? void 0 :
|
|
23736
|
+
const specAbs = resolve32(cwd, parsed.specFile);
|
|
23737
|
+
const apiAbs = parsed.apiDir === void 0 ? void 0 : resolve32(cwd, parsed.apiDir);
|
|
23504
23738
|
let tree;
|
|
23505
23739
|
try {
|
|
23506
23740
|
tree = await inspectSpecFile({ specAbs, specRel: parsed.specFile, apiAbs, apiRel: parsed.apiDir });
|
|
@@ -23516,7 +23750,7 @@ async function run8(rawArgs) {
|
|
|
23516
23750
|
var modelTestTreeTool = { definition: TOOL9, run: run8 };
|
|
23517
23751
|
|
|
23518
23752
|
// packages/dbx-components-mcp/src/tools/model-test-search.tool.ts
|
|
23519
|
-
import { resolve as
|
|
23753
|
+
import { resolve as resolve33 } from "node:path";
|
|
23520
23754
|
import { type as type48 } from "arktype";
|
|
23521
23755
|
var SearchArgsType2 = type48({
|
|
23522
23756
|
specFile: "string",
|
|
@@ -23582,8 +23816,8 @@ async function run9(rawArgs) {
|
|
|
23582
23816
|
} catch (err) {
|
|
23583
23817
|
return toolError(err instanceof Error ? err.message : String(err));
|
|
23584
23818
|
}
|
|
23585
|
-
const specAbs =
|
|
23586
|
-
const apiAbs = parsed.apiDir === void 0 ? void 0 :
|
|
23819
|
+
const specAbs = resolve33(cwd, parsed.specFile);
|
|
23820
|
+
const apiAbs = parsed.apiDir === void 0 ? void 0 : resolve33(cwd, parsed.apiDir);
|
|
23587
23821
|
let tree;
|
|
23588
23822
|
try {
|
|
23589
23823
|
tree = await inspectSpecFile({ specAbs, specRel: parsed.specFile, apiAbs, apiRel: parsed.apiDir });
|
|
@@ -24734,8 +24968,8 @@ function formatResult4(result) {
|
|
|
24734
24968
|
}
|
|
24735
24969
|
|
|
24736
24970
|
// packages/dbx-components-mcp/src/tools/_validate/inspect.ts
|
|
24737
|
-
import { readdir as readdir7, readFile as
|
|
24738
|
-
import { join as
|
|
24971
|
+
import { readdir as readdir7, readFile as readFile14, stat as stat10 } from "node:fs/promises";
|
|
24972
|
+
import { join as join14, relative as relative9, sep as sep10 } from "node:path";
|
|
24739
24973
|
async function inspectSide(rootDir, subpaths) {
|
|
24740
24974
|
const rootStatus = await readRootStatus(rootDir);
|
|
24741
24975
|
if (rootStatus !== void 0) {
|
|
@@ -24745,8 +24979,8 @@ async function inspectSide(rootDir, subpaths) {
|
|
|
24745
24979
|
const presentFolders = [];
|
|
24746
24980
|
const collectedFiles = [];
|
|
24747
24981
|
for (const sub of subpaths) {
|
|
24748
|
-
const absFolder =
|
|
24749
|
-
const folderPresent = await
|
|
24982
|
+
const absFolder = join14(rootDir, sub);
|
|
24983
|
+
const folderPresent = await isDirectory2(absFolder);
|
|
24750
24984
|
if (!folderPresent) continue;
|
|
24751
24985
|
presentFolders.push(sub);
|
|
24752
24986
|
const collected = await collectTsFiles(absFolder, rootDir);
|
|
@@ -24761,7 +24995,7 @@ async function inspectSide(rootDir, subpaths) {
|
|
|
24761
24995
|
}
|
|
24762
24996
|
async function readRootStatus(rootDir) {
|
|
24763
24997
|
try {
|
|
24764
|
-
const stats = await
|
|
24998
|
+
const stats = await stat10(rootDir);
|
|
24765
24999
|
return stats.isDirectory() ? void 0 : "dir-not-found";
|
|
24766
25000
|
} catch (err) {
|
|
24767
25001
|
const code14 = err.code;
|
|
@@ -24771,9 +25005,9 @@ async function readRootStatus(rootDir) {
|
|
|
24771
25005
|
throw err;
|
|
24772
25006
|
}
|
|
24773
25007
|
}
|
|
24774
|
-
async function
|
|
25008
|
+
async function isDirectory2(absPath) {
|
|
24775
25009
|
try {
|
|
24776
|
-
const stats = await
|
|
25010
|
+
const stats = await stat10(absPath);
|
|
24777
25011
|
return stats.isDirectory();
|
|
24778
25012
|
} catch {
|
|
24779
25013
|
return false;
|
|
@@ -24791,7 +25025,7 @@ async function collectTsFiles(absFolder, rootDir) {
|
|
|
24791
25025
|
continue;
|
|
24792
25026
|
}
|
|
24793
25027
|
for (const entry of entries) {
|
|
24794
|
-
const full =
|
|
25028
|
+
const full = join14(current, entry.name);
|
|
24795
25029
|
if (entry.isDirectory()) {
|
|
24796
25030
|
stack.push(full);
|
|
24797
25031
|
continue;
|
|
@@ -24800,8 +25034,8 @@ async function collectTsFiles(absFolder, rootDir) {
|
|
|
24800
25034
|
if (!entry.name.endsWith(".ts")) continue;
|
|
24801
25035
|
if (entry.name.endsWith(".spec.ts")) continue;
|
|
24802
25036
|
if (entry.name.endsWith(".d.ts")) continue;
|
|
24803
|
-
const text = await
|
|
24804
|
-
const rel =
|
|
25037
|
+
const text = await readFile14(full, "utf8");
|
|
25038
|
+
const rel = relative9(rootDir, full).split(sep10).join("/");
|
|
24805
25039
|
out.push({ relPath: rel, text });
|
|
24806
25040
|
}
|
|
24807
25041
|
}
|
|
@@ -25053,8 +25287,8 @@ var storageFileMListAppTool = createListAppTool({
|
|
|
25053
25287
|
});
|
|
25054
25288
|
|
|
25055
25289
|
// packages/dbx-components-mcp/src/tools/validate-two-side-folder.ts
|
|
25056
|
-
import { readdir as readdir8, readFile as
|
|
25057
|
-
import { join as
|
|
25290
|
+
import { readdir as readdir8, readFile as readFile15, stat as stat11 } from "node:fs/promises";
|
|
25291
|
+
import { join as join15 } from "node:path";
|
|
25058
25292
|
var REEXPORT_PATTERN = /^\s*export\s+\*\s+from\s+['"]\.\/([^'"\n]+)['"]\s*;?\s*$/gm;
|
|
25059
25293
|
// @__NO_SIDE_EFFECTS__
|
|
25060
25294
|
function createTwoSideFolderValidator(config) {
|
|
@@ -25099,7 +25333,7 @@ async function inspectSide2(input) {
|
|
|
25099
25333
|
let indexSource;
|
|
25100
25334
|
const rootStatOk = await isExistingDirectory(rootDir);
|
|
25101
25335
|
if (rootStatOk) {
|
|
25102
|
-
const absFolder =
|
|
25336
|
+
const absFolder = join15(rootDir, subPath);
|
|
25103
25337
|
const folderStatOk = await isExistingDirectory(absFolder);
|
|
25104
25338
|
if (folderStatOk) {
|
|
25105
25339
|
const folder = await readFolder(absFolder, indexFile);
|
|
@@ -25125,7 +25359,7 @@ async function inspectSide2(input) {
|
|
|
25125
25359
|
}
|
|
25126
25360
|
async function isExistingDirectory(path) {
|
|
25127
25361
|
try {
|
|
25128
|
-
const stats = await
|
|
25362
|
+
const stats = await stat11(path);
|
|
25129
25363
|
return stats.isDirectory();
|
|
25130
25364
|
} catch (err) {
|
|
25131
25365
|
const code14 = err.code;
|
|
@@ -25151,7 +25385,7 @@ async function readFolder(absFolder, indexFile) {
|
|
|
25151
25385
|
let indexSource;
|
|
25152
25386
|
if (collectedFiles.includes(indexFile)) {
|
|
25153
25387
|
try {
|
|
25154
|
-
indexSource = await
|
|
25388
|
+
indexSource = await readFile15(join15(absFolder, indexFile), "utf8");
|
|
25155
25389
|
} catch {
|
|
25156
25390
|
indexSource = void 0;
|
|
25157
25391
|
}
|
|
@@ -26876,15 +27110,15 @@ function formatResult8(result) {
|
|
|
26876
27110
|
}
|
|
26877
27111
|
|
|
26878
27112
|
// packages/dbx-components-mcp/src/tools/system-m-validate-folder/inspect.ts
|
|
26879
|
-
import { readdir as readdir9, readFile as
|
|
26880
|
-
import { basename as basename5, join as
|
|
27113
|
+
import { readdir as readdir9, readFile as readFile16, stat as stat12 } from "node:fs/promises";
|
|
27114
|
+
import { basename as basename5, join as join16 } from "node:path";
|
|
26881
27115
|
async function inspectFolder2(path) {
|
|
26882
27116
|
const name = basename5(path);
|
|
26883
27117
|
let status;
|
|
26884
27118
|
let files = [];
|
|
26885
27119
|
let systemSource;
|
|
26886
27120
|
try {
|
|
26887
|
-
const stats = await
|
|
27121
|
+
const stats = await stat12(path);
|
|
26888
27122
|
if (stats.isDirectory()) {
|
|
26889
27123
|
status = "ok";
|
|
26890
27124
|
const entries = await readdir9(path, { withFileTypes: true });
|
|
@@ -26897,7 +27131,7 @@ async function inspectFolder2(path) {
|
|
|
26897
27131
|
files = collected;
|
|
26898
27132
|
if (collected.includes("system.ts")) {
|
|
26899
27133
|
try {
|
|
26900
|
-
systemSource = await
|
|
27134
|
+
systemSource = await readFile16(join16(path, "system.ts"), "utf8");
|
|
26901
27135
|
} catch {
|
|
26902
27136
|
systemSource = void 0;
|
|
26903
27137
|
}
|
|
@@ -27852,9 +28086,9 @@ function formatResult9(result) {
|
|
|
27852
28086
|
}
|
|
27853
28087
|
|
|
27854
28088
|
// packages/dbx-components-mcp/src/tools/dbx-asset-validate-app/inspect.ts
|
|
27855
|
-
import { readdir as readdir10, readFile as
|
|
27856
|
-
import { join as
|
|
27857
|
-
var
|
|
28089
|
+
import { readdir as readdir10, readFile as readFile17, stat as stat13 } from "node:fs/promises";
|
|
28090
|
+
import { join as join17, relative as relative10, sep as sep11 } from "node:path";
|
|
28091
|
+
var COMPONENT_LIB_SUBPATH2 = "src/lib";
|
|
27858
28092
|
var APP_ROOT_CONFIG_RELPATH = "src/root.app.config.ts";
|
|
27859
28093
|
var APP_ASSETS_SUBPATH = "src/assets";
|
|
27860
28094
|
async function inspectAppAssets(componentDir, appDir) {
|
|
@@ -27872,7 +28106,7 @@ async function inspectAppAssets(componentDir, appDir) {
|
|
|
27872
28106
|
async function inspectComponentLib(rootDir) {
|
|
27873
28107
|
let rootStats;
|
|
27874
28108
|
try {
|
|
27875
|
-
rootStats = await
|
|
28109
|
+
rootStats = await stat13(rootDir);
|
|
27876
28110
|
} catch (err) {
|
|
27877
28111
|
const code14 = err.code;
|
|
27878
28112
|
if (code14 === "ENOENT" || code14 === "ENOTDIR") {
|
|
@@ -27883,26 +28117,26 @@ async function inspectComponentLib(rootDir) {
|
|
|
27883
28117
|
if (!rootStats.isDirectory()) {
|
|
27884
28118
|
return { rootDir, folder: void 0, status: "dir-not-found", files: [] };
|
|
27885
28119
|
}
|
|
27886
|
-
const libDir =
|
|
27887
|
-
const libExists = await
|
|
28120
|
+
const libDir = join17(rootDir, COMPONENT_LIB_SUBPATH2);
|
|
28121
|
+
const libExists = await isDirectory3(libDir);
|
|
27888
28122
|
if (!libExists) {
|
|
27889
28123
|
return { rootDir, folder: void 0, status: "folder-missing", files: [] };
|
|
27890
28124
|
}
|
|
27891
28125
|
const files = [];
|
|
27892
28126
|
for (const name of ["assets.ts", "index.ts"]) {
|
|
27893
|
-
const abs =
|
|
28127
|
+
const abs = join17(libDir, name);
|
|
27894
28128
|
const text = await readFileIfExists(abs);
|
|
27895
28129
|
if (text !== void 0) {
|
|
27896
|
-
const rel =
|
|
28130
|
+
const rel = relative10(rootDir, abs).split(sep11).join("/");
|
|
27897
28131
|
files.push({ relPath: rel, text });
|
|
27898
28132
|
}
|
|
27899
28133
|
}
|
|
27900
28134
|
files.sort((a, b) => a.relPath.localeCompare(b.relPath));
|
|
27901
|
-
return { rootDir, folder:
|
|
28135
|
+
return { rootDir, folder: COMPONENT_LIB_SUBPATH2, status: "ok", files };
|
|
27902
28136
|
}
|
|
27903
28137
|
async function readAppRootStatus(appDir) {
|
|
27904
28138
|
try {
|
|
27905
|
-
const stats = await
|
|
28139
|
+
const stats = await stat13(appDir);
|
|
27906
28140
|
return stats.isDirectory() ? "ok" : "dir-not-found";
|
|
27907
28141
|
} catch (err) {
|
|
27908
28142
|
const code14 = err.code;
|
|
@@ -27913,16 +28147,16 @@ async function readAppRootStatus(appDir) {
|
|
|
27913
28147
|
}
|
|
27914
28148
|
}
|
|
27915
28149
|
async function readAppWiring(appDir) {
|
|
27916
|
-
const rootConfigText = await readFileIfExists(
|
|
27917
|
-
const assetsDir =
|
|
27918
|
-
const assetsDirExists = await
|
|
28150
|
+
const rootConfigText = await readFileIfExists(join17(appDir, APP_ROOT_CONFIG_RELPATH));
|
|
28151
|
+
const assetsDir = join17(appDir, APP_ASSETS_SUBPATH);
|
|
28152
|
+
const assetsDirExists = await isDirectory3(assetsDir);
|
|
27919
28153
|
const assetFiles = assetsDirExists ? await collectFilesUnder(assetsDir) : /* @__PURE__ */ new Set();
|
|
27920
28154
|
const result = { rootConfigText, assetFiles };
|
|
27921
28155
|
return result;
|
|
27922
28156
|
}
|
|
27923
|
-
async function
|
|
28157
|
+
async function isDirectory3(absPath) {
|
|
27924
28158
|
try {
|
|
27925
|
-
const stats = await
|
|
28159
|
+
const stats = await stat13(absPath);
|
|
27926
28160
|
return stats.isDirectory();
|
|
27927
28161
|
} catch {
|
|
27928
28162
|
return false;
|
|
@@ -27930,7 +28164,7 @@ async function isDirectory2(absPath) {
|
|
|
27930
28164
|
}
|
|
27931
28165
|
async function readFileIfExists(absPath) {
|
|
27932
28166
|
try {
|
|
27933
|
-
return await
|
|
28167
|
+
return await readFile17(absPath, "utf8");
|
|
27934
28168
|
} catch (err) {
|
|
27935
28169
|
const code14 = err.code;
|
|
27936
28170
|
if (code14 === "ENOENT" || code14 === "ENOTDIR" || code14 === "EISDIR") {
|
|
@@ -27951,13 +28185,13 @@ async function collectFilesUnder(absRoot) {
|
|
|
27951
28185
|
continue;
|
|
27952
28186
|
}
|
|
27953
28187
|
for (const entry of entries) {
|
|
27954
|
-
const full =
|
|
28188
|
+
const full = join17(current, entry.name);
|
|
27955
28189
|
if (entry.isDirectory()) {
|
|
27956
28190
|
stack.push(full);
|
|
27957
28191
|
continue;
|
|
27958
28192
|
}
|
|
27959
28193
|
if (!entry.isFile()) continue;
|
|
27960
|
-
const rel =
|
|
28194
|
+
const rel = relative10(absRoot, full).split(sep11).join("/");
|
|
27961
28195
|
out.add(rel);
|
|
27962
28196
|
}
|
|
27963
28197
|
}
|
|
@@ -29476,8 +29710,8 @@ var actionScaffoldTool = {
|
|
|
29476
29710
|
import { type as type54 } from "arktype";
|
|
29477
29711
|
|
|
29478
29712
|
// packages/dbx-components-mcp/src/tools/route/load-sources.ts
|
|
29479
|
-
import { glob as fsGlob5, readFile as
|
|
29480
|
-
import { dirname as
|
|
29713
|
+
import { glob as fsGlob5, readFile as readFile18, stat as stat14 } from "node:fs/promises";
|
|
29714
|
+
import { dirname as dirname13, isAbsolute as isAbsolute13, resolve as resolve34, sep as sep12 } from "node:path";
|
|
29481
29715
|
|
|
29482
29716
|
// packages/dbx-components-mcp/src/tools/route/extract.ts
|
|
29483
29717
|
import { Node as Node21, Project as Project15, SyntaxKind as SyntaxKind12 } from "ts-morph";
|
|
@@ -29792,7 +30026,7 @@ function computeRelativeSpecifiers(source) {
|
|
|
29792
30026
|
// packages/dbx-components-mcp/src/tools/route/load-sources.ts
|
|
29793
30027
|
var TRY_EXTENSIONS = [".ts", ".tsx", "/index.ts", "/index.tsx"];
|
|
29794
30028
|
async function loadRouteSources(args) {
|
|
29795
|
-
const cwdResolved = args.cwd ?
|
|
30029
|
+
const cwdResolved = args.cwd ? resolve34(process.cwd(), args.cwd) : process.cwd();
|
|
29796
30030
|
guardCwdInsideServer(args.cwd, cwdResolved);
|
|
29797
30031
|
const collected = /* @__PURE__ */ new Map();
|
|
29798
30032
|
if (args.sources) {
|
|
@@ -29803,8 +30037,8 @@ async function loadRouteSources(args) {
|
|
|
29803
30037
|
}
|
|
29804
30038
|
}
|
|
29805
30039
|
const initialPaths = await collectInitialPaths(args, cwdResolved);
|
|
29806
|
-
for (const
|
|
29807
|
-
await loadOne(
|
|
30040
|
+
for (const relative15 of initialPaths) {
|
|
30041
|
+
await loadOne(relative15, cwdResolved, collected);
|
|
29808
30042
|
}
|
|
29809
30043
|
if (args.walkImports) {
|
|
29810
30044
|
await walkRelativeImports(collected, cwdResolved);
|
|
@@ -29820,7 +30054,7 @@ function guardCwdInsideServer(requestedCwd, resolvedCwd) {
|
|
|
29820
30054
|
return;
|
|
29821
30055
|
}
|
|
29822
30056
|
const serverCwd = process.cwd();
|
|
29823
|
-
const cwdPrefix = serverCwd.endsWith(
|
|
30057
|
+
const cwdPrefix = serverCwd.endsWith(sep12) ? serverCwd : serverCwd + sep12;
|
|
29824
30058
|
if (!resolvedCwd.startsWith(cwdPrefix) && resolvedCwd !== serverCwd) {
|
|
29825
30059
|
throw new Error(`cwd \`${requestedCwd}\` resolves outside the server cwd and is not allowed.`);
|
|
29826
30060
|
}
|
|
@@ -29860,26 +30094,26 @@ async function walkRelativeImports(collected, cwdResolved) {
|
|
|
29860
30094
|
}
|
|
29861
30095
|
}
|
|
29862
30096
|
}
|
|
29863
|
-
async function loadOne(
|
|
29864
|
-
if (into.has(
|
|
30097
|
+
async function loadOne(relative15, cwd, into) {
|
|
30098
|
+
if (into.has(relative15)) {
|
|
29865
30099
|
return;
|
|
29866
30100
|
}
|
|
29867
|
-
const absolute =
|
|
29868
|
-
const cwdPrefix = cwd.endsWith(
|
|
30101
|
+
const absolute = resolve34(cwd, relative15);
|
|
30102
|
+
const cwdPrefix = cwd.endsWith(sep12) ? cwd : cwd + sep12;
|
|
29869
30103
|
if (!absolute.startsWith(cwdPrefix) && absolute !== cwd) {
|
|
29870
|
-
throw new Error(`Path \`${
|
|
30104
|
+
throw new Error(`Path \`${relative15}\` resolves outside the server cwd and is not allowed.`);
|
|
29871
30105
|
}
|
|
29872
|
-
const text = await
|
|
29873
|
-
into.set(
|
|
30106
|
+
const text = await readFile18(absolute, "utf8");
|
|
30107
|
+
into.set(relative15, { name: relative15, text });
|
|
29874
30108
|
}
|
|
29875
30109
|
async function resolveRelativeImport(fromFile, specifier, cwd) {
|
|
29876
30110
|
if (!specifier.startsWith(".")) {
|
|
29877
30111
|
return void 0;
|
|
29878
30112
|
}
|
|
29879
|
-
const fromAbsolute =
|
|
29880
|
-
const fromDir =
|
|
29881
|
-
const baseAbsolute =
|
|
29882
|
-
const cwdPrefix = cwd.endsWith(
|
|
30113
|
+
const fromAbsolute = isAbsolute13(fromFile) ? fromFile : resolve34(cwd, fromFile);
|
|
30114
|
+
const fromDir = dirname13(fromAbsolute);
|
|
30115
|
+
const baseAbsolute = resolve34(fromDir, specifier);
|
|
30116
|
+
const cwdPrefix = cwd.endsWith(sep12) ? cwd : cwd + sep12;
|
|
29883
30117
|
for (const ext of TRY_EXTENSIONS) {
|
|
29884
30118
|
const candidateAbsolute = baseAbsolute + ext;
|
|
29885
30119
|
if (!candidateAbsolute.startsWith(cwdPrefix) && candidateAbsolute !== cwd) {
|
|
@@ -29889,7 +30123,7 @@ async function resolveRelativeImport(fromFile, specifier, cwd) {
|
|
|
29889
30123
|
if (!exists) {
|
|
29890
30124
|
continue;
|
|
29891
30125
|
}
|
|
29892
|
-
const text = await
|
|
30126
|
+
const text = await readFile18(candidateAbsolute, "utf8");
|
|
29893
30127
|
const relativeName = candidateAbsolute.startsWith(cwdPrefix) ? candidateAbsolute.slice(cwdPrefix.length) : candidateAbsolute;
|
|
29894
30128
|
const result = { name: relativeName, text };
|
|
29895
30129
|
return result;
|
|
@@ -29898,7 +30132,7 @@ async function resolveRelativeImport(fromFile, specifier, cwd) {
|
|
|
29898
30132
|
}
|
|
29899
30133
|
async function fileExists(path) {
|
|
29900
30134
|
try {
|
|
29901
|
-
const info = await
|
|
30135
|
+
const info = await stat14(path);
|
|
29902
30136
|
return info.isFile();
|
|
29903
30137
|
} catch {
|
|
29904
30138
|
return false;
|
|
@@ -30966,7 +31200,7 @@ function renderPresetConstants(args) {
|
|
|
30966
31200
|
const modelCamel = camelCase4(args.modelName);
|
|
30967
31201
|
for (const key of args.presetKeys) {
|
|
30968
31202
|
const constName = presetConstName(modelCamel, key);
|
|
30969
|
-
lines.push(`export const ${constName}: ClickableFilterPreset<${args.filterType}> = {`, ` preset: '${key}',`, ` title: '${
|
|
31203
|
+
lines.push(`export const ${constName}: ClickableFilterPreset<${args.filterType}> = {`, ` preset: '${key}',`, ` title: '${capitalize4(key)}',`, ` presetValue: { preset: '${key}' }`, `};`, "");
|
|
30970
31204
|
}
|
|
30971
31205
|
const arrayName = `${modelCamel}FilterPresets`;
|
|
30972
31206
|
const elements = args.presetKeys.map((k) => presetConstName(modelCamel, k)).join(", ");
|
|
@@ -31015,7 +31249,7 @@ function renderImports(args) {
|
|
|
31015
31249
|
}
|
|
31016
31250
|
return imports;
|
|
31017
31251
|
}
|
|
31018
|
-
function
|
|
31252
|
+
function capitalize4(value) {
|
|
31019
31253
|
if (value.length === 0) {
|
|
31020
31254
|
return value;
|
|
31021
31255
|
}
|
|
@@ -31806,8 +32040,8 @@ function createSearchModelSnapshotFieldTool(config) {
|
|
|
31806
32040
|
}
|
|
31807
32041
|
|
|
31808
32042
|
// packages/dbx-components-mcp/src/tools/list-app-model-snapshot-fields.tool.ts
|
|
31809
|
-
import { glob, readFile as
|
|
31810
|
-
import { resolve as
|
|
32043
|
+
import { glob, readFile as readFile19 } from "node:fs/promises";
|
|
32044
|
+
import { resolve as resolve35 } from "node:path";
|
|
31811
32045
|
import { type as type59 } from "arktype";
|
|
31812
32046
|
import { Node as Node22, Project as Project16 } from "ts-morph";
|
|
31813
32047
|
var ListAppArgsType2 = type59({
|
|
@@ -31856,8 +32090,8 @@ function createListAppModelSnapshotFieldsTool(input) {
|
|
|
31856
32090
|
} catch (err) {
|
|
31857
32091
|
return toolError(err instanceof Error ? err.message : String(err));
|
|
31858
32092
|
}
|
|
31859
|
-
const componentAbs =
|
|
31860
|
-
const apiAbs = parsed.apiDir === void 0 ? void 0 :
|
|
32093
|
+
const componentAbs = resolve35(cwd, parsed.componentDir);
|
|
32094
|
+
const apiAbs = parsed.apiDir === void 0 ? void 0 : resolve35(cwd, parsed.apiDir);
|
|
31861
32095
|
let report;
|
|
31862
32096
|
try {
|
|
31863
32097
|
report = await buildListAppReport({
|
|
@@ -31896,15 +32130,15 @@ async function buildListAppReport(input) {
|
|
|
31896
32130
|
const project = new Project16({ useInMemoryFileSystem: true, skipAddingFilesFromTsConfig: true });
|
|
31897
32131
|
const componentFiles = await collectFiles(componentAbs, COMPONENT_MODEL_GLOBS);
|
|
31898
32132
|
for (const rel of componentFiles) {
|
|
31899
|
-
const abs =
|
|
31900
|
-
const text = await
|
|
32133
|
+
const abs = resolve35(componentAbs, rel);
|
|
32134
|
+
const text = await readFile19(abs, "utf-8");
|
|
31901
32135
|
project.createSourceFile(`/component/${rel}`, text, { overwrite: true });
|
|
31902
32136
|
}
|
|
31903
32137
|
if (apiAbs !== void 0) {
|
|
31904
32138
|
const apiFiles = await collectFiles(apiAbs, API_MODEL_GLOBS);
|
|
31905
32139
|
for (const rel of apiFiles) {
|
|
31906
|
-
const abs =
|
|
31907
|
-
const text = await
|
|
32140
|
+
const abs = resolve35(apiAbs, rel);
|
|
32141
|
+
const text = await readFile19(abs, "utf-8");
|
|
31908
32142
|
project.createSourceFile(`/api/${rel}`, text, { overwrite: true });
|
|
31909
32143
|
}
|
|
31910
32144
|
}
|
|
@@ -32084,7 +32318,7 @@ function truncate(text, max) {
|
|
|
32084
32318
|
|
|
32085
32319
|
// packages/dbx-components-mcp/src/tools/artifact-scaffold.tool.ts
|
|
32086
32320
|
import { access } from "node:fs/promises";
|
|
32087
|
-
import { resolve as
|
|
32321
|
+
import { resolve as resolve36, sep as sep13 } from "node:path";
|
|
32088
32322
|
import { type as type60 } from "arktype";
|
|
32089
32323
|
|
|
32090
32324
|
// packages/dbx-components-mcp/src/tools/artifact-scaffold/templates.ts
|
|
@@ -32660,8 +32894,8 @@ function parseArgs8(raw) {
|
|
|
32660
32894
|
return result;
|
|
32661
32895
|
}
|
|
32662
32896
|
function ensureInsideCwd(relativePath, cwd) {
|
|
32663
|
-
const absolute =
|
|
32664
|
-
const cwdPrefix = cwd.endsWith(
|
|
32897
|
+
const absolute = resolve36(cwd, relativePath);
|
|
32898
|
+
const cwdPrefix = cwd.endsWith(sep13) ? cwd : cwd + sep13;
|
|
32665
32899
|
if (!absolute.startsWith(cwdPrefix) && absolute !== cwd) {
|
|
32666
32900
|
throw new Error(`Path \`${relativePath}\` resolves outside the server cwd and is not allowed.`);
|
|
32667
32901
|
}
|
|
@@ -32700,7 +32934,7 @@ async function runArtifactScaffold(rawArgs) {
|
|
|
32700
32934
|
const message = err instanceof Error ? err.message : String(err);
|
|
32701
32935
|
return toolError(`Scaffold failed: ${message}`);
|
|
32702
32936
|
}
|
|
32703
|
-
const checked = await applyIdempotency(raw, (relativePath) => fileExists2(
|
|
32937
|
+
const checked = await applyIdempotency(raw, (relativePath) => fileExists2(resolve36(cwd, relativePath)));
|
|
32704
32938
|
const text = formatResult11(checked);
|
|
32705
32939
|
const result = {
|
|
32706
32940
|
content: [{ type: "text", text }]
|
|
@@ -33245,8 +33479,8 @@ async function run10(rawArgs) {
|
|
|
33245
33479
|
var explainRuleTool = { definition: TOOL11, run: run10 };
|
|
33246
33480
|
|
|
33247
33481
|
// packages/dbx-components-mcp/src/tools/app-validate.tool.ts
|
|
33248
|
-
import { resolve as
|
|
33249
|
-
import { readdir as readdir11, stat as
|
|
33482
|
+
import { resolve as resolve37, join as join18 } from "node:path";
|
|
33483
|
+
import { readdir as readdir11, stat as stat15 } from "node:fs/promises";
|
|
33250
33484
|
import { type as type63 } from "arktype";
|
|
33251
33485
|
var Cluster = "'storagefile_m' | 'notification_m' | 'model_folder' | 'system_m' | 'fixture'";
|
|
33252
33486
|
var AppValidateArgsType = type63({
|
|
@@ -33299,8 +33533,8 @@ async function run11(rawArgs) {
|
|
|
33299
33533
|
} catch (err) {
|
|
33300
33534
|
return toolError(err instanceof Error ? err.message : String(err));
|
|
33301
33535
|
}
|
|
33302
|
-
const componentAbs =
|
|
33303
|
-
const apiAbs =
|
|
33536
|
+
const componentAbs = resolve37(cwd, parsed.componentDir);
|
|
33537
|
+
const apiAbs = resolve37(cwd, parsed.apiDir);
|
|
33304
33538
|
const skip = new Set(parsed.skip ?? []);
|
|
33305
33539
|
const findings = [];
|
|
33306
33540
|
const skipped = [];
|
|
@@ -33372,7 +33606,7 @@ async function runModelFolders(ctx) {
|
|
|
33372
33606
|
return;
|
|
33373
33607
|
}
|
|
33374
33608
|
try {
|
|
33375
|
-
const modelRoot =
|
|
33609
|
+
const modelRoot = join18(ctx.componentAbs, "src/lib/model");
|
|
33376
33610
|
const reservedNames = new Set(RESERVED_MODEL_FOLDERS.map((r) => r.name));
|
|
33377
33611
|
let entries;
|
|
33378
33612
|
try {
|
|
@@ -33389,7 +33623,7 @@ async function runModelFolders(ctx) {
|
|
|
33389
33623
|
for (const entry of entries) {
|
|
33390
33624
|
if (!entry.isDirectory()) continue;
|
|
33391
33625
|
if (reservedNames.has(entry.name)) continue;
|
|
33392
|
-
const inspection = await inspectFolder(
|
|
33626
|
+
const inspection = await inspectFolder(join18(modelRoot, entry.name));
|
|
33393
33627
|
inspections.push(inspection);
|
|
33394
33628
|
}
|
|
33395
33629
|
if (inspections.length === 0) {
|
|
@@ -33409,11 +33643,11 @@ async function runSystemFolder(ctx) {
|
|
|
33409
33643
|
ctx.skipped.push("system_m");
|
|
33410
33644
|
return;
|
|
33411
33645
|
}
|
|
33412
|
-
const systemPath =
|
|
33646
|
+
const systemPath = join18(ctx.componentAbs, "src/lib/model/system");
|
|
33413
33647
|
try {
|
|
33414
33648
|
let exists = true;
|
|
33415
33649
|
try {
|
|
33416
|
-
const stats = await
|
|
33650
|
+
const stats = await stat15(systemPath);
|
|
33417
33651
|
if (!stats.isDirectory()) exists = false;
|
|
33418
33652
|
} catch (err) {
|
|
33419
33653
|
const code14 = err.code;
|
|
@@ -33494,18 +33728,18 @@ function formatJson(report) {
|
|
|
33494
33728
|
var appValidateTool = { definition: TOOL12, run: run11 };
|
|
33495
33729
|
|
|
33496
33730
|
// packages/dbx-components-mcp/src/tools/model-list-component.tool.ts
|
|
33497
|
-
import { resolve as
|
|
33731
|
+
import { resolve as resolve38 } from "node:path";
|
|
33498
33732
|
import { type as type64 } from "arktype";
|
|
33499
33733
|
|
|
33500
33734
|
// packages/dbx-components-mcp/src/tools/model-list-component/extract.ts
|
|
33501
|
-
import { readdir as readdir12, readFile as
|
|
33502
|
-
import { basename as basename6, join as
|
|
33735
|
+
import { readdir as readdir12, readFile as readFile20, stat as stat16 } from "node:fs/promises";
|
|
33736
|
+
import { basename as basename6, join as join19, relative as relative11, sep as sep14 } from "node:path";
|
|
33503
33737
|
import { Node as Node23, Project as Project17 } from "ts-morph";
|
|
33504
33738
|
var MODEL_SUBPATH3 = "src/lib/model";
|
|
33505
33739
|
var MODEL_SUBPATH_PREFIX = `${MODEL_SUBPATH3}/`;
|
|
33506
33740
|
var RESERVED_NAMES = RESERVED_MODEL_FOLDERS.map((r) => r.name);
|
|
33507
33741
|
async function extractComponentModels(componentAbs) {
|
|
33508
|
-
const modelRoot =
|
|
33742
|
+
const modelRoot = join19(componentAbs, MODEL_SUBPATH3);
|
|
33509
33743
|
const folders = await listFolders(modelRoot);
|
|
33510
33744
|
if (folders === void 0) {
|
|
33511
33745
|
const result2 = { modelRoot, models: [], skipped: [], unidentifiedFolders: [] };
|
|
@@ -33595,13 +33829,13 @@ function projectRich(model, folder) {
|
|
|
33595
33829
|
}
|
|
33596
33830
|
async function fallbackForFolder(input) {
|
|
33597
33831
|
const { modelRoot, componentAbs, folder, project } = input;
|
|
33598
|
-
const folderAbs =
|
|
33832
|
+
const folderAbs = join19(modelRoot, folder);
|
|
33599
33833
|
const mainFile = await readMainFile(folderAbs, folder);
|
|
33600
33834
|
if (mainFile === void 0) return void 0;
|
|
33601
33835
|
const sourceFile = project.createSourceFile(mainFile.fileName, mainFile.text, { overwrite: true });
|
|
33602
33836
|
const identity = findIdentityIn(sourceFile);
|
|
33603
33837
|
if (!identity) return void 0;
|
|
33604
|
-
const sourceFileRel =
|
|
33838
|
+
const sourceFileRel = relative11(componentAbs, mainFile.absPath).split(sep14).join("/");
|
|
33605
33839
|
return {
|
|
33606
33840
|
folder,
|
|
33607
33841
|
modelName: deriveModelName(identity.constName, folder),
|
|
@@ -33615,7 +33849,7 @@ async function fallbackForFolder(input) {
|
|
|
33615
33849
|
}
|
|
33616
33850
|
async function listFolders(modelRoot) {
|
|
33617
33851
|
try {
|
|
33618
|
-
const stats = await
|
|
33852
|
+
const stats = await stat16(modelRoot);
|
|
33619
33853
|
if (!stats.isDirectory()) return void 0;
|
|
33620
33854
|
} catch {
|
|
33621
33855
|
return void 0;
|
|
@@ -33629,9 +33863,9 @@ async function listFolders(modelRoot) {
|
|
|
33629
33863
|
return out;
|
|
33630
33864
|
}
|
|
33631
33865
|
async function readMainFile(folderAbs, folder) {
|
|
33632
|
-
const candidate =
|
|
33866
|
+
const candidate = join19(folderAbs, `${folder}.ts`);
|
|
33633
33867
|
try {
|
|
33634
|
-
const text = await
|
|
33868
|
+
const text = await readFile20(candidate, "utf8");
|
|
33635
33869
|
return { absPath: candidate, fileName: basename6(candidate), text };
|
|
33636
33870
|
} catch {
|
|
33637
33871
|
return void 0;
|
|
@@ -33808,8 +34042,8 @@ async function run12(rawArgs) {
|
|
|
33808
34042
|
} catch (err) {
|
|
33809
34043
|
return toolError(err instanceof Error ? err.message : String(err));
|
|
33810
34044
|
}
|
|
33811
|
-
const componentAbs =
|
|
33812
|
-
const apiAbs = parsed.apiDir ?
|
|
34045
|
+
const componentAbs = resolve38(cwd, parsed.componentDir);
|
|
34046
|
+
const apiAbs = parsed.apiDir ? resolve38(cwd, parsed.apiDir) : void 0;
|
|
33813
34047
|
let report;
|
|
33814
34048
|
try {
|
|
33815
34049
|
report = await listComponentModels(componentAbs, { componentDir: parsed.componentDir, apiDir: parsed.apiDir, apiAbs });
|
|
@@ -33823,18 +34057,18 @@ async function run12(rawArgs) {
|
|
|
33823
34057
|
var modelListComponentTool = { definition: TOOL13, run: run12 };
|
|
33824
34058
|
|
|
33825
34059
|
// packages/dbx-components-mcp/src/tools/server-actions-list-app.tool.ts
|
|
33826
|
-
import { resolve as
|
|
34060
|
+
import { resolve as resolve39 } from "node:path";
|
|
33827
34061
|
import { type as type65 } from "arktype";
|
|
33828
34062
|
|
|
33829
34063
|
// packages/dbx-components-mcp/src/tools/server-actions-list-app/extract.ts
|
|
33830
|
-
import { readdir as readdir13, readFile as
|
|
33831
|
-
import { dirname as
|
|
34064
|
+
import { readdir as readdir13, readFile as readFile21, stat as stat17 } from "node:fs/promises";
|
|
34065
|
+
import { dirname as dirname14, join as join20, relative as relative12, sep as sep15 } from "node:path";
|
|
33832
34066
|
import { Node as Node24, Project as Project18 } from "ts-morph";
|
|
33833
34067
|
var ACTION_SERVER_SUFFIX2 = ".action.server.ts";
|
|
33834
34068
|
var COMMON_MODEL_SUBPATH2 = "src/app/common/model";
|
|
33835
34069
|
var COMMON_BARREL_REL = "src/app/common/index.ts";
|
|
33836
34070
|
async function extractServerActions(apiAbs, apiRel) {
|
|
33837
|
-
const modelRoot =
|
|
34071
|
+
const modelRoot = join20(apiAbs, COMMON_MODEL_SUBPATH2);
|
|
33838
34072
|
const actionFiles = await collectActionFiles2(modelRoot);
|
|
33839
34073
|
if (actionFiles.length === 0) {
|
|
33840
34074
|
return { modelRoot, entries: [], fixtureStatus: "ok" };
|
|
@@ -33854,14 +34088,14 @@ async function extractServerActions(apiAbs, apiRel) {
|
|
|
33854
34088
|
}
|
|
33855
34089
|
const entries = [];
|
|
33856
34090
|
for (const filePath of actionFiles) {
|
|
33857
|
-
const text = await
|
|
34091
|
+
const text = await readFile21(filePath, "utf8");
|
|
33858
34092
|
const sourceFile = project.createSourceFile(filePath, text, { overwrite: true });
|
|
33859
34093
|
const classes = findServerActionClasses(sourceFile);
|
|
33860
34094
|
for (const className of classes) {
|
|
33861
34095
|
const wiring = await inspectSiblingModule(filePath, className);
|
|
33862
34096
|
const expectedGetterName = camelize(className);
|
|
33863
34097
|
const fixtureCoverage = fixtureStatus === "ok" ? fixtureCoverageMap.get(expectedGetterName) ?? unmatchedFixtureCoverage(expectedGetterName) : void 0;
|
|
33864
|
-
const sourceFileRel =
|
|
34098
|
+
const sourceFileRel = relative12(apiAbs, filePath).split(sep15).join("/");
|
|
33865
34099
|
entries.push({
|
|
33866
34100
|
className,
|
|
33867
34101
|
sourceFile: sourceFileRel,
|
|
@@ -33879,7 +34113,7 @@ async function collectActionFiles2(root) {
|
|
|
33879
34113
|
const out = [];
|
|
33880
34114
|
const stack = [];
|
|
33881
34115
|
try {
|
|
33882
|
-
const stats = await
|
|
34116
|
+
const stats = await stat17(root);
|
|
33883
34117
|
if (!stats.isDirectory()) return out;
|
|
33884
34118
|
stack.push(root);
|
|
33885
34119
|
} catch {
|
|
@@ -33894,7 +34128,7 @@ async function collectActionFiles2(root) {
|
|
|
33894
34128
|
continue;
|
|
33895
34129
|
}
|
|
33896
34130
|
for (const entry of entries) {
|
|
33897
|
-
const full =
|
|
34131
|
+
const full = join20(current, entry.name);
|
|
33898
34132
|
if (entry.isDirectory()) {
|
|
33899
34133
|
stack.push(full);
|
|
33900
34134
|
continue;
|
|
@@ -33936,14 +34170,14 @@ async function inspectSiblingModule(actionFilePath, className) {
|
|
|
33936
34170
|
return { modulePath: moduleCandidates[0], providedByModule: false, exportedByModule: false };
|
|
33937
34171
|
}
|
|
33938
34172
|
async function findModuleCandidates(actionFilePath) {
|
|
33939
|
-
const dir =
|
|
34173
|
+
const dir = dirname14(actionFilePath);
|
|
33940
34174
|
const out = [];
|
|
33941
34175
|
try {
|
|
33942
34176
|
const entries = await readdir13(dir, { withFileTypes: true });
|
|
33943
34177
|
for (const entry of entries) {
|
|
33944
34178
|
if (!entry.isFile()) continue;
|
|
33945
34179
|
if (!entry.name.endsWith(".module.ts")) continue;
|
|
33946
|
-
out.push(
|
|
34180
|
+
out.push(join20(dir, entry.name));
|
|
33947
34181
|
}
|
|
33948
34182
|
} catch {
|
|
33949
34183
|
}
|
|
@@ -33952,7 +34186,7 @@ async function findModuleCandidates(actionFilePath) {
|
|
|
33952
34186
|
}
|
|
33953
34187
|
async function safeRead(path) {
|
|
33954
34188
|
try {
|
|
33955
|
-
return await
|
|
34189
|
+
return await readFile21(path, "utf8");
|
|
33956
34190
|
} catch {
|
|
33957
34191
|
return void 0;
|
|
33958
34192
|
}
|
|
@@ -33992,7 +34226,7 @@ function moduleArrayContains(decoratorArg, propertyName, className) {
|
|
|
33992
34226
|
return false;
|
|
33993
34227
|
}
|
|
33994
34228
|
async function readCommonBarrelExports(apiAbs) {
|
|
33995
|
-
const path =
|
|
34229
|
+
const path = join20(apiAbs, COMMON_BARREL_REL);
|
|
33996
34230
|
const text = await safeRead(path);
|
|
33997
34231
|
if (text === void 0) return /* @__PURE__ */ new Set();
|
|
33998
34232
|
const project = new Project18({ useInMemoryFileSystem: true });
|
|
@@ -34159,7 +34393,7 @@ async function run13(rawArgs) {
|
|
|
34159
34393
|
} catch (err) {
|
|
34160
34394
|
return toolError(err instanceof Error ? err.message : String(err));
|
|
34161
34395
|
}
|
|
34162
|
-
const apiAbs =
|
|
34396
|
+
const apiAbs = resolve39(cwd, parsed.apiDir);
|
|
34163
34397
|
let report;
|
|
34164
34398
|
try {
|
|
34165
34399
|
report = await listAppServerActions(apiAbs, { apiDir: parsed.apiDir });
|
|
@@ -34174,15 +34408,15 @@ var serverActionsListAppTool = { definition: TOOL14, run: run13 };
|
|
|
34174
34408
|
|
|
34175
34409
|
// packages/dbx-components-mcp/src/tools/mcp-config.tool.ts
|
|
34176
34410
|
import { type as type72 } from "arktype";
|
|
34177
|
-
import { resolve as
|
|
34411
|
+
import { resolve as resolve46 } from "node:path";
|
|
34178
34412
|
|
|
34179
34413
|
// packages/dbx-components-mcp/src/tools/mcp-config/snapshot.ts
|
|
34180
|
-
import { dirname as
|
|
34181
|
-
import { stat as
|
|
34414
|
+
import { dirname as dirname15, isAbsolute as isAbsolute14, relative as relative13, resolve as resolve41 } from "node:path";
|
|
34415
|
+
import { stat as stat19 } from "node:fs/promises";
|
|
34182
34416
|
|
|
34183
34417
|
// packages/dbx-components-mcp/src/scan/discover-downstream-packages.ts
|
|
34184
|
-
import { glob as fsGlob6, readFile as
|
|
34185
|
-
import { basename as basename7, join as
|
|
34418
|
+
import { glob as fsGlob6, readFile as readFile22, stat as stat18 } from "node:fs/promises";
|
|
34419
|
+
import { basename as basename7, join as join21, resolve as resolve40, sep as sep16 } from "node:path";
|
|
34186
34420
|
var COMPONENT_GLOBS = ["components/*-firebase", "components/*-shared", "components/*-web", "components/*-core"];
|
|
34187
34421
|
var APPS_GLOB = "apps/*";
|
|
34188
34422
|
var SCAN_CONFIG_FILENAME2 = "dbx-mcp.scan.json";
|
|
@@ -34207,12 +34441,12 @@ async function discoverConventionalDirs(workspaceRoot) {
|
|
|
34207
34441
|
const found = /* @__PURE__ */ new Set();
|
|
34208
34442
|
for (const pattern of COMPONENT_GLOBS) {
|
|
34209
34443
|
for await (const match of fsGlob6(pattern, { cwd: workspaceRoot })) {
|
|
34210
|
-
found.add(match.split(
|
|
34444
|
+
found.add(match.split(sep16).join("/"));
|
|
34211
34445
|
}
|
|
34212
34446
|
}
|
|
34213
34447
|
for await (const match of fsGlob6(APPS_GLOB, { cwd: workspaceRoot })) {
|
|
34214
|
-
const rel = match.split(
|
|
34215
|
-
if (await fileExists3(
|
|
34448
|
+
const rel = match.split(sep16).join("/");
|
|
34449
|
+
if (await fileExists3(join21(workspaceRoot, rel, SCAN_CONFIG_FILENAME2))) {
|
|
34216
34450
|
found.add(rel);
|
|
34217
34451
|
}
|
|
34218
34452
|
}
|
|
@@ -34221,19 +34455,19 @@ async function discoverConventionalDirs(workspaceRoot) {
|
|
|
34221
34455
|
function normaliseExplicitDirs(dirs) {
|
|
34222
34456
|
const result = [];
|
|
34223
34457
|
for (const raw of dirs) {
|
|
34224
|
-
const trimmed = raw.split(
|
|
34458
|
+
const trimmed = raw.split(sep16).join("/").replace(/\/+$/, "");
|
|
34225
34459
|
if (trimmed.length > 0) result.push(trimmed);
|
|
34226
34460
|
}
|
|
34227
34461
|
return result;
|
|
34228
34462
|
}
|
|
34229
34463
|
async function inspectPackage2(workspaceRoot, relDir) {
|
|
34230
|
-
const absDir =
|
|
34231
|
-
const isDir = await
|
|
34464
|
+
const absDir = resolve40(workspaceRoot, relDir);
|
|
34465
|
+
const isDir = await isDirectory4(absDir);
|
|
34232
34466
|
if (!isDir) return void 0;
|
|
34233
34467
|
const packageName = await readPackageName2(absDir, relDir);
|
|
34234
34468
|
const slug = packageNameToSlug(packageName);
|
|
34235
|
-
const hasScanConfig = await fileExists3(
|
|
34236
|
-
const declaredScanClusters = hasScanConfig ? await readDeclaredClusters(
|
|
34469
|
+
const hasScanConfig = await fileExists3(join21(absDir, SCAN_CONFIG_FILENAME2));
|
|
34470
|
+
const declaredScanClusters = hasScanConfig ? await readDeclaredClusters(join21(absDir, SCAN_CONFIG_FILENAME2)) : [];
|
|
34237
34471
|
const heuristicClusters = await detectCandidateClusters(absDir);
|
|
34238
34472
|
const candidateClusters = mergeClusters(heuristicClusters, declaredScanClusters);
|
|
34239
34473
|
return {
|
|
@@ -34246,9 +34480,9 @@ async function inspectPackage2(workspaceRoot, relDir) {
|
|
|
34246
34480
|
declaredScanClusters
|
|
34247
34481
|
};
|
|
34248
34482
|
}
|
|
34249
|
-
async function
|
|
34483
|
+
async function isDirectory4(path) {
|
|
34250
34484
|
try {
|
|
34251
|
-
const stats = await
|
|
34485
|
+
const stats = await stat18(path);
|
|
34252
34486
|
return stats.isDirectory();
|
|
34253
34487
|
} catch {
|
|
34254
34488
|
return false;
|
|
@@ -34256,7 +34490,7 @@ async function isDirectory3(path) {
|
|
|
34256
34490
|
}
|
|
34257
34491
|
async function fileExists3(path) {
|
|
34258
34492
|
try {
|
|
34259
|
-
const stats = await
|
|
34493
|
+
const stats = await stat18(path);
|
|
34260
34494
|
return stats.isFile();
|
|
34261
34495
|
} catch {
|
|
34262
34496
|
return false;
|
|
@@ -34266,7 +34500,7 @@ async function readPackageName2(absDir, relDir) {
|
|
|
34266
34500
|
const fallback = basename7(relDir);
|
|
34267
34501
|
let result = fallback;
|
|
34268
34502
|
try {
|
|
34269
|
-
const text = await
|
|
34503
|
+
const text = await readFile22(join21(absDir, PACKAGE_JSON2), "utf8");
|
|
34270
34504
|
const parsed = JSON.parse(text);
|
|
34271
34505
|
if (typeof parsed.name === "string" && parsed.name.length > 0) {
|
|
34272
34506
|
result = parsed.name;
|
|
@@ -34281,7 +34515,7 @@ function packageNameToSlug(packageName) {
|
|
|
34281
34515
|
async function readDeclaredClusters(scanConfigPath) {
|
|
34282
34516
|
let parsed = null;
|
|
34283
34517
|
try {
|
|
34284
|
-
const text = await
|
|
34518
|
+
const text = await readFile22(scanConfigPath, "utf8");
|
|
34285
34519
|
parsed = JSON.parse(text);
|
|
34286
34520
|
} catch {
|
|
34287
34521
|
parsed = null;
|
|
@@ -34309,7 +34543,7 @@ async function detectCandidateClusters(absDir) {
|
|
|
34309
34543
|
const found = /* @__PURE__ */ new Set();
|
|
34310
34544
|
try {
|
|
34311
34545
|
for await (const match of fsGlob6(SOURCE_GLOB, { cwd: absDir })) {
|
|
34312
|
-
const rel = match.split(
|
|
34546
|
+
const rel = match.split(sep16).join("/");
|
|
34313
34547
|
for (const h of FILE_HEURISTICS) {
|
|
34314
34548
|
if (!found.has(h.cluster) && h.matches(rel)) {
|
|
34315
34549
|
found.add(h.cluster);
|
|
@@ -34333,7 +34567,7 @@ function mergeClusters(...lists) {
|
|
|
34333
34567
|
async function buildSnapshot(input) {
|
|
34334
34568
|
const { workspaceRoot, explicitDirs } = input;
|
|
34335
34569
|
const configResult = await findAndLoadConfig({ cwd: workspaceRoot });
|
|
34336
|
-
const configBaseDir = configResult.configPath === null ? workspaceRoot :
|
|
34570
|
+
const configBaseDir = configResult.configPath === null ? workspaceRoot : dirname15(configResult.configPath);
|
|
34337
34571
|
const registeredSources = await collectRegisteredSources(configResult.config, configBaseDir, workspaceRoot);
|
|
34338
34572
|
const packages = await discoverDownstreamPackages({ workspaceRoot, explicitDirs });
|
|
34339
34573
|
const packageSnapshots = packages.map((pkg) => ({
|
|
@@ -34355,7 +34589,7 @@ async function collectRegisteredSources(config, configBaseDir, workspaceRoot) {
|
|
|
34355
34589
|
for (const cluster of DOWNSTREAM_CLUSTERS) {
|
|
34356
34590
|
const declared = config[cluster]?.sources ?? [];
|
|
34357
34591
|
for (const declaredPath of declared) {
|
|
34358
|
-
const absolutePath =
|
|
34592
|
+
const absolutePath = isAbsolute14(declaredPath) ? declaredPath : resolve41(configBaseDir, declaredPath);
|
|
34359
34593
|
const exists = await fileExists4(absolutePath);
|
|
34360
34594
|
const relativePath = relativeOrAbsolute(workspaceRoot, absolutePath);
|
|
34361
34595
|
out.push({ cluster, declaredPath, absolutePath, relativePath, exists });
|
|
@@ -34378,14 +34612,14 @@ function clustersRegisteredInPackage(pkg, sources) {
|
|
|
34378
34612
|
}
|
|
34379
34613
|
async function fileExists4(path) {
|
|
34380
34614
|
try {
|
|
34381
|
-
const stats = await
|
|
34615
|
+
const stats = await stat19(path);
|
|
34382
34616
|
return stats.isFile();
|
|
34383
34617
|
} catch {
|
|
34384
34618
|
return false;
|
|
34385
34619
|
}
|
|
34386
34620
|
}
|
|
34387
34621
|
function relativeOrAbsolute(from, target) {
|
|
34388
|
-
const rel =
|
|
34622
|
+
const rel = relative13(from, target);
|
|
34389
34623
|
if (rel.length === 0) return ".";
|
|
34390
34624
|
if (rel.startsWith("..")) return target;
|
|
34391
34625
|
return rel.split("\\").join("/");
|
|
@@ -34393,7 +34627,7 @@ function relativeOrAbsolute(from, target) {
|
|
|
34393
34627
|
|
|
34394
34628
|
// packages/dbx-components-mcp/src/tools/mcp-config/init.ts
|
|
34395
34629
|
import { writeFile as nodeWriteFile3, mkdir as nodeMkdir, readFile as nodeReadFile7 } from "node:fs/promises";
|
|
34396
|
-
import { dirname as
|
|
34630
|
+
import { dirname as dirname16, relative as relative14, resolve as resolve42 } from "node:path";
|
|
34397
34631
|
var HEURISTIC_CLUSTERS = ["uiComponents", "forgeFields", "pipes", "actions", "filters"];
|
|
34398
34632
|
var CLUSTER_FILENAME_SEGMENT = {
|
|
34399
34633
|
semanticTypes: "semantic",
|
|
@@ -34415,15 +34649,15 @@ var DEFAULT_INCLUDE = ["src/**/*.ts"];
|
|
|
34415
34649
|
var DEFAULT_EXCLUDE = ["**/*.spec.ts", "**/*.test.ts", "**/*.stories.ts"];
|
|
34416
34650
|
async function buildInitPlan(input) {
|
|
34417
34651
|
const { snapshot } = input;
|
|
34418
|
-
const
|
|
34652
|
+
const readFile23 = input.readFile ?? defaultReadFile2;
|
|
34419
34653
|
const changes = [];
|
|
34420
34654
|
const sourcesToRegister = [];
|
|
34421
34655
|
for (const ps of snapshot.packages) {
|
|
34422
|
-
const planResult = await planPackageScanConfig({ snapshot, packageSnapshot: ps, readFile:
|
|
34656
|
+
const planResult = await planPackageScanConfig({ snapshot, packageSnapshot: ps, readFile: readFile23 });
|
|
34423
34657
|
if (planResult.change !== void 0) changes.push(planResult.change);
|
|
34424
34658
|
for (const reg of planResult.sourcesToRegister) sourcesToRegister.push(reg);
|
|
34425
34659
|
}
|
|
34426
|
-
const configChange = await planRootConfig({ snapshot, sourcesToRegister, readFile:
|
|
34660
|
+
const configChange = await planRootConfig({ snapshot, sourcesToRegister, readFile: readFile23 });
|
|
34427
34661
|
if (configChange !== void 0) changes.push(configChange);
|
|
34428
34662
|
return { workspaceRoot: snapshot.workspaceRoot, changes };
|
|
34429
34663
|
}
|
|
@@ -34432,15 +34666,15 @@ async function applyInitPlan(plan, opts) {
|
|
|
34432
34666
|
const mkdir = opts?.mkdir ?? defaultMkdir;
|
|
34433
34667
|
for (const change of plan.changes) {
|
|
34434
34668
|
if (change.reason === "unchanged") continue;
|
|
34435
|
-
await mkdir(
|
|
34669
|
+
await mkdir(dirname16(change.absolutePath));
|
|
34436
34670
|
await writeFile2(change.absolutePath, change.after);
|
|
34437
34671
|
}
|
|
34438
34672
|
}
|
|
34439
34673
|
async function planPackageScanConfig(input) {
|
|
34440
|
-
const { snapshot, packageSnapshot, readFile:
|
|
34674
|
+
const { snapshot, packageSnapshot, readFile: readFile23 } = input;
|
|
34441
34675
|
const { pkg } = packageSnapshot;
|
|
34442
|
-
const scanConfigPath =
|
|
34443
|
-
const before = await tryRead(scanConfigPath,
|
|
34676
|
+
const scanConfigPath = resolve42(pkg.absDir, "dbx-mcp.scan.json");
|
|
34677
|
+
const before = await tryRead(scanConfigPath, readFile23);
|
|
34444
34678
|
const parsed = parseExisting(before);
|
|
34445
34679
|
const targetClusters = HEURISTIC_CLUSTERS.filter((c) => pkg.candidateClusters.includes(c));
|
|
34446
34680
|
if (targetClusters.length === 0 && parsed === null) {
|
|
@@ -34482,9 +34716,9 @@ async function planPackageScanConfig(input) {
|
|
|
34482
34716
|
return { change, sourcesToRegister };
|
|
34483
34717
|
}
|
|
34484
34718
|
async function planRootConfig(input) {
|
|
34485
|
-
const { snapshot, sourcesToRegister, readFile:
|
|
34486
|
-
const configPath = snapshot.configPath ??
|
|
34487
|
-
const before = snapshot.configPath === null ? null : await tryRead(configPath,
|
|
34719
|
+
const { snapshot, sourcesToRegister, readFile: readFile23 } = input;
|
|
34720
|
+
const configPath = snapshot.configPath ?? resolve42(snapshot.workspaceRoot, "dbx-mcp.config.json");
|
|
34721
|
+
const before = snapshot.configPath === null ? null : await tryRead(configPath, readFile23);
|
|
34488
34722
|
const baseConfig = snapshot.config === null ? { version: 1 } : cloneConfig(snapshot.config);
|
|
34489
34723
|
if (baseConfig.version !== 1) baseConfig.version = 1;
|
|
34490
34724
|
let mutated = false;
|
|
@@ -34512,18 +34746,18 @@ async function planRootConfig(input) {
|
|
|
34512
34746
|
};
|
|
34513
34747
|
}
|
|
34514
34748
|
function defaultOutFor(input) {
|
|
34515
|
-
const targetAbs =
|
|
34516
|
-
return
|
|
34749
|
+
const targetAbs = resolve42(input.snapshot.workspaceRoot, ".tmp/dbx-mcp", `${input.slug}.${clusterFilenameSegment(input.cluster)}.json`);
|
|
34750
|
+
return relative14(dirname16(input.scanConfigPath), targetAbs).split("\\").join("/");
|
|
34517
34751
|
}
|
|
34518
34752
|
function resolveScanOut(scanConfigPath, out) {
|
|
34519
|
-
return
|
|
34753
|
+
return resolve42(dirname16(scanConfigPath), out);
|
|
34520
34754
|
}
|
|
34521
34755
|
function relativeFromConfig(snapshot, absolute) {
|
|
34522
|
-
const configDir = snapshot.configPath === null ? snapshot.workspaceRoot :
|
|
34523
|
-
return
|
|
34756
|
+
const configDir = snapshot.configPath === null ? snapshot.workspaceRoot : dirname16(snapshot.configPath);
|
|
34757
|
+
return relative14(configDir, absolute).split("\\").join("/");
|
|
34524
34758
|
}
|
|
34525
34759
|
function workspaceRel(workspaceRoot, absolute) {
|
|
34526
|
-
const rel =
|
|
34760
|
+
const rel = relative14(workspaceRoot, absolute);
|
|
34527
34761
|
if (rel.length === 0) return ".";
|
|
34528
34762
|
return rel.split("\\").join("/");
|
|
34529
34763
|
}
|
|
@@ -34549,9 +34783,9 @@ function cloneConfig(config) {
|
|
|
34549
34783
|
}
|
|
34550
34784
|
return out;
|
|
34551
34785
|
}
|
|
34552
|
-
async function tryRead(path,
|
|
34786
|
+
async function tryRead(path, readFile23) {
|
|
34553
34787
|
try {
|
|
34554
|
-
return await
|
|
34788
|
+
return await readFile23(path);
|
|
34555
34789
|
} catch {
|
|
34556
34790
|
return null;
|
|
34557
34791
|
}
|
|
@@ -34563,7 +34797,7 @@ var defaultMkdir = async (dir) => {
|
|
|
34563
34797
|
};
|
|
34564
34798
|
|
|
34565
34799
|
// packages/dbx-components-mcp/src/scan/actions-build-manifest.ts
|
|
34566
|
-
import { resolve as
|
|
34800
|
+
import { resolve as resolve43 } from "node:path";
|
|
34567
34801
|
import { type as type67 } from "arktype";
|
|
34568
34802
|
|
|
34569
34803
|
// packages/dbx-components-mcp/src/scan/actions-extract.ts
|
|
@@ -34885,12 +35119,12 @@ var ACTIONS_SCAN_CONFIG_FILENAME = "dbx-mcp.scan.json";
|
|
|
34885
35119
|
var DEFAULT_READ_FILE10 = defaultReadFile;
|
|
34886
35120
|
var DEFAULT_GLOBBER5 = defaultGlobber;
|
|
34887
35121
|
async function buildActionsManifest(input) {
|
|
34888
|
-
const { projectRoot, generator, readFile:
|
|
34889
|
-
const configPath =
|
|
34890
|
-
const packagePath =
|
|
35122
|
+
const { projectRoot, generator, readFile: readFile23 = DEFAULT_READ_FILE10, globber = DEFAULT_GLOBBER5, now = () => /* @__PURE__ */ new Date() } = input;
|
|
35123
|
+
const configPath = resolve43(projectRoot, ACTIONS_SCAN_CONFIG_FILENAME);
|
|
35124
|
+
const packagePath = resolve43(projectRoot, "package.json");
|
|
34891
35125
|
const configOutcome = await loadScanSection({
|
|
34892
35126
|
configPath,
|
|
34893
|
-
readFile:
|
|
35127
|
+
readFile: readFile23,
|
|
34894
35128
|
parseSection: (parsed) => {
|
|
34895
35129
|
const validated2 = ActionsScanConfig(parsed);
|
|
34896
35130
|
if (validated2 instanceof type67.errors) {
|
|
@@ -34901,11 +35135,11 @@ async function buildActionsManifest(input) {
|
|
|
34901
35135
|
});
|
|
34902
35136
|
if (configOutcome.kind !== "ok") return configOutcome.outcome;
|
|
34903
35137
|
const scanSection = configOutcome.section;
|
|
34904
|
-
const packageOutcome = await loadPackageName(packagePath,
|
|
35138
|
+
const packageOutcome = await loadPackageName(packagePath, readFile23);
|
|
34905
35139
|
if (packageOutcome.kind !== "ok") return packageOutcome.outcome;
|
|
34906
35140
|
const packageName = packageOutcome.packageName;
|
|
34907
35141
|
const filePaths = await globber({ projectRoot, include: scanSection.include, exclude: scanSection.exclude ?? [] });
|
|
34908
|
-
const project = await buildScanProject({ projectRoot, filePaths, readFile:
|
|
35142
|
+
const project = await buildScanProject({ projectRoot, filePaths, readFile: readFile23 });
|
|
34909
35143
|
const extractResult = extractActionEntries({ project });
|
|
34910
35144
|
const moduleName = scanSection.module ?? packageName;
|
|
34911
35145
|
const sourceLabel = scanSection.source ?? packageName;
|
|
@@ -34923,7 +35157,7 @@ async function buildActionsManifest(input) {
|
|
|
34923
35157
|
if (validated instanceof type67.errors) {
|
|
34924
35158
|
outcome = { kind: "invalid-manifest", error: validated.summary };
|
|
34925
35159
|
} else {
|
|
34926
|
-
const outPath =
|
|
35160
|
+
const outPath = resolve43(projectRoot, scanSection.out ?? DEFAULT_ACTIONS_SCAN_OUT_PATH);
|
|
34927
35161
|
outcome = {
|
|
34928
35162
|
kind: "success",
|
|
34929
35163
|
manifest: validated,
|
|
@@ -35046,7 +35280,7 @@ function formatExtractWarning4(warning) {
|
|
|
35046
35280
|
}
|
|
35047
35281
|
|
|
35048
35282
|
// packages/dbx-components-mcp/src/scan/filters-build-manifest.ts
|
|
35049
|
-
import { resolve as
|
|
35283
|
+
import { resolve as resolve44 } from "node:path";
|
|
35050
35284
|
import { type as type69 } from "arktype";
|
|
35051
35285
|
|
|
35052
35286
|
// packages/dbx-components-mcp/src/scan/filters-extract.ts
|
|
@@ -35258,12 +35492,12 @@ var FILTERS_SCAN_CONFIG_FILENAME = "dbx-mcp.scan.json";
|
|
|
35258
35492
|
var DEFAULT_READ_FILE11 = defaultReadFile;
|
|
35259
35493
|
var DEFAULT_GLOBBER6 = defaultGlobber;
|
|
35260
35494
|
async function buildFiltersManifest(input) {
|
|
35261
|
-
const { projectRoot, generator, readFile:
|
|
35262
|
-
const configPath =
|
|
35263
|
-
const packagePath =
|
|
35495
|
+
const { projectRoot, generator, readFile: readFile23 = DEFAULT_READ_FILE11, globber = DEFAULT_GLOBBER6, now = () => /* @__PURE__ */ new Date() } = input;
|
|
35496
|
+
const configPath = resolve44(projectRoot, FILTERS_SCAN_CONFIG_FILENAME);
|
|
35497
|
+
const packagePath = resolve44(projectRoot, "package.json");
|
|
35264
35498
|
const configOutcome = await loadScanSection({
|
|
35265
35499
|
configPath,
|
|
35266
|
-
readFile:
|
|
35500
|
+
readFile: readFile23,
|
|
35267
35501
|
parseSection: (parsed) => {
|
|
35268
35502
|
const validated2 = FiltersScanConfig(parsed);
|
|
35269
35503
|
if (validated2 instanceof type69.errors) {
|
|
@@ -35276,7 +35510,7 @@ async function buildFiltersManifest(input) {
|
|
|
35276
35510
|
return configOutcome.outcome;
|
|
35277
35511
|
}
|
|
35278
35512
|
const scanSection = configOutcome.section;
|
|
35279
|
-
const packageOutcome = await loadPackageName(packagePath,
|
|
35513
|
+
const packageOutcome = await loadPackageName(packagePath, readFile23);
|
|
35280
35514
|
if (packageOutcome.kind !== "ok") {
|
|
35281
35515
|
return packageOutcome.outcome;
|
|
35282
35516
|
}
|
|
@@ -35286,7 +35520,7 @@ async function buildFiltersManifest(input) {
|
|
|
35286
35520
|
include: scanSection.include,
|
|
35287
35521
|
exclude: scanSection.exclude ?? []
|
|
35288
35522
|
});
|
|
35289
|
-
const project = await buildScanProject({ projectRoot, filePaths, readFile:
|
|
35523
|
+
const project = await buildScanProject({ projectRoot, filePaths, readFile: readFile23 });
|
|
35290
35524
|
const extractResult = extractFilterEntries({ project });
|
|
35291
35525
|
const moduleName = scanSection.module ?? packageName;
|
|
35292
35526
|
const sourceLabel = scanSection.source ?? packageName;
|
|
@@ -35304,7 +35538,7 @@ async function buildFiltersManifest(input) {
|
|
|
35304
35538
|
if (validated instanceof type69.errors) {
|
|
35305
35539
|
outcome = { kind: "invalid-manifest", error: validated.summary };
|
|
35306
35540
|
} else {
|
|
35307
|
-
const outPath =
|
|
35541
|
+
const outPath = resolve44(projectRoot, scanSection.out ?? DEFAULT_FILTERS_SCAN_OUT_PATH);
|
|
35308
35542
|
outcome = {
|
|
35309
35543
|
kind: "success",
|
|
35310
35544
|
manifest: validated,
|
|
@@ -35391,7 +35625,7 @@ function formatExtractWarning5(warning) {
|
|
|
35391
35625
|
}
|
|
35392
35626
|
|
|
35393
35627
|
// packages/dbx-components-mcp/src/scan/pipes-build-manifest.ts
|
|
35394
|
-
import { resolve as
|
|
35628
|
+
import { resolve as resolve45 } from "node:path";
|
|
35395
35629
|
import { type as type71 } from "arktype";
|
|
35396
35630
|
|
|
35397
35631
|
// packages/dbx-components-mcp/src/scan/pipes-extract.ts
|
|
@@ -35686,12 +35920,12 @@ var PIPES_SCAN_CONFIG_FILENAME = "dbx-mcp.scan.json";
|
|
|
35686
35920
|
var DEFAULT_READ_FILE12 = defaultReadFile;
|
|
35687
35921
|
var DEFAULT_GLOBBER7 = defaultGlobber;
|
|
35688
35922
|
async function buildPipesManifest(input) {
|
|
35689
|
-
const { projectRoot, generator, readFile:
|
|
35690
|
-
const configPath =
|
|
35691
|
-
const packagePath =
|
|
35923
|
+
const { projectRoot, generator, readFile: readFile23 = DEFAULT_READ_FILE12, globber = DEFAULT_GLOBBER7, now = () => /* @__PURE__ */ new Date() } = input;
|
|
35924
|
+
const configPath = resolve45(projectRoot, PIPES_SCAN_CONFIG_FILENAME);
|
|
35925
|
+
const packagePath = resolve45(projectRoot, "package.json");
|
|
35692
35926
|
const configOutcome = await loadScanSection({
|
|
35693
35927
|
configPath,
|
|
35694
|
-
readFile:
|
|
35928
|
+
readFile: readFile23,
|
|
35695
35929
|
parseSection: (parsed) => {
|
|
35696
35930
|
const validated2 = PipesScanConfig(parsed);
|
|
35697
35931
|
if (validated2 instanceof type71.errors) {
|
|
@@ -35704,7 +35938,7 @@ async function buildPipesManifest(input) {
|
|
|
35704
35938
|
return configOutcome.outcome;
|
|
35705
35939
|
}
|
|
35706
35940
|
const scanSection = configOutcome.section;
|
|
35707
|
-
const packageOutcome = await loadPackageName(packagePath,
|
|
35941
|
+
const packageOutcome = await loadPackageName(packagePath, readFile23);
|
|
35708
35942
|
if (packageOutcome.kind !== "ok") {
|
|
35709
35943
|
return packageOutcome.outcome;
|
|
35710
35944
|
}
|
|
@@ -35714,7 +35948,7 @@ async function buildPipesManifest(input) {
|
|
|
35714
35948
|
include: scanSection.include,
|
|
35715
35949
|
exclude: scanSection.exclude ?? []
|
|
35716
35950
|
});
|
|
35717
|
-
const project = await buildScanProject({ projectRoot, filePaths, readFile:
|
|
35951
|
+
const project = await buildScanProject({ projectRoot, filePaths, readFile: readFile23 });
|
|
35718
35952
|
const extractResult = extractPipeEntries({ project });
|
|
35719
35953
|
const moduleName = scanSection.module ?? packageName;
|
|
35720
35954
|
const sourceLabel = scanSection.source ?? packageName;
|
|
@@ -35732,7 +35966,7 @@ async function buildPipesManifest(input) {
|
|
|
35732
35966
|
if (validated instanceof type71.errors) {
|
|
35733
35967
|
outcome = { kind: "invalid-manifest", error: validated.summary };
|
|
35734
35968
|
} else {
|
|
35735
|
-
const outPath =
|
|
35969
|
+
const outPath = resolve45(projectRoot, scanSection.out ?? DEFAULT_PIPES_SCAN_OUT_PATH);
|
|
35736
35970
|
outcome = {
|
|
35737
35971
|
kind: "success",
|
|
35738
35972
|
manifest: validated,
|
|
@@ -36090,7 +36324,7 @@ function parseArgs10(rawArgs, defaultCwd) {
|
|
|
36090
36324
|
}
|
|
36091
36325
|
let workspaceRoot = defaultCwd;
|
|
36092
36326
|
if (parsed.cwd !== void 0 && parsed.cwd.length > 0) {
|
|
36093
|
-
workspaceRoot =
|
|
36327
|
+
workspaceRoot = resolve46(defaultCwd, parsed.cwd);
|
|
36094
36328
|
}
|
|
36095
36329
|
if (parsed.explicitDirs !== void 0) {
|
|
36096
36330
|
for (const dir of parsed.explicitDirs) {
|
|
@@ -37494,7 +37728,7 @@ function renderAmbiguous(matches) {
|
|
|
37494
37728
|
|
|
37495
37729
|
// packages/dbx-components-mcp/src/tools/ui-smell-check.tool.ts
|
|
37496
37730
|
import { readFile as nodeReadFile8 } from "node:fs/promises";
|
|
37497
|
-
import { basename as basename8, extname, isAbsolute as
|
|
37731
|
+
import { basename as basename8, extname, isAbsolute as isAbsolute15, resolve as resolve47 } from "node:path";
|
|
37498
37732
|
import { type as type77 } from "arktype";
|
|
37499
37733
|
|
|
37500
37734
|
// packages/dbx-components-mcp/src/tools/ui-smell-check/smells.ts
|
|
@@ -38465,9 +38699,9 @@ function parseArgs13(raw, defaults) {
|
|
|
38465
38699
|
return { html, scss, htmlPath: parsed.htmlPath, scssPath: parsed.scssPath, paths: parsed.paths, context: parsed.context, conventions: merged };
|
|
38466
38700
|
}
|
|
38467
38701
|
var DEFAULT_READ_FILE13 = (path) => nodeReadFile8(path, "utf-8");
|
|
38468
|
-
async function readPathInput(path, cwd,
|
|
38469
|
-
const absolute =
|
|
38470
|
-
return
|
|
38702
|
+
async function readPathInput(path, cwd, readFile23) {
|
|
38703
|
+
const absolute = isAbsolute15(path) ? path : resolve47(cwd, path);
|
|
38704
|
+
return readFile23(absolute);
|
|
38471
38705
|
}
|
|
38472
38706
|
function pairBatchPaths(paths) {
|
|
38473
38707
|
const groups = /* @__PURE__ */ new Map();
|
|
@@ -38503,11 +38737,11 @@ function pairBatchPaths(paths) {
|
|
|
38503
38737
|
}
|
|
38504
38738
|
// @__NO_SIDE_EFFECTS__
|
|
38505
38739
|
function createUiSmellCheckTool(input) {
|
|
38506
|
-
const { tokenRegistry, uiComponentRegistry, cwd, readFile:
|
|
38740
|
+
const { tokenRegistry, uiComponentRegistry, cwd, readFile: readFile23 } = input;
|
|
38507
38741
|
const run15 = async (rawArgs) => {
|
|
38508
38742
|
let conventionsFromConfig = {};
|
|
38509
38743
|
try {
|
|
38510
|
-
const configResult = await findAndLoadConfig({ cwd: cwd ?? process.cwd(), readFile:
|
|
38744
|
+
const configResult = await findAndLoadConfig({ cwd: cwd ?? process.cwd(), readFile: readFile23 });
|
|
38511
38745
|
const block = configResult.config?.uiSmellCheck?.projectConventions;
|
|
38512
38746
|
if (block !== void 0) {
|
|
38513
38747
|
conventionsFromConfig = block;
|
|
@@ -38523,7 +38757,7 @@ function createUiSmellCheckTool(input) {
|
|
|
38523
38757
|
return toolError(message);
|
|
38524
38758
|
}
|
|
38525
38759
|
const resolvedCwd = cwd ?? process.cwd();
|
|
38526
|
-
const reader =
|
|
38760
|
+
const reader = readFile23 ?? DEFAULT_READ_FILE13;
|
|
38527
38761
|
if (args.paths !== void 0 && args.paths.length > 0) {
|
|
38528
38762
|
if (args.html.length > 0 || args.scss.length > 0 || args.htmlPath !== void 0 || args.scssPath !== void 0) {
|
|
38529
38763
|
return toolError("dbx_ui_smell_check: `paths` is mutually exclusive with `html`/`scss`/`htmlPath`/`scssPath`.");
|