@ada-mcp/mcp-server 0.1.21 → 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 +93 -14
- 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)}` : ""}`;
|
|
@@ -4709,12 +4760,40 @@ async function runAppiumDriverInstallWithPriority(config2, driver, onLogLine) {
|
|
|
4709
4760
|
for (const target of uniqueTargets) {
|
|
4710
4761
|
const installArgs = buildAppiumDriverInstallArgs(target, appiumMajor);
|
|
4711
4762
|
onLogLine?.(`[appium] \u6267\u884C: npm ${installArgs.join(" ")}`);
|
|
4763
|
+
let alreadyInstalledSeen = false;
|
|
4764
|
+
let alreadyInstalledWarnLogged = false;
|
|
4765
|
+
const onAppiumDriverLogLine = (line) => {
|
|
4766
|
+
const t = stripAnsiCodes(line).trimEnd();
|
|
4767
|
+
if (!t) {
|
|
4768
|
+
return;
|
|
4769
|
+
}
|
|
4770
|
+
if (isAppiumDriverAlreadyInstalledMessage(t)) {
|
|
4771
|
+
alreadyInstalledSeen = true;
|
|
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)) {
|
|
4787
|
+
return;
|
|
4788
|
+
}
|
|
4789
|
+
onLogLine?.(t);
|
|
4790
|
+
};
|
|
4712
4791
|
const strategies = [
|
|
4713
4792
|
{
|
|
4714
4793
|
name: "npm",
|
|
4715
4794
|
run: () => runCommand2("npm", installArgs, {
|
|
4716
4795
|
timeoutMs: installStrategyTimeoutMs(),
|
|
4717
|
-
onLogLine
|
|
4796
|
+
onLogLine: onAppiumDriverLogLine
|
|
4718
4797
|
})
|
|
4719
4798
|
},
|
|
4720
4799
|
{
|
|
@@ -4722,7 +4801,7 @@ async function runAppiumDriverInstallWithPriority(config2, driver, onLogLine) {
|
|
|
4722
4801
|
run: () => runCommand2("npm", installArgs, {
|
|
4723
4802
|
env: { npm_config_registry: npmProxy },
|
|
4724
4803
|
timeoutMs: installStrategyTimeoutMs(),
|
|
4725
|
-
onLogLine
|
|
4804
|
+
onLogLine: onAppiumDriverLogLine
|
|
4726
4805
|
})
|
|
4727
4806
|
}
|
|
4728
4807
|
];
|
|
@@ -4740,12 +4819,7 @@ async function runAppiumDriverInstallWithPriority(config2, driver, onLogLine) {
|
|
|
4740
4819
|
progress("appium.driver.install.done", { driver, strategy: strategy.name, target });
|
|
4741
4820
|
return;
|
|
4742
4821
|
} catch (error2) {
|
|
4743
|
-
|
|
4744
|
-
if (/already installed/i.test(msg) && /driver named/i.test(msg)) {
|
|
4745
|
-
const normalized = msg.replace(/^Error:\s*/i, "").trim();
|
|
4746
|
-
onLogLine?.(
|
|
4747
|
-
`[deps][warn] ${normalized}\u3002\u68C0\u6D4B\u5230\u5B89\u88C5\u540E\u65E0\u9700\u518D\u6B21\u5B89\u88C5 ${driver}\u3002`
|
|
4748
|
-
);
|
|
4822
|
+
if (alreadyInstalledSeen) {
|
|
4749
4823
|
progress("appium.driver.install.done", { driver, strategy: strategy.name, target });
|
|
4750
4824
|
return;
|
|
4751
4825
|
}
|
|
@@ -4932,7 +5006,7 @@ async function getInstalledAppiumDrivers() {
|
|
|
4932
5006
|
return Array.from(new Set(names));
|
|
4933
5007
|
}
|
|
4934
5008
|
async function ensureAppiumDrivers(config2, onLogLine) {
|
|
4935
|
-
const required2 = requiredAppiumDrivers(config2);
|
|
5009
|
+
const required2 = filterAppiumDriversForPlatform(requiredAppiumDrivers(config2), onLogLine);
|
|
4936
5010
|
if (required2.length === 0) {
|
|
4937
5011
|
return [];
|
|
4938
5012
|
}
|
|
@@ -5164,7 +5238,10 @@ async function ensureDriverDependenciesImpl(config2, options) {
|
|
|
5164
5238
|
onLogLine?.("[deps] \u5F00\u59CB\u68C0\u6D4B / \u5B89\u88C5\u4F9D\u8D56\u2026");
|
|
5165
5239
|
await ensureNodeEnvironmentForInstall(onLogLine);
|
|
5166
5240
|
const missing = [];
|
|
5167
|
-
const requestedDrivers =
|
|
5241
|
+
const requestedDrivers = filterAppiumDriversForPlatform(
|
|
5242
|
+
options?.appiumRequiredDriversOverride !== void 0 ? normalizeAppiumDriverTokens(options.appiumRequiredDriversOverride) : resolveRequestedDrivers(config2, only),
|
|
5243
|
+
onLogLine
|
|
5244
|
+
);
|
|
5168
5245
|
const needDrivers = requestedDrivers.length > 0;
|
|
5169
5246
|
const installedPackages = [];
|
|
5170
5247
|
const installedDrivers = [];
|
|
@@ -5346,7 +5423,9 @@ async function getDependencyHealth(config2) {
|
|
|
5346
5423
|
}
|
|
5347
5424
|
if (appiumCliOk) {
|
|
5348
5425
|
const installed = (await getInstalledAppiumDrivers()).map((x) => x.toLowerCase());
|
|
5349
|
-
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
|
+
);
|
|
5350
5429
|
missingAppiumDrivers = required2.filter((x) => !installed.includes(x));
|
|
5351
5430
|
appiumDriversOk = missingAppiumDrivers.length === 0;
|
|
5352
5431
|
}
|