@dereekb/dbx-components-mcp 13.11.3 → 13.11.5
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 +596 -347
- package/generated/dereekb-date.utils.mcp.generated.json +348 -0
- package/generated/dereekb-dbx-firebase.ui-components.mcp.generated.json +33 -0
- package/generated/dereekb-dbx-form.forge-fields.mcp.generated.json +12 -0
- package/generated/dereekb-util.utils.mcp.generated.json +1206 -1
- package/package.json +11 -11
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.5",
|
|
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.5",
|
|
24
|
+
"@dereekb/dbx-core": "13.11.5",
|
|
25
|
+
"@dereekb/dbx-firebase": "13.11.5",
|
|
26
|
+
"@dereekb/dbx-form": "13.11.5",
|
|
27
|
+
"@dereekb/dbx-web": "13.11.5",
|
|
28
|
+
"@dereekb/firebase": "13.11.5",
|
|
29
|
+
"@dereekb/firebase-server": "13.11.5",
|
|
30
|
+
"@dereekb/rxjs": "13.11.5",
|
|
31
|
+
"@dereekb/util": "13.11.5",
|
|
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.5"
|
|
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
|
}
|
|
@@ -10793,6 +10809,11 @@ var ALIASES = {
|
|
|
10793
10809
|
dropdown: "value-selection",
|
|
10794
10810
|
select: "value-selection",
|
|
10795
10811
|
combobox: "value-selection",
|
|
10812
|
+
"dbx-list": "list-selection",
|
|
10813
|
+
dbxlist: "list-selection",
|
|
10814
|
+
"list-select": "list-selection",
|
|
10815
|
+
"list-selection-field": "list-selection",
|
|
10816
|
+
"dbx-list-selection": "list-selection",
|
|
10796
10817
|
// text variants (specialized)
|
|
10797
10818
|
email: "email",
|
|
10798
10819
|
"email-field": "email",
|
|
@@ -11275,6 +11296,16 @@ function scoreFieldAgainstToken(field, token) {
|
|
|
11275
11296
|
if (tier === token) {
|
|
11276
11297
|
score += 5;
|
|
11277
11298
|
}
|
|
11299
|
+
if (field.tier === "field-factory") {
|
|
11300
|
+
const ngFormType = field.ngFormType.toLowerCase();
|
|
11301
|
+
if (ngFormType === token) {
|
|
11302
|
+
score += 15;
|
|
11303
|
+
} else if (ngFormType.startsWith(token)) {
|
|
11304
|
+
score += 10;
|
|
11305
|
+
} else if (ngFormType.includes(token)) {
|
|
11306
|
+
score += 6;
|
|
11307
|
+
}
|
|
11308
|
+
}
|
|
11278
11309
|
for (const key of Object.keys(field.config)) {
|
|
11279
11310
|
const keyLower = key.toLowerCase();
|
|
11280
11311
|
if (keyLower === token) {
|
|
@@ -13255,22 +13286,22 @@ function formatFirebaseStoreShapeTaxonomy() {
|
|
|
13255
13286
|
// packages/dbx-components-mcp/src/tools/validate-input.ts
|
|
13256
13287
|
import { glob as fsGlob4, readFile as readFile3, stat as stat3 } from "node:fs/promises";
|
|
13257
13288
|
import { resolve as resolve21, sep as sep4 } from "node:path";
|
|
13258
|
-
function ensurePathInsideCwd(
|
|
13289
|
+
function ensurePathInsideCwd(relative15, cwd) {
|
|
13259
13290
|
const cwdPrefix = cwd.endsWith(sep4) ? cwd : cwd + sep4;
|
|
13260
|
-
const absolute = resolve21(cwd,
|
|
13291
|
+
const absolute = resolve21(cwd, relative15);
|
|
13261
13292
|
if (!absolute.startsWith(cwdPrefix) && absolute !== cwd) {
|
|
13262
|
-
throw new Error(`Path \`${
|
|
13293
|
+
throw new Error(`Path \`${relative15}\` resolves outside the server cwd and is not allowed.`);
|
|
13263
13294
|
}
|
|
13264
13295
|
}
|
|
13265
13296
|
async function resolveFolderPaths(config) {
|
|
13266
13297
|
const { paths, glob: glob2, cwd } = config;
|
|
13267
13298
|
const collected = [];
|
|
13268
13299
|
const seen = /* @__PURE__ */ new Set();
|
|
13269
|
-
const accept = (
|
|
13270
|
-
if (seen.has(
|
|
13271
|
-
ensurePathInsideCwd(
|
|
13272
|
-
seen.add(
|
|
13273
|
-
collected.push(
|
|
13300
|
+
const accept = (relative15) => {
|
|
13301
|
+
if (seen.has(relative15)) return;
|
|
13302
|
+
ensurePathInsideCwd(relative15, cwd);
|
|
13303
|
+
seen.add(relative15);
|
|
13304
|
+
collected.push(relative15);
|
|
13274
13305
|
};
|
|
13275
13306
|
if (paths) {
|
|
13276
13307
|
for (const p of paths) {
|
|
@@ -13313,13 +13344,13 @@ async function resolveValidatorSources(config) {
|
|
|
13313
13344
|
pathList.push(match);
|
|
13314
13345
|
}
|
|
13315
13346
|
}
|
|
13316
|
-
for (const
|
|
13317
|
-
if (seenNames.has(
|
|
13318
|
-
ensurePathInsideCwd(
|
|
13319
|
-
const absolute = resolve21(cwd,
|
|
13347
|
+
for (const relative15 of pathList) {
|
|
13348
|
+
if (seenNames.has(relative15)) continue;
|
|
13349
|
+
ensurePathInsideCwd(relative15, cwd);
|
|
13350
|
+
const absolute = resolve21(cwd, relative15);
|
|
13320
13351
|
const text = await readFile3(absolute, "utf8");
|
|
13321
|
-
seenNames.add(
|
|
13322
|
-
collected.push({ name:
|
|
13352
|
+
seenNames.add(relative15);
|
|
13353
|
+
collected.push({ name: relative15, text });
|
|
13323
13354
|
}
|
|
13324
13355
|
return collected;
|
|
13325
13356
|
}
|
|
@@ -14082,10 +14113,10 @@ function createFolderValidateTool(config) {
|
|
|
14082
14113
|
}
|
|
14083
14114
|
const inspections = [];
|
|
14084
14115
|
try {
|
|
14085
|
-
for (const
|
|
14086
|
-
const absolute = resolve22(cwd,
|
|
14116
|
+
for (const relative15 of paths) {
|
|
14117
|
+
const absolute = resolve22(cwd, relative15);
|
|
14087
14118
|
const inspection = await inspectFolder3(absolute);
|
|
14088
|
-
const relativized = { ...inspection, path:
|
|
14119
|
+
const relativized = { ...inspection, path: relative15 };
|
|
14089
14120
|
inspections.push(relativized);
|
|
14090
14121
|
}
|
|
14091
14122
|
} catch (err) {
|
|
@@ -19899,22 +19930,48 @@ function identityToModel2(identity) {
|
|
|
19899
19930
|
var modelApiLookupTool = { definition: TOOL2, run: run2 };
|
|
19900
19931
|
|
|
19901
19932
|
// packages/dbx-components-mcp/src/tools/model-api-validate-app.tool.ts
|
|
19902
|
-
import { resolve as
|
|
19933
|
+
import { resolve as resolve26 } from "node:path";
|
|
19903
19934
|
import { type as type40 } from "arktype";
|
|
19904
19935
|
|
|
19905
19936
|
// packages/dbx-components-mcp/src/tools/model-api-validate-app/extract-declarations.ts
|
|
19906
19937
|
import { readdir as readdir5, readFile as readFile7, stat as stat7 } from "node:fs/promises";
|
|
19907
19938
|
import { join as join7, relative as relative7, sep as sep8 } from "node:path";
|
|
19908
19939
|
var API_SUFFIX3 = ".api.ts";
|
|
19909
|
-
|
|
19910
|
-
|
|
19911
|
-
const
|
|
19940
|
+
async function extractDeclaredEntries(roots) {
|
|
19941
|
+
const seen = /* @__PURE__ */ new Set();
|
|
19942
|
+
const out = [];
|
|
19943
|
+
for (const root of roots) {
|
|
19944
|
+
const files = await collectApiFiles2(root.absDir);
|
|
19945
|
+
for (const fileAbs of files) {
|
|
19946
|
+
if (seen.has(fileAbs)) continue;
|
|
19947
|
+
seen.add(fileAbs);
|
|
19948
|
+
const text = await readFile7(fileAbs, "utf8");
|
|
19949
|
+
if (!text.includes("callModelFirebaseFunctionMapFactory")) continue;
|
|
19950
|
+
const fileRel = relative7(root.relativeBase, fileAbs).split(sep8).join("/");
|
|
19951
|
+
const extraction = extractCrudEntries({ name: fileRel, text });
|
|
19952
|
+
for (const entry of extraction.entries) {
|
|
19953
|
+
if (entry.verb === "standalone") continue;
|
|
19954
|
+
out.push({
|
|
19955
|
+
model: entry.model,
|
|
19956
|
+
verb: entry.verb,
|
|
19957
|
+
specifier: entry.specifier,
|
|
19958
|
+
paramsTypeName: entry.paramsTypeName,
|
|
19959
|
+
resultTypeName: entry.resultTypeName,
|
|
19960
|
+
sourceFile: fileRel,
|
|
19961
|
+
line: entry.line
|
|
19962
|
+
});
|
|
19963
|
+
}
|
|
19964
|
+
}
|
|
19965
|
+
}
|
|
19966
|
+
return out;
|
|
19967
|
+
}
|
|
19968
|
+
async function collectApiFiles2(rootAbs) {
|
|
19912
19969
|
const files = [];
|
|
19913
19970
|
const stack = [];
|
|
19914
19971
|
try {
|
|
19915
|
-
const stats = await stat7(
|
|
19972
|
+
const stats = await stat7(rootAbs);
|
|
19916
19973
|
if (!stats.isDirectory()) return [];
|
|
19917
|
-
stack.push(
|
|
19974
|
+
stack.push(rootAbs);
|
|
19918
19975
|
} catch {
|
|
19919
19976
|
return [];
|
|
19920
19977
|
}
|
|
@@ -19939,26 +19996,7 @@ async function extractDeclaredEntries(componentAbs) {
|
|
|
19939
19996
|
}
|
|
19940
19997
|
}
|
|
19941
19998
|
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;
|
|
19999
|
+
return files;
|
|
19962
20000
|
}
|
|
19963
20001
|
|
|
19964
20002
|
// packages/dbx-components-mcp/src/tools/model-api-validate-app/extract-handlers.ts
|
|
@@ -20053,6 +20091,37 @@ function readBareHandlerName(node) {
|
|
|
20053
20091
|
return void 0;
|
|
20054
20092
|
}
|
|
20055
20093
|
|
|
20094
|
+
// packages/dbx-components-mcp/src/tools/model-api-validate-app/naming.ts
|
|
20095
|
+
function expectedHandlerNames(model, verb, specifier) {
|
|
20096
|
+
const modelCamel = lowerFirst(model);
|
|
20097
|
+
const verbCap = capitalize3(verb);
|
|
20098
|
+
if (specifier === void 0 || specifier === "_") {
|
|
20099
|
+
return [modelCamel + verbCap];
|
|
20100
|
+
}
|
|
20101
|
+
const specifierCap = capitalize3(specifier);
|
|
20102
|
+
return [modelCamel + verbCap + specifierCap, modelCamel + specifierCap];
|
|
20103
|
+
}
|
|
20104
|
+
function checkHandlerNaming(handler) {
|
|
20105
|
+
const expected = expectedHandlerNames(handler.model, handler.verb, handler.specifier);
|
|
20106
|
+
if (expected.includes(handler.handlerName)) return void 0;
|
|
20107
|
+
const specifierSuffix = handler.specifier ? `.${handler.specifier}` : "";
|
|
20108
|
+
const accepted = expected.map((n) => `\`${n}\``).join(" or ");
|
|
20109
|
+
return {
|
|
20110
|
+
code: "HANDLER_NAMING_MISMATCH",
|
|
20111
|
+
model: handler.model,
|
|
20112
|
+
verb: handler.verb,
|
|
20113
|
+
specifier: handler.specifier,
|
|
20114
|
+
message: `Handler \`${handler.handlerName}\` for \`${handler.model}.${handler.verb}${specifierSuffix}\` does not follow the \`<model><Verb>[<Specifier>]\` convention. Rename to ${accepted}.`,
|
|
20115
|
+
source: `${handler.sourceFile}:${handler.line}`
|
|
20116
|
+
};
|
|
20117
|
+
}
|
|
20118
|
+
function lowerFirst(value) {
|
|
20119
|
+
return value.length > 0 ? value.charAt(0).toLowerCase() + value.slice(1) : value;
|
|
20120
|
+
}
|
|
20121
|
+
function capitalize3(value) {
|
|
20122
|
+
return value.length > 0 ? value.charAt(0).toUpperCase() + value.slice(1) : value;
|
|
20123
|
+
}
|
|
20124
|
+
|
|
20056
20125
|
// packages/dbx-components-mcp/src/tools/model-api-validate-app/reconcile.ts
|
|
20057
20126
|
function keyOf(cell) {
|
|
20058
20127
|
return `${cell.model}|${cell.verb}|${cell.specifier ?? "__none__"}`;
|
|
@@ -20100,6 +20169,10 @@ function reconcile(input) {
|
|
|
20100
20169
|
source: `${h.sourceFile}:${h.line}`
|
|
20101
20170
|
});
|
|
20102
20171
|
}
|
|
20172
|
+
for (const h of handlersFiltered) {
|
|
20173
|
+
const namingIssue = checkHandlerNaming(h);
|
|
20174
|
+
if (namingIssue) issues.push(namingIssue);
|
|
20175
|
+
}
|
|
20103
20176
|
entries.sort(compareEntries);
|
|
20104
20177
|
issues.sort((a, b) => a.model.localeCompare(b.model) || (a.verb ?? "").localeCompare(b.verb ?? "") || (a.specifier ?? "").localeCompare(b.specifier ?? ""));
|
|
20105
20178
|
const summaries = buildSummaries(entries, issues);
|
|
@@ -20129,6 +20202,178 @@ function normalize3(value) {
|
|
|
20129
20202
|
return value.replace(/Identity$/i, "").toLowerCase();
|
|
20130
20203
|
}
|
|
20131
20204
|
|
|
20205
|
+
// packages/dbx-components-mcp/src/tools/model-api-validate-app/source-roots.ts
|
|
20206
|
+
import { readFile as readFile9, stat as stat8 } from "node:fs/promises";
|
|
20207
|
+
import { dirname as dirname12, isAbsolute as isAbsolute12, join as join9, relative as relative8, resolve as resolve25, sep as sep9 } from "node:path";
|
|
20208
|
+
var TSCONFIG_BASE = "tsconfig.base.json";
|
|
20209
|
+
var COMPONENT_PACKAGE_JSON = "package.json";
|
|
20210
|
+
var SRC_LIB_SUBPATH = "src/lib";
|
|
20211
|
+
var DBX_COMPONENTS_BASE_SCOPE = "@dereekb/";
|
|
20212
|
+
async function resolveApiSourceRoots(input) {
|
|
20213
|
+
const workspaceRoot = input.workspaceRoot ?? await findWorkspaceRoot(input.componentAbs);
|
|
20214
|
+
const componentLib = join9(input.componentAbs, SRC_LIB_SUBPATH);
|
|
20215
|
+
const seen = /* @__PURE__ */ new Set();
|
|
20216
|
+
const roots = [];
|
|
20217
|
+
if (await isDirectory(componentLib)) {
|
|
20218
|
+
seen.add(componentLib);
|
|
20219
|
+
roots.push({ absDir: componentLib, packageLabel: workspaceRoot ? toWorkspaceRel(workspaceRoot, input.componentAbs) : input.componentAbs });
|
|
20220
|
+
}
|
|
20221
|
+
if (workspaceRoot) {
|
|
20222
|
+
const upstream = await resolveUpstreamRoots({ componentAbs: input.componentAbs, workspaceRoot });
|
|
20223
|
+
for (const root of upstream) {
|
|
20224
|
+
if (seen.has(root.absDir)) continue;
|
|
20225
|
+
seen.add(root.absDir);
|
|
20226
|
+
roots.push(root);
|
|
20227
|
+
}
|
|
20228
|
+
}
|
|
20229
|
+
return { roots, workspaceRoot };
|
|
20230
|
+
}
|
|
20231
|
+
async function findWorkspaceRoot(startAbs) {
|
|
20232
|
+
let current = resolve25(startAbs);
|
|
20233
|
+
for (; ; ) {
|
|
20234
|
+
const candidate = join9(current, TSCONFIG_BASE);
|
|
20235
|
+
try {
|
|
20236
|
+
const s = await stat8(candidate);
|
|
20237
|
+
if (s.isFile()) return current;
|
|
20238
|
+
} catch {
|
|
20239
|
+
}
|
|
20240
|
+
const parent = dirname12(current);
|
|
20241
|
+
if (parent === current) return void 0;
|
|
20242
|
+
current = parent;
|
|
20243
|
+
}
|
|
20244
|
+
}
|
|
20245
|
+
async function resolveUpstreamRoots(input) {
|
|
20246
|
+
const deps = await readComponentDereekbDeps(input.componentAbs);
|
|
20247
|
+
if (deps.length === 0) return [];
|
|
20248
|
+
const paths = await readTsconfigPaths(input.workspaceRoot);
|
|
20249
|
+
if (!paths) return [];
|
|
20250
|
+
const seen = /* @__PURE__ */ new Set();
|
|
20251
|
+
const out = [];
|
|
20252
|
+
for (const dep of deps) {
|
|
20253
|
+
const pkgRoot = resolvePackageRoot({ packageName: dep, paths, workspaceRoot: input.workspaceRoot });
|
|
20254
|
+
if (!pkgRoot) continue;
|
|
20255
|
+
const libDir = join9(pkgRoot, SRC_LIB_SUBPATH);
|
|
20256
|
+
if (seen.has(libDir)) continue;
|
|
20257
|
+
if (!await isDirectory(libDir)) continue;
|
|
20258
|
+
seen.add(libDir);
|
|
20259
|
+
out.push({ absDir: libDir, packageLabel: dep });
|
|
20260
|
+
}
|
|
20261
|
+
return out;
|
|
20262
|
+
}
|
|
20263
|
+
async function readComponentDereekbDeps(componentAbs) {
|
|
20264
|
+
const pkgPath = join9(componentAbs, COMPONENT_PACKAGE_JSON);
|
|
20265
|
+
let raw;
|
|
20266
|
+
try {
|
|
20267
|
+
raw = await readFile9(pkgPath, "utf8");
|
|
20268
|
+
} catch {
|
|
20269
|
+
return [];
|
|
20270
|
+
}
|
|
20271
|
+
let json;
|
|
20272
|
+
try {
|
|
20273
|
+
json = JSON.parse(raw);
|
|
20274
|
+
} catch {
|
|
20275
|
+
return [];
|
|
20276
|
+
}
|
|
20277
|
+
if (!isRecord(json)) return [];
|
|
20278
|
+
const out = /* @__PURE__ */ new Set();
|
|
20279
|
+
for (const field of ["dependencies", "devDependencies", "peerDependencies"]) {
|
|
20280
|
+
const map = json[field];
|
|
20281
|
+
if (!isRecord(map)) continue;
|
|
20282
|
+
for (const name of Object.keys(map)) {
|
|
20283
|
+
if (name.startsWith(DBX_COMPONENTS_BASE_SCOPE)) out.add(name);
|
|
20284
|
+
}
|
|
20285
|
+
}
|
|
20286
|
+
return [...out];
|
|
20287
|
+
}
|
|
20288
|
+
async function readTsconfigPaths(workspaceRoot) {
|
|
20289
|
+
const tsconfigPath = join9(workspaceRoot, TSCONFIG_BASE);
|
|
20290
|
+
let raw;
|
|
20291
|
+
try {
|
|
20292
|
+
raw = await readFile9(tsconfigPath, "utf8");
|
|
20293
|
+
} catch {
|
|
20294
|
+
return void 0;
|
|
20295
|
+
}
|
|
20296
|
+
let json;
|
|
20297
|
+
try {
|
|
20298
|
+
json = JSON.parse(stripJsonComments(raw));
|
|
20299
|
+
} catch {
|
|
20300
|
+
return void 0;
|
|
20301
|
+
}
|
|
20302
|
+
if (!isRecord(json)) return void 0;
|
|
20303
|
+
const compilerOptions = json.compilerOptions;
|
|
20304
|
+
if (!isRecord(compilerOptions)) return void 0;
|
|
20305
|
+
const paths = compilerOptions.paths;
|
|
20306
|
+
if (!isRecord(paths)) return void 0;
|
|
20307
|
+
const entries = /* @__PURE__ */ new Map();
|
|
20308
|
+
for (const [alias, target] of Object.entries(paths)) {
|
|
20309
|
+
if (!Array.isArray(target) || target.length === 0) continue;
|
|
20310
|
+
const first = target[0];
|
|
20311
|
+
if (typeof first !== "string") continue;
|
|
20312
|
+
entries.set(alias, first);
|
|
20313
|
+
}
|
|
20314
|
+
return { entries };
|
|
20315
|
+
}
|
|
20316
|
+
function resolvePackageRoot(input) {
|
|
20317
|
+
const target = input.paths.entries.get(input.packageName);
|
|
20318
|
+
if (!target) return void 0;
|
|
20319
|
+
const targetAbs = isAbsolute12(target) ? target : resolve25(input.workspaceRoot, target);
|
|
20320
|
+
return dirname12(dirname12(targetAbs));
|
|
20321
|
+
}
|
|
20322
|
+
async function isDirectory(path) {
|
|
20323
|
+
try {
|
|
20324
|
+
const s = await stat8(path);
|
|
20325
|
+
return s.isDirectory();
|
|
20326
|
+
} catch {
|
|
20327
|
+
return false;
|
|
20328
|
+
}
|
|
20329
|
+
}
|
|
20330
|
+
function isRecord(value) {
|
|
20331
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
20332
|
+
}
|
|
20333
|
+
function toWorkspaceRel(workspaceRoot, abs) {
|
|
20334
|
+
const rel = relative8(workspaceRoot, abs);
|
|
20335
|
+
return rel.split(sep9).join("/");
|
|
20336
|
+
}
|
|
20337
|
+
function stripJsonComments(value) {
|
|
20338
|
+
let out = "";
|
|
20339
|
+
let i = 0;
|
|
20340
|
+
let inString = null;
|
|
20341
|
+
while (i < value.length) {
|
|
20342
|
+
const ch = value[i];
|
|
20343
|
+
const next = value[i + 1];
|
|
20344
|
+
if (inString) {
|
|
20345
|
+
out += ch;
|
|
20346
|
+
if (ch === "\\" && i + 1 < value.length) {
|
|
20347
|
+
out += next;
|
|
20348
|
+
i += 2;
|
|
20349
|
+
continue;
|
|
20350
|
+
}
|
|
20351
|
+
if (ch === inString) inString = null;
|
|
20352
|
+
i += 1;
|
|
20353
|
+
continue;
|
|
20354
|
+
}
|
|
20355
|
+
if (ch === '"' || ch === "'") {
|
|
20356
|
+
inString = ch;
|
|
20357
|
+
out += ch;
|
|
20358
|
+
i += 1;
|
|
20359
|
+
continue;
|
|
20360
|
+
}
|
|
20361
|
+
if (ch === "/" && next === "/") {
|
|
20362
|
+
while (i < value.length && value[i] !== "\n") i += 1;
|
|
20363
|
+
continue;
|
|
20364
|
+
}
|
|
20365
|
+
if (ch === "/" && next === "*") {
|
|
20366
|
+
i += 2;
|
|
20367
|
+
while (i < value.length && !(value[i] === "*" && value[i + 1] === "/")) i += 1;
|
|
20368
|
+
i += 2;
|
|
20369
|
+
continue;
|
|
20370
|
+
}
|
|
20371
|
+
out += ch;
|
|
20372
|
+
i += 1;
|
|
20373
|
+
}
|
|
20374
|
+
return out;
|
|
20375
|
+
}
|
|
20376
|
+
|
|
20132
20377
|
// packages/dbx-components-mcp/src/tools/model-api-validate-app/format.ts
|
|
20133
20378
|
function formatValidationAsMarkdown(report) {
|
|
20134
20379
|
const lines = [`# Model API validation \u2014 ${report.apiDir}`, "", `Component: \`${report.componentDir}\``, `Handler map: \`${report.handlerMapPath}\``];
|
|
@@ -20191,7 +20436,10 @@ function formatEntryRow2(entry) {
|
|
|
20191
20436
|
|
|
20192
20437
|
// packages/dbx-components-mcp/src/tools/model-api-validate-app/index.ts
|
|
20193
20438
|
async function validateAppModelApi(options) {
|
|
20194
|
-
const
|
|
20439
|
+
const { roots, workspaceRoot } = await resolveApiSourceRoots({ componentAbs: options.componentAbs, workspaceRoot: void 0 });
|
|
20440
|
+
const relativeBase = workspaceRoot ?? options.componentAbs;
|
|
20441
|
+
const declaredRoots = roots.map((r) => ({ absDir: r.absDir, relativeBase }));
|
|
20442
|
+
const declared = await extractDeclaredEntries(declaredRoots);
|
|
20195
20443
|
const handlerExtraction = await extractHandlerEntries(options.apiAbs, options.apiDir);
|
|
20196
20444
|
const reconciled = reconcile({ declared, handlers: handlerExtraction.entries, modelFilter: options.modelFilter });
|
|
20197
20445
|
const report = {
|
|
@@ -20230,6 +20478,7 @@ var TOOL3 = {
|
|
|
20230
20478
|
"- matched \u2014 declaration and handler agree.",
|
|
20231
20479
|
"- `MISSING_HANDLER` \u2014 declared but the verb-map has no entry.",
|
|
20232
20480
|
"- `ORPHAN_HANDLER` \u2014 handler is wired but no `*.api.ts` declares the entry.",
|
|
20481
|
+
"- `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
20482
|
"",
|
|
20234
20483
|
"Inputs:",
|
|
20235
20484
|
"- `componentDir`: relative path to the firebase-component package (e.g. `components/demo-firebase`).",
|
|
@@ -20261,8 +20510,8 @@ async function run3(rawArgs) {
|
|
|
20261
20510
|
} catch (err) {
|
|
20262
20511
|
return toolError(err instanceof Error ? err.message : String(err));
|
|
20263
20512
|
}
|
|
20264
|
-
const componentAbs =
|
|
20265
|
-
const apiAbs =
|
|
20513
|
+
const componentAbs = resolve26(cwd, parsed.componentDir);
|
|
20514
|
+
const apiAbs = resolve26(cwd, parsed.apiDir);
|
|
20266
20515
|
const modelFilter = parsed.model ?? (parsed.identity ? identityToModel3(parsed.identity) : void 0);
|
|
20267
20516
|
let report;
|
|
20268
20517
|
try {
|
|
@@ -20287,8 +20536,8 @@ function formatResult3(result) {
|
|
|
20287
20536
|
}
|
|
20288
20537
|
|
|
20289
20538
|
// 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
|
|
20539
|
+
import { readdir as readdir6, readFile as readFile10, stat as stat9 } from "node:fs/promises";
|
|
20540
|
+
import { basename as basename4, join as join10 } from "node:path";
|
|
20292
20541
|
var CONTENT_VALIDATION_SKIP_SUFFIXES = [".spec.ts", ".id.ts", ".query.ts", ".action.ts", ".api.ts"];
|
|
20293
20542
|
async function inspectFolder(path) {
|
|
20294
20543
|
const name = basename4(path);
|
|
@@ -20296,7 +20545,7 @@ async function inspectFolder(path) {
|
|
|
20296
20545
|
let files = [];
|
|
20297
20546
|
let sources = [];
|
|
20298
20547
|
try {
|
|
20299
|
-
const stats = await
|
|
20548
|
+
const stats = await stat9(path);
|
|
20300
20549
|
if (stats.isDirectory()) {
|
|
20301
20550
|
status = "ok";
|
|
20302
20551
|
const entries = await readdir6(path, { withFileTypes: true });
|
|
@@ -20327,7 +20576,7 @@ async function readModelSources(folderPath, files) {
|
|
|
20327
20576
|
for (const filename of files) {
|
|
20328
20577
|
if (filename === "index.ts") continue;
|
|
20329
20578
|
if (CONTENT_VALIDATION_SKIP_SUFFIXES.some((suffix) => filename.endsWith(suffix))) continue;
|
|
20330
|
-
const text = await
|
|
20579
|
+
const text = await readFile10(join10(folderPath, filename), "utf8");
|
|
20331
20580
|
out.push({ filename, text });
|
|
20332
20581
|
}
|
|
20333
20582
|
return out;
|
|
@@ -21008,7 +21257,7 @@ var modelStoreScaffoldTool = {
|
|
|
21008
21257
|
};
|
|
21009
21258
|
|
|
21010
21259
|
// packages/dbx-components-mcp/src/tools/model-fixture-list-app.tool.ts
|
|
21011
|
-
import { resolve as
|
|
21260
|
+
import { resolve as resolve27 } from "node:path";
|
|
21012
21261
|
import { type as type42 } from "arktype";
|
|
21013
21262
|
|
|
21014
21263
|
// packages/dbx-components-mcp/src/tools/model-fixture-shared/archetype.ts
|
|
@@ -21503,13 +21752,13 @@ function collectIdentityImports(sourceFile) {
|
|
|
21503
21752
|
}
|
|
21504
21753
|
|
|
21505
21754
|
// packages/dbx-components-mcp/src/tools/model-fixture-shared/inspect.ts
|
|
21506
|
-
import { readFile as
|
|
21507
|
-
import { join as
|
|
21755
|
+
import { readFile as readFile11 } from "node:fs/promises";
|
|
21756
|
+
import { join as join11 } from "node:path";
|
|
21508
21757
|
var FIXTURE_RELATIVE_PATH = "src/test/fixture.ts";
|
|
21509
21758
|
async function inspectAppFixtures(apiAbs, apiRel) {
|
|
21510
|
-
const absolutePath =
|
|
21759
|
+
const absolutePath = join11(apiAbs, FIXTURE_RELATIVE_PATH);
|
|
21511
21760
|
const relativePath = `${apiRel}/${FIXTURE_RELATIVE_PATH}`;
|
|
21512
|
-
const text = await
|
|
21761
|
+
const text = await readFile11(absolutePath, "utf8");
|
|
21513
21762
|
return extractAppFixturesFromText({ text, fixturePath: relativePath });
|
|
21514
21763
|
}
|
|
21515
21764
|
|
|
@@ -22251,7 +22500,7 @@ async function run4(rawArgs) {
|
|
|
22251
22500
|
} catch (err) {
|
|
22252
22501
|
return toolError(err instanceof Error ? err.message : String(err));
|
|
22253
22502
|
}
|
|
22254
|
-
const apiAbs =
|
|
22503
|
+
const apiAbs = resolve27(cwd, parsed.apiDir);
|
|
22255
22504
|
let extraction;
|
|
22256
22505
|
try {
|
|
22257
22506
|
extraction = await inspectAppFixtures(apiAbs, parsed.apiDir);
|
|
@@ -22265,7 +22514,7 @@ async function run4(rawArgs) {
|
|
|
22265
22514
|
var modelFixtureListAppTool = { definition: TOOL4, run: run4 };
|
|
22266
22515
|
|
|
22267
22516
|
// packages/dbx-components-mcp/src/tools/model-fixture-lookup.tool.ts
|
|
22268
|
-
import { resolve as
|
|
22517
|
+
import { resolve as resolve28 } from "node:path";
|
|
22269
22518
|
import { type as type43 } from "arktype";
|
|
22270
22519
|
var LookupArgsType2 = type43({
|
|
22271
22520
|
apiDir: "string",
|
|
@@ -22311,7 +22560,7 @@ async function run5(rawArgs) {
|
|
|
22311
22560
|
} catch (err) {
|
|
22312
22561
|
return toolError(err instanceof Error ? err.message : String(err));
|
|
22313
22562
|
}
|
|
22314
|
-
const apiAbs =
|
|
22563
|
+
const apiAbs = resolve28(cwd, parsed.apiDir);
|
|
22315
22564
|
let extraction;
|
|
22316
22565
|
try {
|
|
22317
22566
|
extraction = await inspectAppFixtures(apiAbs, parsed.apiDir);
|
|
@@ -22337,7 +22586,7 @@ function identityToModel4(identity) {
|
|
|
22337
22586
|
var modelFixtureLookupTool = { definition: TOOL5, run: run5 };
|
|
22338
22587
|
|
|
22339
22588
|
// packages/dbx-components-mcp/src/tools/model-fixture-validate-app.tool.ts
|
|
22340
|
-
import { resolve as
|
|
22589
|
+
import { resolve as resolve29 } from "node:path";
|
|
22341
22590
|
import { type as type44 } from "arktype";
|
|
22342
22591
|
var ValidateArgsType2 = type44({
|
|
22343
22592
|
apiDir: "string",
|
|
@@ -22382,7 +22631,7 @@ function createModelFixtureValidateAppTool(config = {}) {
|
|
|
22382
22631
|
} catch (err) {
|
|
22383
22632
|
return toolError(err instanceof Error ? err.message : String(err));
|
|
22384
22633
|
}
|
|
22385
|
-
const apiAbs =
|
|
22634
|
+
const apiAbs = resolve29(cwd, parsed.apiDir);
|
|
22386
22635
|
let extraction;
|
|
22387
22636
|
try {
|
|
22388
22637
|
extraction = await inspectAppFixtures(apiAbs, parsed.apiDir);
|
|
@@ -22402,8 +22651,8 @@ function createModelFixtureValidateAppTool(config = {}) {
|
|
|
22402
22651
|
}
|
|
22403
22652
|
|
|
22404
22653
|
// packages/dbx-components-mcp/src/tools/model-fixture-scaffold.tool.ts
|
|
22405
|
-
import { readFile as
|
|
22406
|
-
import { join as
|
|
22654
|
+
import { readFile as readFile12, writeFile } from "node:fs/promises";
|
|
22655
|
+
import { join as join12, resolve as resolve30 } from "node:path";
|
|
22407
22656
|
import { type as type45 } from "arktype";
|
|
22408
22657
|
var ScaffoldArgsType3 = type45({
|
|
22409
22658
|
apiDir: "string",
|
|
@@ -22482,7 +22731,7 @@ async function run6(rawArgs) {
|
|
|
22482
22731
|
} catch (err) {
|
|
22483
22732
|
return toolError(err instanceof Error ? err.message : String(err));
|
|
22484
22733
|
}
|
|
22485
|
-
const apiAbs =
|
|
22734
|
+
const apiAbs = resolve30(cwd, parsed.apiDir);
|
|
22486
22735
|
let extraction;
|
|
22487
22736
|
try {
|
|
22488
22737
|
extraction = await inspectAppFixtures(apiAbs, parsed.apiDir);
|
|
@@ -22521,10 +22770,10 @@ async function run6(rawArgs) {
|
|
|
22521
22770
|
if (conflicts.length > 0) {
|
|
22522
22771
|
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
22772
|
}
|
|
22524
|
-
const absolutePath =
|
|
22773
|
+
const absolutePath = join12(apiAbs, FIXTURE_RELATIVE_PATH);
|
|
22525
22774
|
let original;
|
|
22526
22775
|
try {
|
|
22527
|
-
original = await
|
|
22776
|
+
original = await readFile12(absolutePath, "utf8");
|
|
22528
22777
|
} catch (err) {
|
|
22529
22778
|
return toolError(`Failed to read fixture file: ${err instanceof Error ? err.message : String(err)}`);
|
|
22530
22779
|
}
|
|
@@ -22567,7 +22816,7 @@ function collectConflicts(extraction, rendered) {
|
|
|
22567
22816
|
var modelFixtureScaffoldTool = { definition: TOOL7, run: run6 };
|
|
22568
22817
|
|
|
22569
22818
|
// packages/dbx-components-mcp/src/tools/model-fixture-forward.tool.ts
|
|
22570
|
-
import { join as
|
|
22819
|
+
import { join as join13, resolve as resolve31 } from "node:path";
|
|
22571
22820
|
import { type as type46 } from "arktype";
|
|
22572
22821
|
import { Project as Project10 } from "ts-morph";
|
|
22573
22822
|
var ForwardArgsType = type46({
|
|
@@ -22603,7 +22852,7 @@ async function run7(rawArgs) {
|
|
|
22603
22852
|
} catch (err) {
|
|
22604
22853
|
return toolError(toErrorMessage(err));
|
|
22605
22854
|
}
|
|
22606
|
-
const apiAbs =
|
|
22855
|
+
const apiAbs = resolve31(cwd, parsed.apiDir);
|
|
22607
22856
|
let extraction;
|
|
22608
22857
|
try {
|
|
22609
22858
|
extraction = await inspectAppFixtures(apiAbs, parsed.apiDir);
|
|
@@ -22619,7 +22868,7 @@ async function run7(rawArgs) {
|
|
|
22619
22868
|
if (rendered.added.length === 0) {
|
|
22620
22869
|
return { content: [{ type: "text", text: renderNoOpReport(extraction.fixturePath, entry.fixtureClassName, rendered) }] };
|
|
22621
22870
|
}
|
|
22622
|
-
const absolutePath =
|
|
22871
|
+
const absolutePath = join13(apiAbs, FIXTURE_RELATIVE_PATH);
|
|
22623
22872
|
const writeError = await applyForwardersToFile(absolutePath, entry.fixtureClassName, rendered);
|
|
22624
22873
|
if (writeError) {
|
|
22625
22874
|
return toolError(writeError);
|
|
@@ -22677,7 +22926,7 @@ function appendListSection(lines, heading, names) {
|
|
|
22677
22926
|
var modelFixtureForwardTool = { definition: TOOL8, run: run7 };
|
|
22678
22927
|
|
|
22679
22928
|
// packages/dbx-components-mcp/src/tools/model-test-tree.tool.ts
|
|
22680
|
-
import { resolve as
|
|
22929
|
+
import { resolve as resolve32 } from "node:path";
|
|
22681
22930
|
import { type as type47 } from "arktype";
|
|
22682
22931
|
|
|
22683
22932
|
// packages/dbx-components-mcp/src/tools/model-test-shared/extract.ts
|
|
@@ -23020,10 +23269,10 @@ function scanForDescribeOrIt(node) {
|
|
|
23020
23269
|
}
|
|
23021
23270
|
|
|
23022
23271
|
// packages/dbx-components-mcp/src/tools/model-test-shared/inspect.ts
|
|
23023
|
-
import { readFile as
|
|
23272
|
+
import { readFile as readFile13 } from "node:fs/promises";
|
|
23024
23273
|
async function inspectSpecFile(config) {
|
|
23025
23274
|
const { specAbs, specRel, apiAbs, apiRel } = config;
|
|
23026
|
-
const text = await
|
|
23275
|
+
const text = await readFile13(specAbs, "utf8");
|
|
23027
23276
|
let prefix;
|
|
23028
23277
|
let knownFixtureNames;
|
|
23029
23278
|
if (apiAbs !== void 0 && apiRel !== void 0) {
|
|
@@ -23499,8 +23748,8 @@ async function run8(rawArgs) {
|
|
|
23499
23748
|
} catch (err) {
|
|
23500
23749
|
return toolError(err instanceof Error ? err.message : String(err));
|
|
23501
23750
|
}
|
|
23502
|
-
const specAbs =
|
|
23503
|
-
const apiAbs = parsed.apiDir === void 0 ? void 0 :
|
|
23751
|
+
const specAbs = resolve32(cwd, parsed.specFile);
|
|
23752
|
+
const apiAbs = parsed.apiDir === void 0 ? void 0 : resolve32(cwd, parsed.apiDir);
|
|
23504
23753
|
let tree;
|
|
23505
23754
|
try {
|
|
23506
23755
|
tree = await inspectSpecFile({ specAbs, specRel: parsed.specFile, apiAbs, apiRel: parsed.apiDir });
|
|
@@ -23516,7 +23765,7 @@ async function run8(rawArgs) {
|
|
|
23516
23765
|
var modelTestTreeTool = { definition: TOOL9, run: run8 };
|
|
23517
23766
|
|
|
23518
23767
|
// packages/dbx-components-mcp/src/tools/model-test-search.tool.ts
|
|
23519
|
-
import { resolve as
|
|
23768
|
+
import { resolve as resolve33 } from "node:path";
|
|
23520
23769
|
import { type as type48 } from "arktype";
|
|
23521
23770
|
var SearchArgsType2 = type48({
|
|
23522
23771
|
specFile: "string",
|
|
@@ -23582,8 +23831,8 @@ async function run9(rawArgs) {
|
|
|
23582
23831
|
} catch (err) {
|
|
23583
23832
|
return toolError(err instanceof Error ? err.message : String(err));
|
|
23584
23833
|
}
|
|
23585
|
-
const specAbs =
|
|
23586
|
-
const apiAbs = parsed.apiDir === void 0 ? void 0 :
|
|
23834
|
+
const specAbs = resolve33(cwd, parsed.specFile);
|
|
23835
|
+
const apiAbs = parsed.apiDir === void 0 ? void 0 : resolve33(cwd, parsed.apiDir);
|
|
23587
23836
|
let tree;
|
|
23588
23837
|
try {
|
|
23589
23838
|
tree = await inspectSpecFile({ specAbs, specRel: parsed.specFile, apiAbs, apiRel: parsed.apiDir });
|
|
@@ -24734,8 +24983,8 @@ function formatResult4(result) {
|
|
|
24734
24983
|
}
|
|
24735
24984
|
|
|
24736
24985
|
// packages/dbx-components-mcp/src/tools/_validate/inspect.ts
|
|
24737
|
-
import { readdir as readdir7, readFile as
|
|
24738
|
-
import { join as
|
|
24986
|
+
import { readdir as readdir7, readFile as readFile14, stat as stat10 } from "node:fs/promises";
|
|
24987
|
+
import { join as join14, relative as relative9, sep as sep10 } from "node:path";
|
|
24739
24988
|
async function inspectSide(rootDir, subpaths) {
|
|
24740
24989
|
const rootStatus = await readRootStatus(rootDir);
|
|
24741
24990
|
if (rootStatus !== void 0) {
|
|
@@ -24745,8 +24994,8 @@ async function inspectSide(rootDir, subpaths) {
|
|
|
24745
24994
|
const presentFolders = [];
|
|
24746
24995
|
const collectedFiles = [];
|
|
24747
24996
|
for (const sub of subpaths) {
|
|
24748
|
-
const absFolder =
|
|
24749
|
-
const folderPresent = await
|
|
24997
|
+
const absFolder = join14(rootDir, sub);
|
|
24998
|
+
const folderPresent = await isDirectory2(absFolder);
|
|
24750
24999
|
if (!folderPresent) continue;
|
|
24751
25000
|
presentFolders.push(sub);
|
|
24752
25001
|
const collected = await collectTsFiles(absFolder, rootDir);
|
|
@@ -24761,7 +25010,7 @@ async function inspectSide(rootDir, subpaths) {
|
|
|
24761
25010
|
}
|
|
24762
25011
|
async function readRootStatus(rootDir) {
|
|
24763
25012
|
try {
|
|
24764
|
-
const stats = await
|
|
25013
|
+
const stats = await stat10(rootDir);
|
|
24765
25014
|
return stats.isDirectory() ? void 0 : "dir-not-found";
|
|
24766
25015
|
} catch (err) {
|
|
24767
25016
|
const code14 = err.code;
|
|
@@ -24771,9 +25020,9 @@ async function readRootStatus(rootDir) {
|
|
|
24771
25020
|
throw err;
|
|
24772
25021
|
}
|
|
24773
25022
|
}
|
|
24774
|
-
async function
|
|
25023
|
+
async function isDirectory2(absPath) {
|
|
24775
25024
|
try {
|
|
24776
|
-
const stats = await
|
|
25025
|
+
const stats = await stat10(absPath);
|
|
24777
25026
|
return stats.isDirectory();
|
|
24778
25027
|
} catch {
|
|
24779
25028
|
return false;
|
|
@@ -24791,7 +25040,7 @@ async function collectTsFiles(absFolder, rootDir) {
|
|
|
24791
25040
|
continue;
|
|
24792
25041
|
}
|
|
24793
25042
|
for (const entry of entries) {
|
|
24794
|
-
const full =
|
|
25043
|
+
const full = join14(current, entry.name);
|
|
24795
25044
|
if (entry.isDirectory()) {
|
|
24796
25045
|
stack.push(full);
|
|
24797
25046
|
continue;
|
|
@@ -24800,8 +25049,8 @@ async function collectTsFiles(absFolder, rootDir) {
|
|
|
24800
25049
|
if (!entry.name.endsWith(".ts")) continue;
|
|
24801
25050
|
if (entry.name.endsWith(".spec.ts")) continue;
|
|
24802
25051
|
if (entry.name.endsWith(".d.ts")) continue;
|
|
24803
|
-
const text = await
|
|
24804
|
-
const rel =
|
|
25052
|
+
const text = await readFile14(full, "utf8");
|
|
25053
|
+
const rel = relative9(rootDir, full).split(sep10).join("/");
|
|
24805
25054
|
out.push({ relPath: rel, text });
|
|
24806
25055
|
}
|
|
24807
25056
|
}
|
|
@@ -25053,8 +25302,8 @@ var storageFileMListAppTool = createListAppTool({
|
|
|
25053
25302
|
});
|
|
25054
25303
|
|
|
25055
25304
|
// packages/dbx-components-mcp/src/tools/validate-two-side-folder.ts
|
|
25056
|
-
import { readdir as readdir8, readFile as
|
|
25057
|
-
import { join as
|
|
25305
|
+
import { readdir as readdir8, readFile as readFile15, stat as stat11 } from "node:fs/promises";
|
|
25306
|
+
import { join as join15 } from "node:path";
|
|
25058
25307
|
var REEXPORT_PATTERN = /^\s*export\s+\*\s+from\s+['"]\.\/([^'"\n]+)['"]\s*;?\s*$/gm;
|
|
25059
25308
|
// @__NO_SIDE_EFFECTS__
|
|
25060
25309
|
function createTwoSideFolderValidator(config) {
|
|
@@ -25099,7 +25348,7 @@ async function inspectSide2(input) {
|
|
|
25099
25348
|
let indexSource;
|
|
25100
25349
|
const rootStatOk = await isExistingDirectory(rootDir);
|
|
25101
25350
|
if (rootStatOk) {
|
|
25102
|
-
const absFolder =
|
|
25351
|
+
const absFolder = join15(rootDir, subPath);
|
|
25103
25352
|
const folderStatOk = await isExistingDirectory(absFolder);
|
|
25104
25353
|
if (folderStatOk) {
|
|
25105
25354
|
const folder = await readFolder(absFolder, indexFile);
|
|
@@ -25125,7 +25374,7 @@ async function inspectSide2(input) {
|
|
|
25125
25374
|
}
|
|
25126
25375
|
async function isExistingDirectory(path) {
|
|
25127
25376
|
try {
|
|
25128
|
-
const stats = await
|
|
25377
|
+
const stats = await stat11(path);
|
|
25129
25378
|
return stats.isDirectory();
|
|
25130
25379
|
} catch (err) {
|
|
25131
25380
|
const code14 = err.code;
|
|
@@ -25151,7 +25400,7 @@ async function readFolder(absFolder, indexFile) {
|
|
|
25151
25400
|
let indexSource;
|
|
25152
25401
|
if (collectedFiles.includes(indexFile)) {
|
|
25153
25402
|
try {
|
|
25154
|
-
indexSource = await
|
|
25403
|
+
indexSource = await readFile15(join15(absFolder, indexFile), "utf8");
|
|
25155
25404
|
} catch {
|
|
25156
25405
|
indexSource = void 0;
|
|
25157
25406
|
}
|
|
@@ -26876,15 +27125,15 @@ function formatResult8(result) {
|
|
|
26876
27125
|
}
|
|
26877
27126
|
|
|
26878
27127
|
// 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
|
|
27128
|
+
import { readdir as readdir9, readFile as readFile16, stat as stat12 } from "node:fs/promises";
|
|
27129
|
+
import { basename as basename5, join as join16 } from "node:path";
|
|
26881
27130
|
async function inspectFolder2(path) {
|
|
26882
27131
|
const name = basename5(path);
|
|
26883
27132
|
let status;
|
|
26884
27133
|
let files = [];
|
|
26885
27134
|
let systemSource;
|
|
26886
27135
|
try {
|
|
26887
|
-
const stats = await
|
|
27136
|
+
const stats = await stat12(path);
|
|
26888
27137
|
if (stats.isDirectory()) {
|
|
26889
27138
|
status = "ok";
|
|
26890
27139
|
const entries = await readdir9(path, { withFileTypes: true });
|
|
@@ -26897,7 +27146,7 @@ async function inspectFolder2(path) {
|
|
|
26897
27146
|
files = collected;
|
|
26898
27147
|
if (collected.includes("system.ts")) {
|
|
26899
27148
|
try {
|
|
26900
|
-
systemSource = await
|
|
27149
|
+
systemSource = await readFile16(join16(path, "system.ts"), "utf8");
|
|
26901
27150
|
} catch {
|
|
26902
27151
|
systemSource = void 0;
|
|
26903
27152
|
}
|
|
@@ -27852,9 +28101,9 @@ function formatResult9(result) {
|
|
|
27852
28101
|
}
|
|
27853
28102
|
|
|
27854
28103
|
// 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
|
|
28104
|
+
import { readdir as readdir10, readFile as readFile17, stat as stat13 } from "node:fs/promises";
|
|
28105
|
+
import { join as join17, relative as relative10, sep as sep11 } from "node:path";
|
|
28106
|
+
var COMPONENT_LIB_SUBPATH2 = "src/lib";
|
|
27858
28107
|
var APP_ROOT_CONFIG_RELPATH = "src/root.app.config.ts";
|
|
27859
28108
|
var APP_ASSETS_SUBPATH = "src/assets";
|
|
27860
28109
|
async function inspectAppAssets(componentDir, appDir) {
|
|
@@ -27872,7 +28121,7 @@ async function inspectAppAssets(componentDir, appDir) {
|
|
|
27872
28121
|
async function inspectComponentLib(rootDir) {
|
|
27873
28122
|
let rootStats;
|
|
27874
28123
|
try {
|
|
27875
|
-
rootStats = await
|
|
28124
|
+
rootStats = await stat13(rootDir);
|
|
27876
28125
|
} catch (err) {
|
|
27877
28126
|
const code14 = err.code;
|
|
27878
28127
|
if (code14 === "ENOENT" || code14 === "ENOTDIR") {
|
|
@@ -27883,26 +28132,26 @@ async function inspectComponentLib(rootDir) {
|
|
|
27883
28132
|
if (!rootStats.isDirectory()) {
|
|
27884
28133
|
return { rootDir, folder: void 0, status: "dir-not-found", files: [] };
|
|
27885
28134
|
}
|
|
27886
|
-
const libDir =
|
|
27887
|
-
const libExists = await
|
|
28135
|
+
const libDir = join17(rootDir, COMPONENT_LIB_SUBPATH2);
|
|
28136
|
+
const libExists = await isDirectory3(libDir);
|
|
27888
28137
|
if (!libExists) {
|
|
27889
28138
|
return { rootDir, folder: void 0, status: "folder-missing", files: [] };
|
|
27890
28139
|
}
|
|
27891
28140
|
const files = [];
|
|
27892
28141
|
for (const name of ["assets.ts", "index.ts"]) {
|
|
27893
|
-
const abs =
|
|
28142
|
+
const abs = join17(libDir, name);
|
|
27894
28143
|
const text = await readFileIfExists(abs);
|
|
27895
28144
|
if (text !== void 0) {
|
|
27896
|
-
const rel =
|
|
28145
|
+
const rel = relative10(rootDir, abs).split(sep11).join("/");
|
|
27897
28146
|
files.push({ relPath: rel, text });
|
|
27898
28147
|
}
|
|
27899
28148
|
}
|
|
27900
28149
|
files.sort((a, b) => a.relPath.localeCompare(b.relPath));
|
|
27901
|
-
return { rootDir, folder:
|
|
28150
|
+
return { rootDir, folder: COMPONENT_LIB_SUBPATH2, status: "ok", files };
|
|
27902
28151
|
}
|
|
27903
28152
|
async function readAppRootStatus(appDir) {
|
|
27904
28153
|
try {
|
|
27905
|
-
const stats = await
|
|
28154
|
+
const stats = await stat13(appDir);
|
|
27906
28155
|
return stats.isDirectory() ? "ok" : "dir-not-found";
|
|
27907
28156
|
} catch (err) {
|
|
27908
28157
|
const code14 = err.code;
|
|
@@ -27913,16 +28162,16 @@ async function readAppRootStatus(appDir) {
|
|
|
27913
28162
|
}
|
|
27914
28163
|
}
|
|
27915
28164
|
async function readAppWiring(appDir) {
|
|
27916
|
-
const rootConfigText = await readFileIfExists(
|
|
27917
|
-
const assetsDir =
|
|
27918
|
-
const assetsDirExists = await
|
|
28165
|
+
const rootConfigText = await readFileIfExists(join17(appDir, APP_ROOT_CONFIG_RELPATH));
|
|
28166
|
+
const assetsDir = join17(appDir, APP_ASSETS_SUBPATH);
|
|
28167
|
+
const assetsDirExists = await isDirectory3(assetsDir);
|
|
27919
28168
|
const assetFiles = assetsDirExists ? await collectFilesUnder(assetsDir) : /* @__PURE__ */ new Set();
|
|
27920
28169
|
const result = { rootConfigText, assetFiles };
|
|
27921
28170
|
return result;
|
|
27922
28171
|
}
|
|
27923
|
-
async function
|
|
28172
|
+
async function isDirectory3(absPath) {
|
|
27924
28173
|
try {
|
|
27925
|
-
const stats = await
|
|
28174
|
+
const stats = await stat13(absPath);
|
|
27926
28175
|
return stats.isDirectory();
|
|
27927
28176
|
} catch {
|
|
27928
28177
|
return false;
|
|
@@ -27930,7 +28179,7 @@ async function isDirectory2(absPath) {
|
|
|
27930
28179
|
}
|
|
27931
28180
|
async function readFileIfExists(absPath) {
|
|
27932
28181
|
try {
|
|
27933
|
-
return await
|
|
28182
|
+
return await readFile17(absPath, "utf8");
|
|
27934
28183
|
} catch (err) {
|
|
27935
28184
|
const code14 = err.code;
|
|
27936
28185
|
if (code14 === "ENOENT" || code14 === "ENOTDIR" || code14 === "EISDIR") {
|
|
@@ -27951,13 +28200,13 @@ async function collectFilesUnder(absRoot) {
|
|
|
27951
28200
|
continue;
|
|
27952
28201
|
}
|
|
27953
28202
|
for (const entry of entries) {
|
|
27954
|
-
const full =
|
|
28203
|
+
const full = join17(current, entry.name);
|
|
27955
28204
|
if (entry.isDirectory()) {
|
|
27956
28205
|
stack.push(full);
|
|
27957
28206
|
continue;
|
|
27958
28207
|
}
|
|
27959
28208
|
if (!entry.isFile()) continue;
|
|
27960
|
-
const rel =
|
|
28209
|
+
const rel = relative10(absRoot, full).split(sep11).join("/");
|
|
27961
28210
|
out.add(rel);
|
|
27962
28211
|
}
|
|
27963
28212
|
}
|
|
@@ -29476,8 +29725,8 @@ var actionScaffoldTool = {
|
|
|
29476
29725
|
import { type as type54 } from "arktype";
|
|
29477
29726
|
|
|
29478
29727
|
// packages/dbx-components-mcp/src/tools/route/load-sources.ts
|
|
29479
|
-
import { glob as fsGlob5, readFile as
|
|
29480
|
-
import { dirname as
|
|
29728
|
+
import { glob as fsGlob5, readFile as readFile18, stat as stat14 } from "node:fs/promises";
|
|
29729
|
+
import { dirname as dirname13, isAbsolute as isAbsolute13, resolve as resolve34, sep as sep12 } from "node:path";
|
|
29481
29730
|
|
|
29482
29731
|
// packages/dbx-components-mcp/src/tools/route/extract.ts
|
|
29483
29732
|
import { Node as Node21, Project as Project15, SyntaxKind as SyntaxKind12 } from "ts-morph";
|
|
@@ -29792,7 +30041,7 @@ function computeRelativeSpecifiers(source) {
|
|
|
29792
30041
|
// packages/dbx-components-mcp/src/tools/route/load-sources.ts
|
|
29793
30042
|
var TRY_EXTENSIONS = [".ts", ".tsx", "/index.ts", "/index.tsx"];
|
|
29794
30043
|
async function loadRouteSources(args) {
|
|
29795
|
-
const cwdResolved = args.cwd ?
|
|
30044
|
+
const cwdResolved = args.cwd ? resolve34(process.cwd(), args.cwd) : process.cwd();
|
|
29796
30045
|
guardCwdInsideServer(args.cwd, cwdResolved);
|
|
29797
30046
|
const collected = /* @__PURE__ */ new Map();
|
|
29798
30047
|
if (args.sources) {
|
|
@@ -29803,8 +30052,8 @@ async function loadRouteSources(args) {
|
|
|
29803
30052
|
}
|
|
29804
30053
|
}
|
|
29805
30054
|
const initialPaths = await collectInitialPaths(args, cwdResolved);
|
|
29806
|
-
for (const
|
|
29807
|
-
await loadOne(
|
|
30055
|
+
for (const relative15 of initialPaths) {
|
|
30056
|
+
await loadOne(relative15, cwdResolved, collected);
|
|
29808
30057
|
}
|
|
29809
30058
|
if (args.walkImports) {
|
|
29810
30059
|
await walkRelativeImports(collected, cwdResolved);
|
|
@@ -29820,7 +30069,7 @@ function guardCwdInsideServer(requestedCwd, resolvedCwd) {
|
|
|
29820
30069
|
return;
|
|
29821
30070
|
}
|
|
29822
30071
|
const serverCwd = process.cwd();
|
|
29823
|
-
const cwdPrefix = serverCwd.endsWith(
|
|
30072
|
+
const cwdPrefix = serverCwd.endsWith(sep12) ? serverCwd : serverCwd + sep12;
|
|
29824
30073
|
if (!resolvedCwd.startsWith(cwdPrefix) && resolvedCwd !== serverCwd) {
|
|
29825
30074
|
throw new Error(`cwd \`${requestedCwd}\` resolves outside the server cwd and is not allowed.`);
|
|
29826
30075
|
}
|
|
@@ -29860,26 +30109,26 @@ async function walkRelativeImports(collected, cwdResolved) {
|
|
|
29860
30109
|
}
|
|
29861
30110
|
}
|
|
29862
30111
|
}
|
|
29863
|
-
async function loadOne(
|
|
29864
|
-
if (into.has(
|
|
30112
|
+
async function loadOne(relative15, cwd, into) {
|
|
30113
|
+
if (into.has(relative15)) {
|
|
29865
30114
|
return;
|
|
29866
30115
|
}
|
|
29867
|
-
const absolute =
|
|
29868
|
-
const cwdPrefix = cwd.endsWith(
|
|
30116
|
+
const absolute = resolve34(cwd, relative15);
|
|
30117
|
+
const cwdPrefix = cwd.endsWith(sep12) ? cwd : cwd + sep12;
|
|
29869
30118
|
if (!absolute.startsWith(cwdPrefix) && absolute !== cwd) {
|
|
29870
|
-
throw new Error(`Path \`${
|
|
30119
|
+
throw new Error(`Path \`${relative15}\` resolves outside the server cwd and is not allowed.`);
|
|
29871
30120
|
}
|
|
29872
|
-
const text = await
|
|
29873
|
-
into.set(
|
|
30121
|
+
const text = await readFile18(absolute, "utf8");
|
|
30122
|
+
into.set(relative15, { name: relative15, text });
|
|
29874
30123
|
}
|
|
29875
30124
|
async function resolveRelativeImport(fromFile, specifier, cwd) {
|
|
29876
30125
|
if (!specifier.startsWith(".")) {
|
|
29877
30126
|
return void 0;
|
|
29878
30127
|
}
|
|
29879
|
-
const fromAbsolute =
|
|
29880
|
-
const fromDir =
|
|
29881
|
-
const baseAbsolute =
|
|
29882
|
-
const cwdPrefix = cwd.endsWith(
|
|
30128
|
+
const fromAbsolute = isAbsolute13(fromFile) ? fromFile : resolve34(cwd, fromFile);
|
|
30129
|
+
const fromDir = dirname13(fromAbsolute);
|
|
30130
|
+
const baseAbsolute = resolve34(fromDir, specifier);
|
|
30131
|
+
const cwdPrefix = cwd.endsWith(sep12) ? cwd : cwd + sep12;
|
|
29883
30132
|
for (const ext of TRY_EXTENSIONS) {
|
|
29884
30133
|
const candidateAbsolute = baseAbsolute + ext;
|
|
29885
30134
|
if (!candidateAbsolute.startsWith(cwdPrefix) && candidateAbsolute !== cwd) {
|
|
@@ -29889,7 +30138,7 @@ async function resolveRelativeImport(fromFile, specifier, cwd) {
|
|
|
29889
30138
|
if (!exists) {
|
|
29890
30139
|
continue;
|
|
29891
30140
|
}
|
|
29892
|
-
const text = await
|
|
30141
|
+
const text = await readFile18(candidateAbsolute, "utf8");
|
|
29893
30142
|
const relativeName = candidateAbsolute.startsWith(cwdPrefix) ? candidateAbsolute.slice(cwdPrefix.length) : candidateAbsolute;
|
|
29894
30143
|
const result = { name: relativeName, text };
|
|
29895
30144
|
return result;
|
|
@@ -29898,7 +30147,7 @@ async function resolveRelativeImport(fromFile, specifier, cwd) {
|
|
|
29898
30147
|
}
|
|
29899
30148
|
async function fileExists(path) {
|
|
29900
30149
|
try {
|
|
29901
|
-
const info = await
|
|
30150
|
+
const info = await stat14(path);
|
|
29902
30151
|
return info.isFile();
|
|
29903
30152
|
} catch {
|
|
29904
30153
|
return false;
|
|
@@ -30966,7 +31215,7 @@ function renderPresetConstants(args) {
|
|
|
30966
31215
|
const modelCamel = camelCase4(args.modelName);
|
|
30967
31216
|
for (const key of args.presetKeys) {
|
|
30968
31217
|
const constName = presetConstName(modelCamel, key);
|
|
30969
|
-
lines.push(`export const ${constName}: ClickableFilterPreset<${args.filterType}> = {`, ` preset: '${key}',`, ` title: '${
|
|
31218
|
+
lines.push(`export const ${constName}: ClickableFilterPreset<${args.filterType}> = {`, ` preset: '${key}',`, ` title: '${capitalize4(key)}',`, ` presetValue: { preset: '${key}' }`, `};`, "");
|
|
30970
31219
|
}
|
|
30971
31220
|
const arrayName = `${modelCamel}FilterPresets`;
|
|
30972
31221
|
const elements = args.presetKeys.map((k) => presetConstName(modelCamel, k)).join(", ");
|
|
@@ -31015,7 +31264,7 @@ function renderImports(args) {
|
|
|
31015
31264
|
}
|
|
31016
31265
|
return imports;
|
|
31017
31266
|
}
|
|
31018
|
-
function
|
|
31267
|
+
function capitalize4(value) {
|
|
31019
31268
|
if (value.length === 0) {
|
|
31020
31269
|
return value;
|
|
31021
31270
|
}
|
|
@@ -31806,8 +32055,8 @@ function createSearchModelSnapshotFieldTool(config) {
|
|
|
31806
32055
|
}
|
|
31807
32056
|
|
|
31808
32057
|
// packages/dbx-components-mcp/src/tools/list-app-model-snapshot-fields.tool.ts
|
|
31809
|
-
import { glob, readFile as
|
|
31810
|
-
import { resolve as
|
|
32058
|
+
import { glob, readFile as readFile19 } from "node:fs/promises";
|
|
32059
|
+
import { resolve as resolve35 } from "node:path";
|
|
31811
32060
|
import { type as type59 } from "arktype";
|
|
31812
32061
|
import { Node as Node22, Project as Project16 } from "ts-morph";
|
|
31813
32062
|
var ListAppArgsType2 = type59({
|
|
@@ -31856,8 +32105,8 @@ function createListAppModelSnapshotFieldsTool(input) {
|
|
|
31856
32105
|
} catch (err) {
|
|
31857
32106
|
return toolError(err instanceof Error ? err.message : String(err));
|
|
31858
32107
|
}
|
|
31859
|
-
const componentAbs =
|
|
31860
|
-
const apiAbs = parsed.apiDir === void 0 ? void 0 :
|
|
32108
|
+
const componentAbs = resolve35(cwd, parsed.componentDir);
|
|
32109
|
+
const apiAbs = parsed.apiDir === void 0 ? void 0 : resolve35(cwd, parsed.apiDir);
|
|
31861
32110
|
let report;
|
|
31862
32111
|
try {
|
|
31863
32112
|
report = await buildListAppReport({
|
|
@@ -31896,15 +32145,15 @@ async function buildListAppReport(input) {
|
|
|
31896
32145
|
const project = new Project16({ useInMemoryFileSystem: true, skipAddingFilesFromTsConfig: true });
|
|
31897
32146
|
const componentFiles = await collectFiles(componentAbs, COMPONENT_MODEL_GLOBS);
|
|
31898
32147
|
for (const rel of componentFiles) {
|
|
31899
|
-
const abs =
|
|
31900
|
-
const text = await
|
|
32148
|
+
const abs = resolve35(componentAbs, rel);
|
|
32149
|
+
const text = await readFile19(abs, "utf-8");
|
|
31901
32150
|
project.createSourceFile(`/component/${rel}`, text, { overwrite: true });
|
|
31902
32151
|
}
|
|
31903
32152
|
if (apiAbs !== void 0) {
|
|
31904
32153
|
const apiFiles = await collectFiles(apiAbs, API_MODEL_GLOBS);
|
|
31905
32154
|
for (const rel of apiFiles) {
|
|
31906
|
-
const abs =
|
|
31907
|
-
const text = await
|
|
32155
|
+
const abs = resolve35(apiAbs, rel);
|
|
32156
|
+
const text = await readFile19(abs, "utf-8");
|
|
31908
32157
|
project.createSourceFile(`/api/${rel}`, text, { overwrite: true });
|
|
31909
32158
|
}
|
|
31910
32159
|
}
|
|
@@ -32084,7 +32333,7 @@ function truncate(text, max) {
|
|
|
32084
32333
|
|
|
32085
32334
|
// packages/dbx-components-mcp/src/tools/artifact-scaffold.tool.ts
|
|
32086
32335
|
import { access } from "node:fs/promises";
|
|
32087
|
-
import { resolve as
|
|
32336
|
+
import { resolve as resolve36, sep as sep13 } from "node:path";
|
|
32088
32337
|
import { type as type60 } from "arktype";
|
|
32089
32338
|
|
|
32090
32339
|
// packages/dbx-components-mcp/src/tools/artifact-scaffold/templates.ts
|
|
@@ -32660,8 +32909,8 @@ function parseArgs8(raw) {
|
|
|
32660
32909
|
return result;
|
|
32661
32910
|
}
|
|
32662
32911
|
function ensureInsideCwd(relativePath, cwd) {
|
|
32663
|
-
const absolute =
|
|
32664
|
-
const cwdPrefix = cwd.endsWith(
|
|
32912
|
+
const absolute = resolve36(cwd, relativePath);
|
|
32913
|
+
const cwdPrefix = cwd.endsWith(sep13) ? cwd : cwd + sep13;
|
|
32665
32914
|
if (!absolute.startsWith(cwdPrefix) && absolute !== cwd) {
|
|
32666
32915
|
throw new Error(`Path \`${relativePath}\` resolves outside the server cwd and is not allowed.`);
|
|
32667
32916
|
}
|
|
@@ -32700,7 +32949,7 @@ async function runArtifactScaffold(rawArgs) {
|
|
|
32700
32949
|
const message = err instanceof Error ? err.message : String(err);
|
|
32701
32950
|
return toolError(`Scaffold failed: ${message}`);
|
|
32702
32951
|
}
|
|
32703
|
-
const checked = await applyIdempotency(raw, (relativePath) => fileExists2(
|
|
32952
|
+
const checked = await applyIdempotency(raw, (relativePath) => fileExists2(resolve36(cwd, relativePath)));
|
|
32704
32953
|
const text = formatResult11(checked);
|
|
32705
32954
|
const result = {
|
|
32706
32955
|
content: [{ type: "text", text }]
|
|
@@ -33245,8 +33494,8 @@ async function run10(rawArgs) {
|
|
|
33245
33494
|
var explainRuleTool = { definition: TOOL11, run: run10 };
|
|
33246
33495
|
|
|
33247
33496
|
// packages/dbx-components-mcp/src/tools/app-validate.tool.ts
|
|
33248
|
-
import { resolve as
|
|
33249
|
-
import { readdir as readdir11, stat as
|
|
33497
|
+
import { resolve as resolve37, join as join18 } from "node:path";
|
|
33498
|
+
import { readdir as readdir11, stat as stat15 } from "node:fs/promises";
|
|
33250
33499
|
import { type as type63 } from "arktype";
|
|
33251
33500
|
var Cluster = "'storagefile_m' | 'notification_m' | 'model_folder' | 'system_m' | 'fixture'";
|
|
33252
33501
|
var AppValidateArgsType = type63({
|
|
@@ -33299,8 +33548,8 @@ async function run11(rawArgs) {
|
|
|
33299
33548
|
} catch (err) {
|
|
33300
33549
|
return toolError(err instanceof Error ? err.message : String(err));
|
|
33301
33550
|
}
|
|
33302
|
-
const componentAbs =
|
|
33303
|
-
const apiAbs =
|
|
33551
|
+
const componentAbs = resolve37(cwd, parsed.componentDir);
|
|
33552
|
+
const apiAbs = resolve37(cwd, parsed.apiDir);
|
|
33304
33553
|
const skip = new Set(parsed.skip ?? []);
|
|
33305
33554
|
const findings = [];
|
|
33306
33555
|
const skipped = [];
|
|
@@ -33372,7 +33621,7 @@ async function runModelFolders(ctx) {
|
|
|
33372
33621
|
return;
|
|
33373
33622
|
}
|
|
33374
33623
|
try {
|
|
33375
|
-
const modelRoot =
|
|
33624
|
+
const modelRoot = join18(ctx.componentAbs, "src/lib/model");
|
|
33376
33625
|
const reservedNames = new Set(RESERVED_MODEL_FOLDERS.map((r) => r.name));
|
|
33377
33626
|
let entries;
|
|
33378
33627
|
try {
|
|
@@ -33389,7 +33638,7 @@ async function runModelFolders(ctx) {
|
|
|
33389
33638
|
for (const entry of entries) {
|
|
33390
33639
|
if (!entry.isDirectory()) continue;
|
|
33391
33640
|
if (reservedNames.has(entry.name)) continue;
|
|
33392
|
-
const inspection = await inspectFolder(
|
|
33641
|
+
const inspection = await inspectFolder(join18(modelRoot, entry.name));
|
|
33393
33642
|
inspections.push(inspection);
|
|
33394
33643
|
}
|
|
33395
33644
|
if (inspections.length === 0) {
|
|
@@ -33409,11 +33658,11 @@ async function runSystemFolder(ctx) {
|
|
|
33409
33658
|
ctx.skipped.push("system_m");
|
|
33410
33659
|
return;
|
|
33411
33660
|
}
|
|
33412
|
-
const systemPath =
|
|
33661
|
+
const systemPath = join18(ctx.componentAbs, "src/lib/model/system");
|
|
33413
33662
|
try {
|
|
33414
33663
|
let exists = true;
|
|
33415
33664
|
try {
|
|
33416
|
-
const stats = await
|
|
33665
|
+
const stats = await stat15(systemPath);
|
|
33417
33666
|
if (!stats.isDirectory()) exists = false;
|
|
33418
33667
|
} catch (err) {
|
|
33419
33668
|
const code14 = err.code;
|
|
@@ -33494,18 +33743,18 @@ function formatJson(report) {
|
|
|
33494
33743
|
var appValidateTool = { definition: TOOL12, run: run11 };
|
|
33495
33744
|
|
|
33496
33745
|
// packages/dbx-components-mcp/src/tools/model-list-component.tool.ts
|
|
33497
|
-
import { resolve as
|
|
33746
|
+
import { resolve as resolve38 } from "node:path";
|
|
33498
33747
|
import { type as type64 } from "arktype";
|
|
33499
33748
|
|
|
33500
33749
|
// 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
|
|
33750
|
+
import { readdir as readdir12, readFile as readFile20, stat as stat16 } from "node:fs/promises";
|
|
33751
|
+
import { basename as basename6, join as join19, relative as relative11, sep as sep14 } from "node:path";
|
|
33503
33752
|
import { Node as Node23, Project as Project17 } from "ts-morph";
|
|
33504
33753
|
var MODEL_SUBPATH3 = "src/lib/model";
|
|
33505
33754
|
var MODEL_SUBPATH_PREFIX = `${MODEL_SUBPATH3}/`;
|
|
33506
33755
|
var RESERVED_NAMES = RESERVED_MODEL_FOLDERS.map((r) => r.name);
|
|
33507
33756
|
async function extractComponentModels(componentAbs) {
|
|
33508
|
-
const modelRoot =
|
|
33757
|
+
const modelRoot = join19(componentAbs, MODEL_SUBPATH3);
|
|
33509
33758
|
const folders = await listFolders(modelRoot);
|
|
33510
33759
|
if (folders === void 0) {
|
|
33511
33760
|
const result2 = { modelRoot, models: [], skipped: [], unidentifiedFolders: [] };
|
|
@@ -33595,13 +33844,13 @@ function projectRich(model, folder) {
|
|
|
33595
33844
|
}
|
|
33596
33845
|
async function fallbackForFolder(input) {
|
|
33597
33846
|
const { modelRoot, componentAbs, folder, project } = input;
|
|
33598
|
-
const folderAbs =
|
|
33847
|
+
const folderAbs = join19(modelRoot, folder);
|
|
33599
33848
|
const mainFile = await readMainFile(folderAbs, folder);
|
|
33600
33849
|
if (mainFile === void 0) return void 0;
|
|
33601
33850
|
const sourceFile = project.createSourceFile(mainFile.fileName, mainFile.text, { overwrite: true });
|
|
33602
33851
|
const identity = findIdentityIn(sourceFile);
|
|
33603
33852
|
if (!identity) return void 0;
|
|
33604
|
-
const sourceFileRel =
|
|
33853
|
+
const sourceFileRel = relative11(componentAbs, mainFile.absPath).split(sep14).join("/");
|
|
33605
33854
|
return {
|
|
33606
33855
|
folder,
|
|
33607
33856
|
modelName: deriveModelName(identity.constName, folder),
|
|
@@ -33615,7 +33864,7 @@ async function fallbackForFolder(input) {
|
|
|
33615
33864
|
}
|
|
33616
33865
|
async function listFolders(modelRoot) {
|
|
33617
33866
|
try {
|
|
33618
|
-
const stats = await
|
|
33867
|
+
const stats = await stat16(modelRoot);
|
|
33619
33868
|
if (!stats.isDirectory()) return void 0;
|
|
33620
33869
|
} catch {
|
|
33621
33870
|
return void 0;
|
|
@@ -33629,9 +33878,9 @@ async function listFolders(modelRoot) {
|
|
|
33629
33878
|
return out;
|
|
33630
33879
|
}
|
|
33631
33880
|
async function readMainFile(folderAbs, folder) {
|
|
33632
|
-
const candidate =
|
|
33881
|
+
const candidate = join19(folderAbs, `${folder}.ts`);
|
|
33633
33882
|
try {
|
|
33634
|
-
const text = await
|
|
33883
|
+
const text = await readFile20(candidate, "utf8");
|
|
33635
33884
|
return { absPath: candidate, fileName: basename6(candidate), text };
|
|
33636
33885
|
} catch {
|
|
33637
33886
|
return void 0;
|
|
@@ -33808,8 +34057,8 @@ async function run12(rawArgs) {
|
|
|
33808
34057
|
} catch (err) {
|
|
33809
34058
|
return toolError(err instanceof Error ? err.message : String(err));
|
|
33810
34059
|
}
|
|
33811
|
-
const componentAbs =
|
|
33812
|
-
const apiAbs = parsed.apiDir ?
|
|
34060
|
+
const componentAbs = resolve38(cwd, parsed.componentDir);
|
|
34061
|
+
const apiAbs = parsed.apiDir ? resolve38(cwd, parsed.apiDir) : void 0;
|
|
33813
34062
|
let report;
|
|
33814
34063
|
try {
|
|
33815
34064
|
report = await listComponentModels(componentAbs, { componentDir: parsed.componentDir, apiDir: parsed.apiDir, apiAbs });
|
|
@@ -33823,18 +34072,18 @@ async function run12(rawArgs) {
|
|
|
33823
34072
|
var modelListComponentTool = { definition: TOOL13, run: run12 };
|
|
33824
34073
|
|
|
33825
34074
|
// packages/dbx-components-mcp/src/tools/server-actions-list-app.tool.ts
|
|
33826
|
-
import { resolve as
|
|
34075
|
+
import { resolve as resolve39 } from "node:path";
|
|
33827
34076
|
import { type as type65 } from "arktype";
|
|
33828
34077
|
|
|
33829
34078
|
// packages/dbx-components-mcp/src/tools/server-actions-list-app/extract.ts
|
|
33830
|
-
import { readdir as readdir13, readFile as
|
|
33831
|
-
import { dirname as
|
|
34079
|
+
import { readdir as readdir13, readFile as readFile21, stat as stat17 } from "node:fs/promises";
|
|
34080
|
+
import { dirname as dirname14, join as join20, relative as relative12, sep as sep15 } from "node:path";
|
|
33832
34081
|
import { Node as Node24, Project as Project18 } from "ts-morph";
|
|
33833
34082
|
var ACTION_SERVER_SUFFIX2 = ".action.server.ts";
|
|
33834
34083
|
var COMMON_MODEL_SUBPATH2 = "src/app/common/model";
|
|
33835
34084
|
var COMMON_BARREL_REL = "src/app/common/index.ts";
|
|
33836
34085
|
async function extractServerActions(apiAbs, apiRel) {
|
|
33837
|
-
const modelRoot =
|
|
34086
|
+
const modelRoot = join20(apiAbs, COMMON_MODEL_SUBPATH2);
|
|
33838
34087
|
const actionFiles = await collectActionFiles2(modelRoot);
|
|
33839
34088
|
if (actionFiles.length === 0) {
|
|
33840
34089
|
return { modelRoot, entries: [], fixtureStatus: "ok" };
|
|
@@ -33854,14 +34103,14 @@ async function extractServerActions(apiAbs, apiRel) {
|
|
|
33854
34103
|
}
|
|
33855
34104
|
const entries = [];
|
|
33856
34105
|
for (const filePath of actionFiles) {
|
|
33857
|
-
const text = await
|
|
34106
|
+
const text = await readFile21(filePath, "utf8");
|
|
33858
34107
|
const sourceFile = project.createSourceFile(filePath, text, { overwrite: true });
|
|
33859
34108
|
const classes = findServerActionClasses(sourceFile);
|
|
33860
34109
|
for (const className of classes) {
|
|
33861
34110
|
const wiring = await inspectSiblingModule(filePath, className);
|
|
33862
34111
|
const expectedGetterName = camelize(className);
|
|
33863
34112
|
const fixtureCoverage = fixtureStatus === "ok" ? fixtureCoverageMap.get(expectedGetterName) ?? unmatchedFixtureCoverage(expectedGetterName) : void 0;
|
|
33864
|
-
const sourceFileRel =
|
|
34113
|
+
const sourceFileRel = relative12(apiAbs, filePath).split(sep15).join("/");
|
|
33865
34114
|
entries.push({
|
|
33866
34115
|
className,
|
|
33867
34116
|
sourceFile: sourceFileRel,
|
|
@@ -33879,7 +34128,7 @@ async function collectActionFiles2(root) {
|
|
|
33879
34128
|
const out = [];
|
|
33880
34129
|
const stack = [];
|
|
33881
34130
|
try {
|
|
33882
|
-
const stats = await
|
|
34131
|
+
const stats = await stat17(root);
|
|
33883
34132
|
if (!stats.isDirectory()) return out;
|
|
33884
34133
|
stack.push(root);
|
|
33885
34134
|
} catch {
|
|
@@ -33894,7 +34143,7 @@ async function collectActionFiles2(root) {
|
|
|
33894
34143
|
continue;
|
|
33895
34144
|
}
|
|
33896
34145
|
for (const entry of entries) {
|
|
33897
|
-
const full =
|
|
34146
|
+
const full = join20(current, entry.name);
|
|
33898
34147
|
if (entry.isDirectory()) {
|
|
33899
34148
|
stack.push(full);
|
|
33900
34149
|
continue;
|
|
@@ -33936,14 +34185,14 @@ async function inspectSiblingModule(actionFilePath, className) {
|
|
|
33936
34185
|
return { modulePath: moduleCandidates[0], providedByModule: false, exportedByModule: false };
|
|
33937
34186
|
}
|
|
33938
34187
|
async function findModuleCandidates(actionFilePath) {
|
|
33939
|
-
const dir =
|
|
34188
|
+
const dir = dirname14(actionFilePath);
|
|
33940
34189
|
const out = [];
|
|
33941
34190
|
try {
|
|
33942
34191
|
const entries = await readdir13(dir, { withFileTypes: true });
|
|
33943
34192
|
for (const entry of entries) {
|
|
33944
34193
|
if (!entry.isFile()) continue;
|
|
33945
34194
|
if (!entry.name.endsWith(".module.ts")) continue;
|
|
33946
|
-
out.push(
|
|
34195
|
+
out.push(join20(dir, entry.name));
|
|
33947
34196
|
}
|
|
33948
34197
|
} catch {
|
|
33949
34198
|
}
|
|
@@ -33952,7 +34201,7 @@ async function findModuleCandidates(actionFilePath) {
|
|
|
33952
34201
|
}
|
|
33953
34202
|
async function safeRead(path) {
|
|
33954
34203
|
try {
|
|
33955
|
-
return await
|
|
34204
|
+
return await readFile21(path, "utf8");
|
|
33956
34205
|
} catch {
|
|
33957
34206
|
return void 0;
|
|
33958
34207
|
}
|
|
@@ -33992,7 +34241,7 @@ function moduleArrayContains(decoratorArg, propertyName, className) {
|
|
|
33992
34241
|
return false;
|
|
33993
34242
|
}
|
|
33994
34243
|
async function readCommonBarrelExports(apiAbs) {
|
|
33995
|
-
const path =
|
|
34244
|
+
const path = join20(apiAbs, COMMON_BARREL_REL);
|
|
33996
34245
|
const text = await safeRead(path);
|
|
33997
34246
|
if (text === void 0) return /* @__PURE__ */ new Set();
|
|
33998
34247
|
const project = new Project18({ useInMemoryFileSystem: true });
|
|
@@ -34159,7 +34408,7 @@ async function run13(rawArgs) {
|
|
|
34159
34408
|
} catch (err) {
|
|
34160
34409
|
return toolError(err instanceof Error ? err.message : String(err));
|
|
34161
34410
|
}
|
|
34162
|
-
const apiAbs =
|
|
34411
|
+
const apiAbs = resolve39(cwd, parsed.apiDir);
|
|
34163
34412
|
let report;
|
|
34164
34413
|
try {
|
|
34165
34414
|
report = await listAppServerActions(apiAbs, { apiDir: parsed.apiDir });
|
|
@@ -34174,15 +34423,15 @@ var serverActionsListAppTool = { definition: TOOL14, run: run13 };
|
|
|
34174
34423
|
|
|
34175
34424
|
// packages/dbx-components-mcp/src/tools/mcp-config.tool.ts
|
|
34176
34425
|
import { type as type72 } from "arktype";
|
|
34177
|
-
import { resolve as
|
|
34426
|
+
import { resolve as resolve46 } from "node:path";
|
|
34178
34427
|
|
|
34179
34428
|
// packages/dbx-components-mcp/src/tools/mcp-config/snapshot.ts
|
|
34180
|
-
import { dirname as
|
|
34181
|
-
import { stat as
|
|
34429
|
+
import { dirname as dirname15, isAbsolute as isAbsolute14, relative as relative13, resolve as resolve41 } from "node:path";
|
|
34430
|
+
import { stat as stat19 } from "node:fs/promises";
|
|
34182
34431
|
|
|
34183
34432
|
// packages/dbx-components-mcp/src/scan/discover-downstream-packages.ts
|
|
34184
|
-
import { glob as fsGlob6, readFile as
|
|
34185
|
-
import { basename as basename7, join as
|
|
34433
|
+
import { glob as fsGlob6, readFile as readFile22, stat as stat18 } from "node:fs/promises";
|
|
34434
|
+
import { basename as basename7, join as join21, resolve as resolve40, sep as sep16 } from "node:path";
|
|
34186
34435
|
var COMPONENT_GLOBS = ["components/*-firebase", "components/*-shared", "components/*-web", "components/*-core"];
|
|
34187
34436
|
var APPS_GLOB = "apps/*";
|
|
34188
34437
|
var SCAN_CONFIG_FILENAME2 = "dbx-mcp.scan.json";
|
|
@@ -34207,12 +34456,12 @@ async function discoverConventionalDirs(workspaceRoot) {
|
|
|
34207
34456
|
const found = /* @__PURE__ */ new Set();
|
|
34208
34457
|
for (const pattern of COMPONENT_GLOBS) {
|
|
34209
34458
|
for await (const match of fsGlob6(pattern, { cwd: workspaceRoot })) {
|
|
34210
|
-
found.add(match.split(
|
|
34459
|
+
found.add(match.split(sep16).join("/"));
|
|
34211
34460
|
}
|
|
34212
34461
|
}
|
|
34213
34462
|
for await (const match of fsGlob6(APPS_GLOB, { cwd: workspaceRoot })) {
|
|
34214
|
-
const rel = match.split(
|
|
34215
|
-
if (await fileExists3(
|
|
34463
|
+
const rel = match.split(sep16).join("/");
|
|
34464
|
+
if (await fileExists3(join21(workspaceRoot, rel, SCAN_CONFIG_FILENAME2))) {
|
|
34216
34465
|
found.add(rel);
|
|
34217
34466
|
}
|
|
34218
34467
|
}
|
|
@@ -34221,19 +34470,19 @@ async function discoverConventionalDirs(workspaceRoot) {
|
|
|
34221
34470
|
function normaliseExplicitDirs(dirs) {
|
|
34222
34471
|
const result = [];
|
|
34223
34472
|
for (const raw of dirs) {
|
|
34224
|
-
const trimmed = raw.split(
|
|
34473
|
+
const trimmed = raw.split(sep16).join("/").replace(/\/+$/, "");
|
|
34225
34474
|
if (trimmed.length > 0) result.push(trimmed);
|
|
34226
34475
|
}
|
|
34227
34476
|
return result;
|
|
34228
34477
|
}
|
|
34229
34478
|
async function inspectPackage2(workspaceRoot, relDir) {
|
|
34230
|
-
const absDir =
|
|
34231
|
-
const isDir = await
|
|
34479
|
+
const absDir = resolve40(workspaceRoot, relDir);
|
|
34480
|
+
const isDir = await isDirectory4(absDir);
|
|
34232
34481
|
if (!isDir) return void 0;
|
|
34233
34482
|
const packageName = await readPackageName2(absDir, relDir);
|
|
34234
34483
|
const slug = packageNameToSlug(packageName);
|
|
34235
|
-
const hasScanConfig = await fileExists3(
|
|
34236
|
-
const declaredScanClusters = hasScanConfig ? await readDeclaredClusters(
|
|
34484
|
+
const hasScanConfig = await fileExists3(join21(absDir, SCAN_CONFIG_FILENAME2));
|
|
34485
|
+
const declaredScanClusters = hasScanConfig ? await readDeclaredClusters(join21(absDir, SCAN_CONFIG_FILENAME2)) : [];
|
|
34237
34486
|
const heuristicClusters = await detectCandidateClusters(absDir);
|
|
34238
34487
|
const candidateClusters = mergeClusters(heuristicClusters, declaredScanClusters);
|
|
34239
34488
|
return {
|
|
@@ -34246,9 +34495,9 @@ async function inspectPackage2(workspaceRoot, relDir) {
|
|
|
34246
34495
|
declaredScanClusters
|
|
34247
34496
|
};
|
|
34248
34497
|
}
|
|
34249
|
-
async function
|
|
34498
|
+
async function isDirectory4(path) {
|
|
34250
34499
|
try {
|
|
34251
|
-
const stats = await
|
|
34500
|
+
const stats = await stat18(path);
|
|
34252
34501
|
return stats.isDirectory();
|
|
34253
34502
|
} catch {
|
|
34254
34503
|
return false;
|
|
@@ -34256,7 +34505,7 @@ async function isDirectory3(path) {
|
|
|
34256
34505
|
}
|
|
34257
34506
|
async function fileExists3(path) {
|
|
34258
34507
|
try {
|
|
34259
|
-
const stats = await
|
|
34508
|
+
const stats = await stat18(path);
|
|
34260
34509
|
return stats.isFile();
|
|
34261
34510
|
} catch {
|
|
34262
34511
|
return false;
|
|
@@ -34266,7 +34515,7 @@ async function readPackageName2(absDir, relDir) {
|
|
|
34266
34515
|
const fallback = basename7(relDir);
|
|
34267
34516
|
let result = fallback;
|
|
34268
34517
|
try {
|
|
34269
|
-
const text = await
|
|
34518
|
+
const text = await readFile22(join21(absDir, PACKAGE_JSON2), "utf8");
|
|
34270
34519
|
const parsed = JSON.parse(text);
|
|
34271
34520
|
if (typeof parsed.name === "string" && parsed.name.length > 0) {
|
|
34272
34521
|
result = parsed.name;
|
|
@@ -34281,7 +34530,7 @@ function packageNameToSlug(packageName) {
|
|
|
34281
34530
|
async function readDeclaredClusters(scanConfigPath) {
|
|
34282
34531
|
let parsed = null;
|
|
34283
34532
|
try {
|
|
34284
|
-
const text = await
|
|
34533
|
+
const text = await readFile22(scanConfigPath, "utf8");
|
|
34285
34534
|
parsed = JSON.parse(text);
|
|
34286
34535
|
} catch {
|
|
34287
34536
|
parsed = null;
|
|
@@ -34309,7 +34558,7 @@ async function detectCandidateClusters(absDir) {
|
|
|
34309
34558
|
const found = /* @__PURE__ */ new Set();
|
|
34310
34559
|
try {
|
|
34311
34560
|
for await (const match of fsGlob6(SOURCE_GLOB, { cwd: absDir })) {
|
|
34312
|
-
const rel = match.split(
|
|
34561
|
+
const rel = match.split(sep16).join("/");
|
|
34313
34562
|
for (const h of FILE_HEURISTICS) {
|
|
34314
34563
|
if (!found.has(h.cluster) && h.matches(rel)) {
|
|
34315
34564
|
found.add(h.cluster);
|
|
@@ -34333,7 +34582,7 @@ function mergeClusters(...lists) {
|
|
|
34333
34582
|
async function buildSnapshot(input) {
|
|
34334
34583
|
const { workspaceRoot, explicitDirs } = input;
|
|
34335
34584
|
const configResult = await findAndLoadConfig({ cwd: workspaceRoot });
|
|
34336
|
-
const configBaseDir = configResult.configPath === null ? workspaceRoot :
|
|
34585
|
+
const configBaseDir = configResult.configPath === null ? workspaceRoot : dirname15(configResult.configPath);
|
|
34337
34586
|
const registeredSources = await collectRegisteredSources(configResult.config, configBaseDir, workspaceRoot);
|
|
34338
34587
|
const packages = await discoverDownstreamPackages({ workspaceRoot, explicitDirs });
|
|
34339
34588
|
const packageSnapshots = packages.map((pkg) => ({
|
|
@@ -34355,7 +34604,7 @@ async function collectRegisteredSources(config, configBaseDir, workspaceRoot) {
|
|
|
34355
34604
|
for (const cluster of DOWNSTREAM_CLUSTERS) {
|
|
34356
34605
|
const declared = config[cluster]?.sources ?? [];
|
|
34357
34606
|
for (const declaredPath of declared) {
|
|
34358
|
-
const absolutePath =
|
|
34607
|
+
const absolutePath = isAbsolute14(declaredPath) ? declaredPath : resolve41(configBaseDir, declaredPath);
|
|
34359
34608
|
const exists = await fileExists4(absolutePath);
|
|
34360
34609
|
const relativePath = relativeOrAbsolute(workspaceRoot, absolutePath);
|
|
34361
34610
|
out.push({ cluster, declaredPath, absolutePath, relativePath, exists });
|
|
@@ -34378,14 +34627,14 @@ function clustersRegisteredInPackage(pkg, sources) {
|
|
|
34378
34627
|
}
|
|
34379
34628
|
async function fileExists4(path) {
|
|
34380
34629
|
try {
|
|
34381
|
-
const stats = await
|
|
34630
|
+
const stats = await stat19(path);
|
|
34382
34631
|
return stats.isFile();
|
|
34383
34632
|
} catch {
|
|
34384
34633
|
return false;
|
|
34385
34634
|
}
|
|
34386
34635
|
}
|
|
34387
34636
|
function relativeOrAbsolute(from, target) {
|
|
34388
|
-
const rel =
|
|
34637
|
+
const rel = relative13(from, target);
|
|
34389
34638
|
if (rel.length === 0) return ".";
|
|
34390
34639
|
if (rel.startsWith("..")) return target;
|
|
34391
34640
|
return rel.split("\\").join("/");
|
|
@@ -34393,7 +34642,7 @@ function relativeOrAbsolute(from, target) {
|
|
|
34393
34642
|
|
|
34394
34643
|
// packages/dbx-components-mcp/src/tools/mcp-config/init.ts
|
|
34395
34644
|
import { writeFile as nodeWriteFile3, mkdir as nodeMkdir, readFile as nodeReadFile7 } from "node:fs/promises";
|
|
34396
|
-
import { dirname as
|
|
34645
|
+
import { dirname as dirname16, relative as relative14, resolve as resolve42 } from "node:path";
|
|
34397
34646
|
var HEURISTIC_CLUSTERS = ["uiComponents", "forgeFields", "pipes", "actions", "filters"];
|
|
34398
34647
|
var CLUSTER_FILENAME_SEGMENT = {
|
|
34399
34648
|
semanticTypes: "semantic",
|
|
@@ -34415,15 +34664,15 @@ var DEFAULT_INCLUDE = ["src/**/*.ts"];
|
|
|
34415
34664
|
var DEFAULT_EXCLUDE = ["**/*.spec.ts", "**/*.test.ts", "**/*.stories.ts"];
|
|
34416
34665
|
async function buildInitPlan(input) {
|
|
34417
34666
|
const { snapshot } = input;
|
|
34418
|
-
const
|
|
34667
|
+
const readFile23 = input.readFile ?? defaultReadFile2;
|
|
34419
34668
|
const changes = [];
|
|
34420
34669
|
const sourcesToRegister = [];
|
|
34421
34670
|
for (const ps of snapshot.packages) {
|
|
34422
|
-
const planResult = await planPackageScanConfig({ snapshot, packageSnapshot: ps, readFile:
|
|
34671
|
+
const planResult = await planPackageScanConfig({ snapshot, packageSnapshot: ps, readFile: readFile23 });
|
|
34423
34672
|
if (planResult.change !== void 0) changes.push(planResult.change);
|
|
34424
34673
|
for (const reg of planResult.sourcesToRegister) sourcesToRegister.push(reg);
|
|
34425
34674
|
}
|
|
34426
|
-
const configChange = await planRootConfig({ snapshot, sourcesToRegister, readFile:
|
|
34675
|
+
const configChange = await planRootConfig({ snapshot, sourcesToRegister, readFile: readFile23 });
|
|
34427
34676
|
if (configChange !== void 0) changes.push(configChange);
|
|
34428
34677
|
return { workspaceRoot: snapshot.workspaceRoot, changes };
|
|
34429
34678
|
}
|
|
@@ -34432,15 +34681,15 @@ async function applyInitPlan(plan, opts) {
|
|
|
34432
34681
|
const mkdir = opts?.mkdir ?? defaultMkdir;
|
|
34433
34682
|
for (const change of plan.changes) {
|
|
34434
34683
|
if (change.reason === "unchanged") continue;
|
|
34435
|
-
await mkdir(
|
|
34684
|
+
await mkdir(dirname16(change.absolutePath));
|
|
34436
34685
|
await writeFile2(change.absolutePath, change.after);
|
|
34437
34686
|
}
|
|
34438
34687
|
}
|
|
34439
34688
|
async function planPackageScanConfig(input) {
|
|
34440
|
-
const { snapshot, packageSnapshot, readFile:
|
|
34689
|
+
const { snapshot, packageSnapshot, readFile: readFile23 } = input;
|
|
34441
34690
|
const { pkg } = packageSnapshot;
|
|
34442
|
-
const scanConfigPath =
|
|
34443
|
-
const before = await tryRead(scanConfigPath,
|
|
34691
|
+
const scanConfigPath = resolve42(pkg.absDir, "dbx-mcp.scan.json");
|
|
34692
|
+
const before = await tryRead(scanConfigPath, readFile23);
|
|
34444
34693
|
const parsed = parseExisting(before);
|
|
34445
34694
|
const targetClusters = HEURISTIC_CLUSTERS.filter((c) => pkg.candidateClusters.includes(c));
|
|
34446
34695
|
if (targetClusters.length === 0 && parsed === null) {
|
|
@@ -34482,9 +34731,9 @@ async function planPackageScanConfig(input) {
|
|
|
34482
34731
|
return { change, sourcesToRegister };
|
|
34483
34732
|
}
|
|
34484
34733
|
async function planRootConfig(input) {
|
|
34485
|
-
const { snapshot, sourcesToRegister, readFile:
|
|
34486
|
-
const configPath = snapshot.configPath ??
|
|
34487
|
-
const before = snapshot.configPath === null ? null : await tryRead(configPath,
|
|
34734
|
+
const { snapshot, sourcesToRegister, readFile: readFile23 } = input;
|
|
34735
|
+
const configPath = snapshot.configPath ?? resolve42(snapshot.workspaceRoot, "dbx-mcp.config.json");
|
|
34736
|
+
const before = snapshot.configPath === null ? null : await tryRead(configPath, readFile23);
|
|
34488
34737
|
const baseConfig = snapshot.config === null ? { version: 1 } : cloneConfig(snapshot.config);
|
|
34489
34738
|
if (baseConfig.version !== 1) baseConfig.version = 1;
|
|
34490
34739
|
let mutated = false;
|
|
@@ -34512,18 +34761,18 @@ async function planRootConfig(input) {
|
|
|
34512
34761
|
};
|
|
34513
34762
|
}
|
|
34514
34763
|
function defaultOutFor(input) {
|
|
34515
|
-
const targetAbs =
|
|
34516
|
-
return
|
|
34764
|
+
const targetAbs = resolve42(input.snapshot.workspaceRoot, ".tmp/dbx-mcp", `${input.slug}.${clusterFilenameSegment(input.cluster)}.json`);
|
|
34765
|
+
return relative14(dirname16(input.scanConfigPath), targetAbs).split("\\").join("/");
|
|
34517
34766
|
}
|
|
34518
34767
|
function resolveScanOut(scanConfigPath, out) {
|
|
34519
|
-
return
|
|
34768
|
+
return resolve42(dirname16(scanConfigPath), out);
|
|
34520
34769
|
}
|
|
34521
34770
|
function relativeFromConfig(snapshot, absolute) {
|
|
34522
|
-
const configDir = snapshot.configPath === null ? snapshot.workspaceRoot :
|
|
34523
|
-
return
|
|
34771
|
+
const configDir = snapshot.configPath === null ? snapshot.workspaceRoot : dirname16(snapshot.configPath);
|
|
34772
|
+
return relative14(configDir, absolute).split("\\").join("/");
|
|
34524
34773
|
}
|
|
34525
34774
|
function workspaceRel(workspaceRoot, absolute) {
|
|
34526
|
-
const rel =
|
|
34775
|
+
const rel = relative14(workspaceRoot, absolute);
|
|
34527
34776
|
if (rel.length === 0) return ".";
|
|
34528
34777
|
return rel.split("\\").join("/");
|
|
34529
34778
|
}
|
|
@@ -34549,9 +34798,9 @@ function cloneConfig(config) {
|
|
|
34549
34798
|
}
|
|
34550
34799
|
return out;
|
|
34551
34800
|
}
|
|
34552
|
-
async function tryRead(path,
|
|
34801
|
+
async function tryRead(path, readFile23) {
|
|
34553
34802
|
try {
|
|
34554
|
-
return await
|
|
34803
|
+
return await readFile23(path);
|
|
34555
34804
|
} catch {
|
|
34556
34805
|
return null;
|
|
34557
34806
|
}
|
|
@@ -34563,7 +34812,7 @@ var defaultMkdir = async (dir) => {
|
|
|
34563
34812
|
};
|
|
34564
34813
|
|
|
34565
34814
|
// packages/dbx-components-mcp/src/scan/actions-build-manifest.ts
|
|
34566
|
-
import { resolve as
|
|
34815
|
+
import { resolve as resolve43 } from "node:path";
|
|
34567
34816
|
import { type as type67 } from "arktype";
|
|
34568
34817
|
|
|
34569
34818
|
// packages/dbx-components-mcp/src/scan/actions-extract.ts
|
|
@@ -34885,12 +35134,12 @@ var ACTIONS_SCAN_CONFIG_FILENAME = "dbx-mcp.scan.json";
|
|
|
34885
35134
|
var DEFAULT_READ_FILE10 = defaultReadFile;
|
|
34886
35135
|
var DEFAULT_GLOBBER5 = defaultGlobber;
|
|
34887
35136
|
async function buildActionsManifest(input) {
|
|
34888
|
-
const { projectRoot, generator, readFile:
|
|
34889
|
-
const configPath =
|
|
34890
|
-
const packagePath =
|
|
35137
|
+
const { projectRoot, generator, readFile: readFile23 = DEFAULT_READ_FILE10, globber = DEFAULT_GLOBBER5, now = () => /* @__PURE__ */ new Date() } = input;
|
|
35138
|
+
const configPath = resolve43(projectRoot, ACTIONS_SCAN_CONFIG_FILENAME);
|
|
35139
|
+
const packagePath = resolve43(projectRoot, "package.json");
|
|
34891
35140
|
const configOutcome = await loadScanSection({
|
|
34892
35141
|
configPath,
|
|
34893
|
-
readFile:
|
|
35142
|
+
readFile: readFile23,
|
|
34894
35143
|
parseSection: (parsed) => {
|
|
34895
35144
|
const validated2 = ActionsScanConfig(parsed);
|
|
34896
35145
|
if (validated2 instanceof type67.errors) {
|
|
@@ -34901,11 +35150,11 @@ async function buildActionsManifest(input) {
|
|
|
34901
35150
|
});
|
|
34902
35151
|
if (configOutcome.kind !== "ok") return configOutcome.outcome;
|
|
34903
35152
|
const scanSection = configOutcome.section;
|
|
34904
|
-
const packageOutcome = await loadPackageName(packagePath,
|
|
35153
|
+
const packageOutcome = await loadPackageName(packagePath, readFile23);
|
|
34905
35154
|
if (packageOutcome.kind !== "ok") return packageOutcome.outcome;
|
|
34906
35155
|
const packageName = packageOutcome.packageName;
|
|
34907
35156
|
const filePaths = await globber({ projectRoot, include: scanSection.include, exclude: scanSection.exclude ?? [] });
|
|
34908
|
-
const project = await buildScanProject({ projectRoot, filePaths, readFile:
|
|
35157
|
+
const project = await buildScanProject({ projectRoot, filePaths, readFile: readFile23 });
|
|
34909
35158
|
const extractResult = extractActionEntries({ project });
|
|
34910
35159
|
const moduleName = scanSection.module ?? packageName;
|
|
34911
35160
|
const sourceLabel = scanSection.source ?? packageName;
|
|
@@ -34923,7 +35172,7 @@ async function buildActionsManifest(input) {
|
|
|
34923
35172
|
if (validated instanceof type67.errors) {
|
|
34924
35173
|
outcome = { kind: "invalid-manifest", error: validated.summary };
|
|
34925
35174
|
} else {
|
|
34926
|
-
const outPath =
|
|
35175
|
+
const outPath = resolve43(projectRoot, scanSection.out ?? DEFAULT_ACTIONS_SCAN_OUT_PATH);
|
|
34927
35176
|
outcome = {
|
|
34928
35177
|
kind: "success",
|
|
34929
35178
|
manifest: validated,
|
|
@@ -35046,7 +35295,7 @@ function formatExtractWarning4(warning) {
|
|
|
35046
35295
|
}
|
|
35047
35296
|
|
|
35048
35297
|
// packages/dbx-components-mcp/src/scan/filters-build-manifest.ts
|
|
35049
|
-
import { resolve as
|
|
35298
|
+
import { resolve as resolve44 } from "node:path";
|
|
35050
35299
|
import { type as type69 } from "arktype";
|
|
35051
35300
|
|
|
35052
35301
|
// packages/dbx-components-mcp/src/scan/filters-extract.ts
|
|
@@ -35258,12 +35507,12 @@ var FILTERS_SCAN_CONFIG_FILENAME = "dbx-mcp.scan.json";
|
|
|
35258
35507
|
var DEFAULT_READ_FILE11 = defaultReadFile;
|
|
35259
35508
|
var DEFAULT_GLOBBER6 = defaultGlobber;
|
|
35260
35509
|
async function buildFiltersManifest(input) {
|
|
35261
|
-
const { projectRoot, generator, readFile:
|
|
35262
|
-
const configPath =
|
|
35263
|
-
const packagePath =
|
|
35510
|
+
const { projectRoot, generator, readFile: readFile23 = DEFAULT_READ_FILE11, globber = DEFAULT_GLOBBER6, now = () => /* @__PURE__ */ new Date() } = input;
|
|
35511
|
+
const configPath = resolve44(projectRoot, FILTERS_SCAN_CONFIG_FILENAME);
|
|
35512
|
+
const packagePath = resolve44(projectRoot, "package.json");
|
|
35264
35513
|
const configOutcome = await loadScanSection({
|
|
35265
35514
|
configPath,
|
|
35266
|
-
readFile:
|
|
35515
|
+
readFile: readFile23,
|
|
35267
35516
|
parseSection: (parsed) => {
|
|
35268
35517
|
const validated2 = FiltersScanConfig(parsed);
|
|
35269
35518
|
if (validated2 instanceof type69.errors) {
|
|
@@ -35276,7 +35525,7 @@ async function buildFiltersManifest(input) {
|
|
|
35276
35525
|
return configOutcome.outcome;
|
|
35277
35526
|
}
|
|
35278
35527
|
const scanSection = configOutcome.section;
|
|
35279
|
-
const packageOutcome = await loadPackageName(packagePath,
|
|
35528
|
+
const packageOutcome = await loadPackageName(packagePath, readFile23);
|
|
35280
35529
|
if (packageOutcome.kind !== "ok") {
|
|
35281
35530
|
return packageOutcome.outcome;
|
|
35282
35531
|
}
|
|
@@ -35286,7 +35535,7 @@ async function buildFiltersManifest(input) {
|
|
|
35286
35535
|
include: scanSection.include,
|
|
35287
35536
|
exclude: scanSection.exclude ?? []
|
|
35288
35537
|
});
|
|
35289
|
-
const project = await buildScanProject({ projectRoot, filePaths, readFile:
|
|
35538
|
+
const project = await buildScanProject({ projectRoot, filePaths, readFile: readFile23 });
|
|
35290
35539
|
const extractResult = extractFilterEntries({ project });
|
|
35291
35540
|
const moduleName = scanSection.module ?? packageName;
|
|
35292
35541
|
const sourceLabel = scanSection.source ?? packageName;
|
|
@@ -35304,7 +35553,7 @@ async function buildFiltersManifest(input) {
|
|
|
35304
35553
|
if (validated instanceof type69.errors) {
|
|
35305
35554
|
outcome = { kind: "invalid-manifest", error: validated.summary };
|
|
35306
35555
|
} else {
|
|
35307
|
-
const outPath =
|
|
35556
|
+
const outPath = resolve44(projectRoot, scanSection.out ?? DEFAULT_FILTERS_SCAN_OUT_PATH);
|
|
35308
35557
|
outcome = {
|
|
35309
35558
|
kind: "success",
|
|
35310
35559
|
manifest: validated,
|
|
@@ -35391,7 +35640,7 @@ function formatExtractWarning5(warning) {
|
|
|
35391
35640
|
}
|
|
35392
35641
|
|
|
35393
35642
|
// packages/dbx-components-mcp/src/scan/pipes-build-manifest.ts
|
|
35394
|
-
import { resolve as
|
|
35643
|
+
import { resolve as resolve45 } from "node:path";
|
|
35395
35644
|
import { type as type71 } from "arktype";
|
|
35396
35645
|
|
|
35397
35646
|
// packages/dbx-components-mcp/src/scan/pipes-extract.ts
|
|
@@ -35686,12 +35935,12 @@ var PIPES_SCAN_CONFIG_FILENAME = "dbx-mcp.scan.json";
|
|
|
35686
35935
|
var DEFAULT_READ_FILE12 = defaultReadFile;
|
|
35687
35936
|
var DEFAULT_GLOBBER7 = defaultGlobber;
|
|
35688
35937
|
async function buildPipesManifest(input) {
|
|
35689
|
-
const { projectRoot, generator, readFile:
|
|
35690
|
-
const configPath =
|
|
35691
|
-
const packagePath =
|
|
35938
|
+
const { projectRoot, generator, readFile: readFile23 = DEFAULT_READ_FILE12, globber = DEFAULT_GLOBBER7, now = () => /* @__PURE__ */ new Date() } = input;
|
|
35939
|
+
const configPath = resolve45(projectRoot, PIPES_SCAN_CONFIG_FILENAME);
|
|
35940
|
+
const packagePath = resolve45(projectRoot, "package.json");
|
|
35692
35941
|
const configOutcome = await loadScanSection({
|
|
35693
35942
|
configPath,
|
|
35694
|
-
readFile:
|
|
35943
|
+
readFile: readFile23,
|
|
35695
35944
|
parseSection: (parsed) => {
|
|
35696
35945
|
const validated2 = PipesScanConfig(parsed);
|
|
35697
35946
|
if (validated2 instanceof type71.errors) {
|
|
@@ -35704,7 +35953,7 @@ async function buildPipesManifest(input) {
|
|
|
35704
35953
|
return configOutcome.outcome;
|
|
35705
35954
|
}
|
|
35706
35955
|
const scanSection = configOutcome.section;
|
|
35707
|
-
const packageOutcome = await loadPackageName(packagePath,
|
|
35956
|
+
const packageOutcome = await loadPackageName(packagePath, readFile23);
|
|
35708
35957
|
if (packageOutcome.kind !== "ok") {
|
|
35709
35958
|
return packageOutcome.outcome;
|
|
35710
35959
|
}
|
|
@@ -35714,7 +35963,7 @@ async function buildPipesManifest(input) {
|
|
|
35714
35963
|
include: scanSection.include,
|
|
35715
35964
|
exclude: scanSection.exclude ?? []
|
|
35716
35965
|
});
|
|
35717
|
-
const project = await buildScanProject({ projectRoot, filePaths, readFile:
|
|
35966
|
+
const project = await buildScanProject({ projectRoot, filePaths, readFile: readFile23 });
|
|
35718
35967
|
const extractResult = extractPipeEntries({ project });
|
|
35719
35968
|
const moduleName = scanSection.module ?? packageName;
|
|
35720
35969
|
const sourceLabel = scanSection.source ?? packageName;
|
|
@@ -35732,7 +35981,7 @@ async function buildPipesManifest(input) {
|
|
|
35732
35981
|
if (validated instanceof type71.errors) {
|
|
35733
35982
|
outcome = { kind: "invalid-manifest", error: validated.summary };
|
|
35734
35983
|
} else {
|
|
35735
|
-
const outPath =
|
|
35984
|
+
const outPath = resolve45(projectRoot, scanSection.out ?? DEFAULT_PIPES_SCAN_OUT_PATH);
|
|
35736
35985
|
outcome = {
|
|
35737
35986
|
kind: "success",
|
|
35738
35987
|
manifest: validated,
|
|
@@ -36090,7 +36339,7 @@ function parseArgs10(rawArgs, defaultCwd) {
|
|
|
36090
36339
|
}
|
|
36091
36340
|
let workspaceRoot = defaultCwd;
|
|
36092
36341
|
if (parsed.cwd !== void 0 && parsed.cwd.length > 0) {
|
|
36093
|
-
workspaceRoot =
|
|
36342
|
+
workspaceRoot = resolve46(defaultCwd, parsed.cwd);
|
|
36094
36343
|
}
|
|
36095
36344
|
if (parsed.explicitDirs !== void 0) {
|
|
36096
36345
|
for (const dir of parsed.explicitDirs) {
|
|
@@ -37494,7 +37743,7 @@ function renderAmbiguous(matches) {
|
|
|
37494
37743
|
|
|
37495
37744
|
// packages/dbx-components-mcp/src/tools/ui-smell-check.tool.ts
|
|
37496
37745
|
import { readFile as nodeReadFile8 } from "node:fs/promises";
|
|
37497
|
-
import { basename as basename8, extname, isAbsolute as
|
|
37746
|
+
import { basename as basename8, extname, isAbsolute as isAbsolute15, resolve as resolve47 } from "node:path";
|
|
37498
37747
|
import { type as type77 } from "arktype";
|
|
37499
37748
|
|
|
37500
37749
|
// packages/dbx-components-mcp/src/tools/ui-smell-check/smells.ts
|
|
@@ -38465,9 +38714,9 @@ function parseArgs13(raw, defaults) {
|
|
|
38465
38714
|
return { html, scss, htmlPath: parsed.htmlPath, scssPath: parsed.scssPath, paths: parsed.paths, context: parsed.context, conventions: merged };
|
|
38466
38715
|
}
|
|
38467
38716
|
var DEFAULT_READ_FILE13 = (path) => nodeReadFile8(path, "utf-8");
|
|
38468
|
-
async function readPathInput(path, cwd,
|
|
38469
|
-
const absolute =
|
|
38470
|
-
return
|
|
38717
|
+
async function readPathInput(path, cwd, readFile23) {
|
|
38718
|
+
const absolute = isAbsolute15(path) ? path : resolve47(cwd, path);
|
|
38719
|
+
return readFile23(absolute);
|
|
38471
38720
|
}
|
|
38472
38721
|
function pairBatchPaths(paths) {
|
|
38473
38722
|
const groups = /* @__PURE__ */ new Map();
|
|
@@ -38503,11 +38752,11 @@ function pairBatchPaths(paths) {
|
|
|
38503
38752
|
}
|
|
38504
38753
|
// @__NO_SIDE_EFFECTS__
|
|
38505
38754
|
function createUiSmellCheckTool(input) {
|
|
38506
|
-
const { tokenRegistry, uiComponentRegistry, cwd, readFile:
|
|
38755
|
+
const { tokenRegistry, uiComponentRegistry, cwd, readFile: readFile23 } = input;
|
|
38507
38756
|
const run15 = async (rawArgs) => {
|
|
38508
38757
|
let conventionsFromConfig = {};
|
|
38509
38758
|
try {
|
|
38510
|
-
const configResult = await findAndLoadConfig({ cwd: cwd ?? process.cwd(), readFile:
|
|
38759
|
+
const configResult = await findAndLoadConfig({ cwd: cwd ?? process.cwd(), readFile: readFile23 });
|
|
38511
38760
|
const block = configResult.config?.uiSmellCheck?.projectConventions;
|
|
38512
38761
|
if (block !== void 0) {
|
|
38513
38762
|
conventionsFromConfig = block;
|
|
@@ -38523,7 +38772,7 @@ function createUiSmellCheckTool(input) {
|
|
|
38523
38772
|
return toolError(message);
|
|
38524
38773
|
}
|
|
38525
38774
|
const resolvedCwd = cwd ?? process.cwd();
|
|
38526
|
-
const reader =
|
|
38775
|
+
const reader = readFile23 ?? DEFAULT_READ_FILE13;
|
|
38527
38776
|
if (args.paths !== void 0 && args.paths.length > 0) {
|
|
38528
38777
|
if (args.html.length > 0 || args.scss.length > 0 || args.htmlPath !== void 0 || args.scssPath !== void 0) {
|
|
38529
38778
|
return toolError("dbx_ui_smell_check: `paths` is mutually exclusive with `html`/`scss`/`htmlPath`/`scssPath`.");
|