mta-mcp 3.16.2 → 3.16.3
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/agents/flutter.agent.md +124 -496
- package/dist/index.js +57 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -6811,6 +6811,60 @@ function extractPageClassName(codeContent) {
|
|
|
6811
6811
|
const match = codeContent.match(/class\s+([A-Za-z0-9_]+)\s+extends\s+(StatelessWidget|StatefulWidget)/);
|
|
6812
6812
|
return (match == null ? void 0 : match[1]) || null;
|
|
6813
6813
|
}
|
|
6814
|
+
function collectContractTexts(payload) {
|
|
6815
|
+
var _a, _b, _c;
|
|
6816
|
+
const blockTexts = (((_a = payload.restorationContract) == null ? void 0 : _a.blockOrder) || []).flatMap((block) => [block.name, block.label]).filter((value) => typeof value === "string" && value.trim().length > 0);
|
|
6817
|
+
const navTexts = (((_b = payload.restorationContract) == null ? void 0 : _b.navCopyLedger) || []).filter((value) => typeof value === "string" && value.trim().length > 0);
|
|
6818
|
+
const pageTitle = (_c = payload.restorationContract) == null ? void 0 : _c.pageTitle;
|
|
6819
|
+
return [.../* @__PURE__ */ new Set([
|
|
6820
|
+
...blockTexts,
|
|
6821
|
+
...navTexts,
|
|
6822
|
+
...pageTitle ? [pageTitle] : []
|
|
6823
|
+
])];
|
|
6824
|
+
}
|
|
6825
|
+
function buildInteractionValidator(payload, codeContent) {
|
|
6826
|
+
const findings = [];
|
|
6827
|
+
const contractTexts = collectContractTexts(payload).join(" ");
|
|
6828
|
+
const combinedText = `${contractTexts}
|
|
6829
|
+
${codeContent}`;
|
|
6830
|
+
const hasSearchSemantics = /搜索/.test(combinedText);
|
|
6831
|
+
const hasRealTextInput = hasAnyPattern(codeContent, [
|
|
6832
|
+
/TextField\s*\(/,
|
|
6833
|
+
/TextFormField\s*\(/,
|
|
6834
|
+
/SearchBar\s*\(/,
|
|
6835
|
+
/CupertinoSearchTextField\s*\(/
|
|
6836
|
+
]);
|
|
6837
|
+
if (hasSearchSemantics && !hasRealTextInput) {
|
|
6838
|
+
findings.push({
|
|
6839
|
+
id: "search_control_static_shell",
|
|
6840
|
+
severity: "error",
|
|
6841
|
+
message: "\u8BBE\u8BA1/\u4EE3\u7801\u4E2D\u5B58\u5728\u641C\u7D22\u8BED\u4E49\uFF0C\u4F46\u672A\u68C0\u6D4B\u5230\u771F\u5B9E\u8F93\u5165\u63A7\u4EF6\uFF0C\u5F53\u524D\u5B9E\u73B0\u5F88\u53EF\u80FD\u53EA\u662F\u9759\u6001\u641C\u7D22\u6846\u58F3\u5B50\u3002",
|
|
6842
|
+
suggestion: "\u81F3\u5C11\u8865\u9F50 TextField/SearchBar\uFF0C\u8BA9\u641C\u7D22\u6846\u53EF\u805A\u7126\u53EF\u8F93\u5165\uFF1B\u65E0\u540E\u7AEF\u65F6\u4F18\u5148\u505A\u672C\u5730\u8FC7\u6EE4\u3002"
|
|
6843
|
+
});
|
|
6844
|
+
}
|
|
6845
|
+
const hasSelectorPlaceholder = /请选择/.test(combinedText);
|
|
6846
|
+
const hasSelectionMechanism = hasAnyPattern(codeContent, [
|
|
6847
|
+
/showModalBottomSheet\s*\(/,
|
|
6848
|
+
/DropdownButton(?:FormField)?(?:<[^>]+>)?\s*\(/,
|
|
6849
|
+
/PopupMenuButton(?:<[^>]+>)?\s*\(/,
|
|
6850
|
+
/showMenu\s*\(/,
|
|
6851
|
+
/showCupertinoModalPopup\s*\(/,
|
|
6852
|
+
/MenuAnchor\s*\(/,
|
|
6853
|
+
/CupertinoPicker\s*\(/
|
|
6854
|
+
]);
|
|
6855
|
+
if (hasSelectorPlaceholder && !hasSelectionMechanism) {
|
|
6856
|
+
findings.push({
|
|
6857
|
+
id: "selector_control_static_shell",
|
|
6858
|
+
severity: "error",
|
|
6859
|
+
message: "\u4EE3\u7801\u4E2D\u5B58\u5728\u201C\u8BF7\u9009\u62E9\u201D\u7C7B\u8868\u5355\u8BED\u4E49\uFF0C\u4F46\u672A\u68C0\u6D4B\u5230\u4EFB\u4F55\u771F\u5B9E\u9009\u62E9\u673A\u5236\uFF0C\u5F53\u524D\u5B9E\u73B0\u5F88\u53EF\u80FD\u53EA\u662F\u9759\u6001\u9009\u62E9\u5668\u58F3\u5B50\u3002",
|
|
6860
|
+
suggestion: "\u81F3\u5C11\u8865\u9F50\u57FA\u7840 bottom sheet / dropdown / popup menu\uFF0C\u5E76\u63D0\u4F9B\u5C11\u91CF\u5047\u6570\u636E\u5360\u4F4D\uFF0C\u4E0D\u8981\u628A\u9009\u62E9\u5668\u7559\u6210\u7EAF\u5C55\u793A\u72B6\u6001\u3002"
|
|
6861
|
+
});
|
|
6862
|
+
}
|
|
6863
|
+
return {
|
|
6864
|
+
passed: !findings.some((item) => item.severity === "error"),
|
|
6865
|
+
findings
|
|
6866
|
+
};
|
|
6867
|
+
}
|
|
6814
6868
|
function buildContractValidator(payload, codeContent) {
|
|
6815
6869
|
var _a, _b, _c, _d, _e;
|
|
6816
6870
|
const findings = [];
|
|
@@ -7167,13 +7221,15 @@ async function validateRestoration(args) {
|
|
|
7167
7221
|
const codeContent = fs20.readFileSync(args.codeFilePath, "utf-8");
|
|
7168
7222
|
const contractValidator = buildContractValidator(payload, codeContent);
|
|
7169
7223
|
const assetValidator = buildAssetValidator(payload, codeContent, args);
|
|
7224
|
+
const interactionValidator = buildInteractionValidator(payload, codeContent);
|
|
7170
7225
|
const routeReviewValidator = buildRouteReviewValidator(args, codeContent);
|
|
7171
7226
|
return {
|
|
7172
7227
|
artboardName: (_a = payload.artboard) == null ? void 0 : _a.name,
|
|
7173
|
-
ok: contractValidator.passed && assetValidator.passed && routeReviewValidator.passed,
|
|
7228
|
+
ok: contractValidator.passed && assetValidator.passed && interactionValidator.passed && routeReviewValidator.passed,
|
|
7174
7229
|
codeFilePath: args.codeFilePath,
|
|
7175
7230
|
contractValidator,
|
|
7176
7231
|
assetValidator,
|
|
7232
|
+
interactionValidator,
|
|
7177
7233
|
routeReviewValidator
|
|
7178
7234
|
};
|
|
7179
7235
|
}
|