@ada-mcp/mcp-server 0.1.22 → 0.1.23
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/dist/cli.cjs +83 -12
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -3940,6 +3940,25 @@ function briefErrorMessage(error2) {
|
|
|
3940
3940
|
}
|
|
3941
3941
|
return String(error2).split(/\r?\n/)[0]?.trim() || String(error2);
|
|
3942
3942
|
}
|
|
3943
|
+
function stripAnsiCodes(text) {
|
|
3944
|
+
return text.replace(/\x1b\[[0-9;]*m/g, "");
|
|
3945
|
+
}
|
|
3946
|
+
function stripCliErrorPrefix(message) {
|
|
3947
|
+
let t = stripAnsiCodes(message).trim();
|
|
3948
|
+
t = t.replace(/^Error:\s*/i, "");
|
|
3949
|
+
while (/^[×x✖✗❌\u00d7\u2716\u2717]\s*/iu.test(t)) {
|
|
3950
|
+
t = t.replace(/^[×x✖✗❌\u00d7\u2716\u2717]\s*/iu, "");
|
|
3951
|
+
}
|
|
3952
|
+
return t.trim();
|
|
3953
|
+
}
|
|
3954
|
+
function isAppiumDriverAlreadyInstalledMessage(message) {
|
|
3955
|
+
const raw = stripAnsiCodes(message).trim();
|
|
3956
|
+
return /already installed/i.test(raw) && /driver named/i.test(raw);
|
|
3957
|
+
}
|
|
3958
|
+
function formatDepsWarnLine(message) {
|
|
3959
|
+
const body = stripCliErrorPrefix(message);
|
|
3960
|
+
return body ? `[deps][warn] ${body}` : "";
|
|
3961
|
+
}
|
|
3943
3962
|
function depsVerboseEnabled() {
|
|
3944
3963
|
return isTruthyEnv("ADA_DEPS_VERBOSE");
|
|
3945
3964
|
}
|
|
@@ -4173,6 +4192,23 @@ async function probePlaywrightBrowserArtifact(host, browserVersion) {
|
|
|
4173
4192
|
function requiredAppiumDrivers(config2) {
|
|
4174
4193
|
return Array.from(new Set(config2.appium.requiredDrivers ?? []));
|
|
4175
4194
|
}
|
|
4195
|
+
function isMacOsPlatform() {
|
|
4196
|
+
return process.platform === "darwin";
|
|
4197
|
+
}
|
|
4198
|
+
function filterAppiumDriversForPlatform(drivers, onLogLine) {
|
|
4199
|
+
const out = [];
|
|
4200
|
+
for (const driver of drivers) {
|
|
4201
|
+
const name = driver.toLowerCase().trim();
|
|
4202
|
+
if (name === "xcuitest" && !isMacOsPlatform()) {
|
|
4203
|
+
onLogLine?.(
|
|
4204
|
+
`[appium] \u8DF3\u8FC7 xcuitest\uFF1A\u5F53\u524D\u7CFB\u7EDF\u4E3A ${process.platform}\uFF0CXCUITest \u9A71\u52A8\u4EC5\u652F\u6301 macOS\uFF08\u8BF7\u5728 Mac \u4E0A\u5B89\u88C5 iOS \u81EA\u52A8\u5316\u4F9D\u8D56\uFF09`
|
|
4205
|
+
);
|
|
4206
|
+
continue;
|
|
4207
|
+
}
|
|
4208
|
+
out.push(name);
|
|
4209
|
+
}
|
|
4210
|
+
return Array.from(new Set(out));
|
|
4211
|
+
}
|
|
4176
4212
|
function npmProxyRegistry() {
|
|
4177
4213
|
return process.env.ADA_NPM_PROXY_REGISTRY ?? DEFAULT_NPM_REGISTRY_CANDIDATES[0];
|
|
4178
4214
|
}
|
|
@@ -4363,7 +4399,18 @@ function structuredLogToHuman(level, payload) {
|
|
|
4363
4399
|
return `[deps] \u5305\u5B89\u88C5\u6210\u529F: ${d.strategy}`;
|
|
4364
4400
|
}
|
|
4365
4401
|
if (event === "deps.install.strategy.fail") {
|
|
4366
|
-
|
|
4402
|
+
const msg = stripCliErrorPrefix(String(d.message ?? ""));
|
|
4403
|
+
if (isAppiumDriverAlreadyInstalledMessage(msg)) {
|
|
4404
|
+
return null;
|
|
4405
|
+
}
|
|
4406
|
+
return `[deps][warn] \u5B89\u88C5\u7B56\u7565\u5931\u8D25 (${d.strategy}): ${msg}`;
|
|
4407
|
+
}
|
|
4408
|
+
if (event === "appium.driver.install.strategy.fail") {
|
|
4409
|
+
const msg = stripCliErrorPrefix(String(d.message ?? ""));
|
|
4410
|
+
if (isAppiumDriverAlreadyInstalledMessage(msg)) {
|
|
4411
|
+
return null;
|
|
4412
|
+
}
|
|
4413
|
+
return `[deps][warn] Appium \u9A71\u52A8\u5B89\u88C5\u5931\u8D25 (${d.strategy}): ${msg}`;
|
|
4367
4414
|
}
|
|
4368
4415
|
if (event === "deps.registry.auto-selected") {
|
|
4369
4416
|
return `[deps] \u9009\u7528 npm \u955C\u50CF: ${d.selected}`;
|
|
@@ -4372,8 +4419,12 @@ function structuredLogToHuman(level, payload) {
|
|
|
4372
4419
|
return `[playwright] CDN \u6D4B\u901F\u6392\u5E8F: ${Array.isArray(d.ranked) ? d.ranked.join(" -> ") : d.selected}`;
|
|
4373
4420
|
}
|
|
4374
4421
|
if (level === "warn" || level === "error") {
|
|
4375
|
-
const
|
|
4376
|
-
|
|
4422
|
+
const raw = String(d.message ?? d.detail ?? "");
|
|
4423
|
+
if (isAppiumDriverAlreadyInstalledMessage(raw)) {
|
|
4424
|
+
return null;
|
|
4425
|
+
}
|
|
4426
|
+
const warn = formatDepsWarnLine(raw);
|
|
4427
|
+
return warn || null;
|
|
4377
4428
|
}
|
|
4378
4429
|
if (depsVerboseEnabled()) {
|
|
4379
4430
|
return `[deps] ${event}${Object.keys(d).length > 0 ? ` ${JSON.stringify(d)}` : ""}`;
|
|
@@ -4710,14 +4761,29 @@ async function runAppiumDriverInstallWithPriority(config2, driver, onLogLine) {
|
|
|
4710
4761
|
const installArgs = buildAppiumDriverInstallArgs(target, appiumMajor);
|
|
4711
4762
|
onLogLine?.(`[appium] \u6267\u884C: npm ${installArgs.join(" ")}`);
|
|
4712
4763
|
let alreadyInstalledSeen = false;
|
|
4764
|
+
let alreadyInstalledWarnLogged = false;
|
|
4713
4765
|
const onAppiumDriverLogLine = (line) => {
|
|
4714
|
-
const t = line.trimEnd();
|
|
4715
|
-
|
|
4716
|
-
|
|
4766
|
+
const t = stripAnsiCodes(line).trimEnd();
|
|
4767
|
+
if (!t) {
|
|
4768
|
+
return;
|
|
4769
|
+
}
|
|
4770
|
+
if (isAppiumDriverAlreadyInstalledMessage(t)) {
|
|
4717
4771
|
alreadyInstalledSeen = true;
|
|
4718
|
-
|
|
4719
|
-
|
|
4720
|
-
|
|
4772
|
+
if (!alreadyInstalledWarnLogged) {
|
|
4773
|
+
alreadyInstalledWarnLogged = true;
|
|
4774
|
+
const normalized = stripCliErrorPrefix(t);
|
|
4775
|
+
onLogLine?.(`[deps][warn] ${normalized}\u3002\u68C0\u6D4B\u5230\u5B89\u88C5\u540E\u65E0\u9700\u518D\u6B21\u5B89\u88C5${driver}\u3002`);
|
|
4776
|
+
}
|
|
4777
|
+
return;
|
|
4778
|
+
}
|
|
4779
|
+
if (/^Error:\s*/i.test(t)) {
|
|
4780
|
+
const warn = formatDepsWarnLine(t);
|
|
4781
|
+
if (warn) {
|
|
4782
|
+
onLogLine?.(warn);
|
|
4783
|
+
}
|
|
4784
|
+
return;
|
|
4785
|
+
}
|
|
4786
|
+
if (/^dbug\s+Appium/i.test(t)) {
|
|
4721
4787
|
return;
|
|
4722
4788
|
}
|
|
4723
4789
|
onLogLine?.(t);
|
|
@@ -4940,7 +5006,7 @@ async function getInstalledAppiumDrivers() {
|
|
|
4940
5006
|
return Array.from(new Set(names));
|
|
4941
5007
|
}
|
|
4942
5008
|
async function ensureAppiumDrivers(config2, onLogLine) {
|
|
4943
|
-
const required2 = requiredAppiumDrivers(config2);
|
|
5009
|
+
const required2 = filterAppiumDriversForPlatform(requiredAppiumDrivers(config2), onLogLine);
|
|
4944
5010
|
if (required2.length === 0) {
|
|
4945
5011
|
return [];
|
|
4946
5012
|
}
|
|
@@ -5172,7 +5238,10 @@ async function ensureDriverDependenciesImpl(config2, options) {
|
|
|
5172
5238
|
onLogLine?.("[deps] \u5F00\u59CB\u68C0\u6D4B / \u5B89\u88C5\u4F9D\u8D56\u2026");
|
|
5173
5239
|
await ensureNodeEnvironmentForInstall(onLogLine);
|
|
5174
5240
|
const missing = [];
|
|
5175
|
-
const requestedDrivers =
|
|
5241
|
+
const requestedDrivers = filterAppiumDriversForPlatform(
|
|
5242
|
+
options?.appiumRequiredDriversOverride !== void 0 ? normalizeAppiumDriverTokens(options.appiumRequiredDriversOverride) : resolveRequestedDrivers(config2, only),
|
|
5243
|
+
onLogLine
|
|
5244
|
+
);
|
|
5176
5245
|
const needDrivers = requestedDrivers.length > 0;
|
|
5177
5246
|
const installedPackages = [];
|
|
5178
5247
|
const installedDrivers = [];
|
|
@@ -5354,7 +5423,9 @@ async function getDependencyHealth(config2) {
|
|
|
5354
5423
|
}
|
|
5355
5424
|
if (appiumCliOk) {
|
|
5356
5425
|
const installed = (await getInstalledAppiumDrivers()).map((x) => x.toLowerCase());
|
|
5357
|
-
const required2 =
|
|
5426
|
+
const required2 = filterAppiumDriversForPlatform(
|
|
5427
|
+
config2?.appium?.requiredDrivers && config2.appium.requiredDrivers.length > 0 ? config2.appium.requiredDrivers.map((x) => x.toLowerCase()) : ["uiautomator2", "xcuitest", "harmonyos"]
|
|
5428
|
+
);
|
|
5358
5429
|
missingAppiumDrivers = required2.filter((x) => !installed.includes(x));
|
|
5359
5430
|
appiumDriversOk = missingAppiumDrivers.length === 0;
|
|
5360
5431
|
}
|