droid-patch 0.13.5 → 0.14.1
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/README.md +4 -5
- package/README.zh-CN.md +4 -5
- package/dist/{alias-DTf8YAYU.mjs → alias-DgX_0sGe.mjs} +80 -32
- package/dist/alias-DgX_0sGe.mjs.map +1 -0
- package/dist/cli.mjs +86 -42
- package/dist/cli.mjs.map +1 -1
- package/dist/index.d.mts +4 -0
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +1 -1
- package/package.json +18 -18
- package/dist/alias-DTf8YAYU.mjs.map +0 -1
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as removeAlias, d as listAllMetadata, f as loadAliasMetadata, i as listAliases, l as createMetadata, m as patchDroid, n as createAlias, o as removeAliasesByFilter, p as saveAliasMetadata, r as createAliasForWrapper, t as clearAllAliases, u as formatPatches } from "./alias-
|
|
2
|
+
import { a as removeAlias, d as listAllMetadata, f as loadAliasMetadata, i as listAliases, l as createMetadata, m as patchDroid, n as createAlias, o as removeAliasesByFilter, p as saveAliasMetadata, r as createAliasForWrapper, t as clearAllAliases, u as formatPatches } from "./alias-DgX_0sGe.mjs";
|
|
3
3
|
import bin from "tiny-bin";
|
|
4
4
|
import { styleText } from "node:util";
|
|
5
5
|
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
@@ -1086,18 +1086,18 @@ function findDefaultDroidPath() {
|
|
|
1086
1086
|
for (const p of paths) if (existsSync(p)) return p;
|
|
1087
1087
|
return join(home, ".droid", "bin", "droid");
|
|
1088
1088
|
}
|
|
1089
|
-
bin("droid-patch", "CLI tool to patch droid binary with various modifications").
|
|
1089
|
+
bin("droid-patch", "CLI tool to patch droid binary with various modifications").option("--is-custom", "Patch isCustom:!0 to isCustom:!1 (enable context compression for custom models)").option("--skip-login", "Inject a fake FACTORY_API_KEY to bypass login requirement (no real key needed)").option("--api-base <url>", "Replace API URL (standalone: binary patch, max 22 chars; with --websearch: proxy forward target, no limit)").option("--websearch", "Enable local WebSearch proxy with external providers (Smithery, Google PSE, etc.)").option("--websearch-proxy", "Enable native provider websearch (requires proxy plugin, reads ~/.factory/settings.json)").option("--standalone", "Standalone mode: mock non-LLM Factory APIs (use with --websearch)").option("--reasoning-effort", "Enable reasoning effort for custom models (default high; UI options: \"high\",\"max\",\"xhigh\")").option("--disable-telemetry", "Disable telemetry and Sentry error reporting (block data uploads)").option("--dry-run", "Verify patches without actually modifying the binary").option("-p, --path <path>", "Path to the droid binary").option("-o, --output <dir>", "Output directory for patched binary").option("--no-backup", "Do not create backup of original binary").option("-v, --verbose", "Enable verbose output").argument("[alias]", "Alias name for the patched binary").action(async (options, args) => {
|
|
1090
1090
|
const alias = args?.[0];
|
|
1091
|
-
const isCustom = options
|
|
1092
|
-
const skipLogin = options
|
|
1093
|
-
const apiBase = options
|
|
1094
|
-
const websearch = options
|
|
1095
|
-
const websearchProxy = options
|
|
1096
|
-
const standalone = options
|
|
1091
|
+
const isCustom = !!options.isCustom;
|
|
1092
|
+
const skipLogin = !!options.skipLogin;
|
|
1093
|
+
const apiBase = options.apiBase;
|
|
1094
|
+
const websearch = !!options.websearch;
|
|
1095
|
+
const websearchProxy = !!options.websearchProxy;
|
|
1096
|
+
const standalone = !!options.standalone;
|
|
1097
1097
|
const websearchTarget = websearch ? apiBase || "https://api.factory.ai" : void 0;
|
|
1098
|
-
const reasoningEffort = options
|
|
1099
|
-
const noTelemetry = options
|
|
1100
|
-
const dryRun = options
|
|
1098
|
+
const reasoningEffort = !!options.reasoningEffort;
|
|
1099
|
+
const noTelemetry = !!options.disableTelemetry;
|
|
1100
|
+
const dryRun = !!options.dryRun;
|
|
1101
1101
|
const path = options.path || findDefaultDroidPath();
|
|
1102
1102
|
const outputDir = options.output;
|
|
1103
1103
|
const backup = options.backup !== false;
|
|
@@ -1239,7 +1239,7 @@ bin("droid-patch", "CLI tool to patch droid binary with various modifications").
|
|
|
1239
1239
|
if (apiBase && !websearch) {
|
|
1240
1240
|
const originalUrl = "https://api.factory.ai";
|
|
1241
1241
|
const originalLength = 22;
|
|
1242
|
-
|
|
1242
|
+
const normalizedUrl = apiBase.replace(/\/+$/, "");
|
|
1243
1243
|
if (normalizedUrl.length > originalLength) {
|
|
1244
1244
|
console.log(styleText("red", `Error: API base URL must be ${originalLength} characters or less`));
|
|
1245
1245
|
console.log(styleText("gray", ` Your URL: "${normalizedUrl}" (${normalizedUrl.length} chars)`));
|
|
@@ -1260,23 +1260,45 @@ bin("droid-patch", "CLI tool to patch droid binary with various modifications").
|
|
|
1260
1260
|
});
|
|
1261
1261
|
}
|
|
1262
1262
|
if (reasoningEffort) {
|
|
1263
|
+
patches.push({
|
|
1264
|
+
name: "reasoningEffortSupportedXHighListLegacy",
|
|
1265
|
+
description: "Enable [\"high\",\"max\",\"xhigh\"] in UI for custom model list (legacy)",
|
|
1266
|
+
pattern: Buffer.from(""),
|
|
1267
|
+
replacement: Buffer.from(""),
|
|
1268
|
+
suppressCheckUnlessFound: true,
|
|
1269
|
+
regexPattern: /id:([A-Za-z$_])\.id,displayName:\1\.displayName,shortDisplayName:\1\.(?:displayName|id),modelProvider:\1\.provider\s*,supportedReasoningEfforts:\[(?:"(?:none|high)"(?:,"xhigh")?|"low","high","xhigh")\],defaultReasoningEffort:"(?:none|high)",isCustom:!([01]),noImageSupport:(?:\1\.noImageSupport|!1)/g,
|
|
1270
|
+
regexReplacement: "id:$1.id,displayName:$1.displayName,shortDisplayName:$1.displayName,modelProvider:$1.provider,supportedReasoningEfforts:[\"high\",\"max\",\"xhigh\"],defaultReasoningEffort:\"high\",isCustom:!$2,noImageSupport:!1",
|
|
1271
|
+
alreadyPatchedRegexPattern: /id:([A-Za-z$_])\.id,displayName:\1\.displayName,shortDisplayName:\1\.displayName,modelProvider:\1\.provider,supportedReasoningEfforts:\["high","max","xhigh"\],defaultReasoningEffort:"high",isCustom:!([01]),noImageSupport:!1/g
|
|
1272
|
+
});
|
|
1273
|
+
patches.push({
|
|
1274
|
+
name: "reasoningEffortSupportedXHighResolverLegacy",
|
|
1275
|
+
description: "Enable [\"high\",\"max\",\"xhigh\"] in UI for custom model config resolver (legacy)",
|
|
1276
|
+
pattern: Buffer.from(""),
|
|
1277
|
+
replacement: Buffer.from(""),
|
|
1278
|
+
suppressCheckUnlessFound: true,
|
|
1279
|
+
regexPattern: /id:([A-Za-z$_])\.model,modelProvider:\1\.provider\s*,displayName:([A-Za-z$_]),shortDisplayName:\2,supportedReasoningEfforts:\[(?:"(?:none|high)"(?:,"xhigh")?|"low","high","xhigh")\],defaultReasoningEffort:"(?:none|high)",isCustom:!([01]),noImageSupport:(?:\1\.noImageSupport|!1)/g,
|
|
1280
|
+
regexReplacement: "id:$1.model,modelProvider:$1.provider,displayName:$2,shortDisplayName:$2,supportedReasoningEfforts:[\"high\",\"max\",\"xhigh\"],defaultReasoningEffort:\"high\",isCustom:!$3,noImageSupport:!1",
|
|
1281
|
+
alreadyPatchedRegexPattern: /id:([A-Za-z$_])\.model,modelProvider:\1\.provider,displayName:([A-Za-z$_]),shortDisplayName:\2,supportedReasoningEfforts:\["high","max","xhigh"\],defaultReasoningEffort:"high",isCustom:!([01]),noImageSupport:!1/g
|
|
1282
|
+
});
|
|
1263
1283
|
patches.push({
|
|
1264
1284
|
name: "reasoningEffortSupportedXHighList",
|
|
1265
|
-
description: "Enable [\"
|
|
1285
|
+
description: "Enable [\"high\",\"max\",\"xhigh\"] in UI for custom model list",
|
|
1266
1286
|
pattern: Buffer.from(""),
|
|
1267
1287
|
replacement: Buffer.from(""),
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1288
|
+
skipIfAnySucceeded: ["reasoningEffortSupportedXHighListLegacy"],
|
|
1289
|
+
regexPattern: /id:([A-Za-z$_])\.id,displayName:\1\.displayName,shortDisplayName:\1\.displayName,modelProvider:\1\.provider,supportedReasoningEfforts:[A-Za-z$_]\?\["off","low","medium","high"\]:\["none"\],defaultReasoningEffort:\1\.reasoningEffort\?\?"none",isCustom:!([01]),noImageSupport:\1\.noImageSupport/g,
|
|
1290
|
+
regexReplacement: "id:$1.id,displayName:$1.displayName,shortDisplayName:$1.displayName,modelProvider:$1.provider,supportedReasoningEfforts:1?[\"high\",\"max\",\"xhigh\",\"none\"]:[\"high\"],defaultReasoningEffort:$1.reasoningEffort??\"high\",isCustom:!$2,noImageSupport:$1.noImageSupport",
|
|
1291
|
+
alreadyPatchedRegexPattern: /id:([A-Za-z$_])\.id,displayName:\1\.displayName,shortDisplayName:\1\.displayName,modelProvider:\1\.provider,supportedReasoningEfforts:1\?\["high","max","xhigh"(?:,"none")?\]\s{0,7}:\["high"\],defaultReasoningEffort:\1\.reasoningEffort\?\?"high",isCustom:!([01]),noImageSupport:\1\.noImageSupport/g
|
|
1271
1292
|
});
|
|
1272
1293
|
patches.push({
|
|
1273
1294
|
name: "reasoningEffortSupportedXHighResolver",
|
|
1274
|
-
description: "Enable [\"
|
|
1295
|
+
description: "Enable [\"high\",\"max\",\"xhigh\"] in UI for custom model config resolver",
|
|
1275
1296
|
pattern: Buffer.from(""),
|
|
1276
1297
|
replacement: Buffer.from(""),
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1298
|
+
skipIfAnySucceeded: ["reasoningEffortSupportedXHighResolverLegacy"],
|
|
1299
|
+
regexPattern: /id:([A-Za-z$_])\.model,modelProvider:\1\.provider,displayName:([A-Za-z$_]),shortDisplayName:\2,supportedReasoningEfforts:[A-Za-z$_]\?\["off","low","medium","high"\]:\["none"\],defaultReasoningEffort:\1\.reasoningEffort\?\?"none",isCustom:!([01]),noImageSupport:\1\.noImageSupport/g,
|
|
1300
|
+
regexReplacement: "id:$1.model,modelProvider:$1.provider,displayName:$2,shortDisplayName:$2,supportedReasoningEfforts:1?[\"high\",\"max\",\"xhigh\",\"none\"]:[\"high\"],defaultReasoningEffort:$1.reasoningEffort??\"high\",isCustom:!$3,noImageSupport:$1.noImageSupport",
|
|
1301
|
+
alreadyPatchedRegexPattern: /id:([A-Za-z$_])\.model,modelProvider:\1\.provider,displayName:([A-Za-z$_]),shortDisplayName:\2,supportedReasoningEfforts:1\?\["high","max","xhigh"(?:,"none")?\]\s{0,7}:\["high"\],defaultReasoningEffort:\1\.reasoningEffort\?\?"high",isCustom:!([01]),noImageSupport:\1\.noImageSupport/g
|
|
1280
1302
|
});
|
|
1281
1303
|
patches.push({
|
|
1282
1304
|
name: "reasoningEffortSupported",
|
|
@@ -1412,8 +1434,8 @@ bin("droid-patch", "CLI tool to patch droid binary with various modifications").
|
|
|
1412
1434
|
await listAliases();
|
|
1413
1435
|
}).command("remove", "Remove alias(es) by name or filter").argument("[alias-or-path]", "Alias name or file path to remove").option("--patch-version <version>", "Remove aliases created by this droid-patch version").option("--droid-version <version>", "Remove aliases for this droid version").option("--flag <flag>", "Remove aliases with this flag (is-custom, skip-login, websearch, api-base, reasoning-effort, disable-telemetry, standalone)").action(async (options, args) => {
|
|
1414
1436
|
const target = args?.[0];
|
|
1415
|
-
const patchVersion = options
|
|
1416
|
-
const droidVersion = options
|
|
1437
|
+
const patchVersion = options.patchVersion;
|
|
1438
|
+
const droidVersion = options.droidVersion;
|
|
1417
1439
|
const flagRaw = options.flag;
|
|
1418
1440
|
let flag;
|
|
1419
1441
|
if (flagRaw) {
|
|
@@ -1446,9 +1468,9 @@ bin("droid-patch", "CLI tool to patch droid binary with various modifications").
|
|
|
1446
1468
|
process.exit(1);
|
|
1447
1469
|
}
|
|
1448
1470
|
if (target.includes("/") || existsSync(target)) {
|
|
1449
|
-
const { unlink
|
|
1471
|
+
const { unlink } = await import("node:fs/promises");
|
|
1450
1472
|
try {
|
|
1451
|
-
await unlink
|
|
1473
|
+
await unlink(target);
|
|
1452
1474
|
console.log(styleText("green", `[*] Removed: ${target}`));
|
|
1453
1475
|
} catch (error) {
|
|
1454
1476
|
console.error(styleText("red", `Error: ${error.message}`));
|
|
@@ -1461,9 +1483,9 @@ bin("droid-patch", "CLI tool to patch droid binary with various modifications").
|
|
|
1461
1483
|
await clearAllAliases();
|
|
1462
1484
|
}).command("update", "Update aliases with latest droid binary").argument("[alias]", "Specific alias to update (optional, updates all if not specified)").option("--dry-run", "Preview without making changes").option("-p, --path <path>", "Path to new droid binary").option("-v, --verbose", "Enable verbose output").action(async (options, args) => {
|
|
1463
1485
|
const aliasName = args?.[0];
|
|
1464
|
-
const dryRun = options
|
|
1486
|
+
const dryRun = !!options.dryRun;
|
|
1465
1487
|
const newBinaryPath = options.path || findDefaultDroidPath();
|
|
1466
|
-
const verbose = options.verbose;
|
|
1488
|
+
const verbose = !!options.verbose;
|
|
1467
1489
|
console.log(styleText("cyan", "═".repeat(60)));
|
|
1468
1490
|
console.log(styleText(["cyan", "bold"], " Droid-Patch Update"));
|
|
1469
1491
|
console.log(styleText("cyan", "═".repeat(60)));
|
|
@@ -1532,23 +1554,45 @@ bin("droid-patch", "CLI tool to patch droid binary with various modifications").
|
|
|
1532
1554
|
});
|
|
1533
1555
|
}
|
|
1534
1556
|
if (meta.patches.reasoningEffort) {
|
|
1557
|
+
patches.push({
|
|
1558
|
+
name: "reasoningEffortSupportedXHighListLegacy",
|
|
1559
|
+
description: "Enable [\"high\",\"max\",\"xhigh\"] in UI for custom model list (legacy)",
|
|
1560
|
+
pattern: Buffer.from(""),
|
|
1561
|
+
replacement: Buffer.from(""),
|
|
1562
|
+
suppressCheckUnlessFound: true,
|
|
1563
|
+
regexPattern: /id:([A-Za-z$_])\.id,displayName:\1\.displayName,shortDisplayName:\1\.(?:displayName|id),modelProvider:\1\.provider\s*,supportedReasoningEfforts:\[(?:"(?:none|high)"(?:,"xhigh")?|"low","high","xhigh")\],defaultReasoningEffort:"(?:none|high)",isCustom:!([01]),noImageSupport:(?:\1\.noImageSupport|!1)/g,
|
|
1564
|
+
regexReplacement: "id:$1.id,displayName:$1.displayName,shortDisplayName:$1.displayName,modelProvider:$1.provider,supportedReasoningEfforts:[\"high\",\"max\",\"xhigh\"],defaultReasoningEffort:\"high\",isCustom:!$2,noImageSupport:!1",
|
|
1565
|
+
alreadyPatchedRegexPattern: /id:([A-Za-z$_])\.id,displayName:\1\.displayName,shortDisplayName:\1\.displayName,modelProvider:\1\.provider,supportedReasoningEfforts:\["high","max","xhigh"\],defaultReasoningEffort:"high",isCustom:!([01]),noImageSupport:!1/g
|
|
1566
|
+
});
|
|
1567
|
+
patches.push({
|
|
1568
|
+
name: "reasoningEffortSupportedXHighResolverLegacy",
|
|
1569
|
+
description: "Enable [\"high\",\"max\",\"xhigh\"] in UI for custom model config resolver (legacy)",
|
|
1570
|
+
pattern: Buffer.from(""),
|
|
1571
|
+
replacement: Buffer.from(""),
|
|
1572
|
+
suppressCheckUnlessFound: true,
|
|
1573
|
+
regexPattern: /id:([A-Za-z$_])\.model,modelProvider:\1\.provider\s*,displayName:([A-Za-z$_]),shortDisplayName:\2,supportedReasoningEfforts:\[(?:"(?:none|high)"(?:,"xhigh")?|"low","high","xhigh")\],defaultReasoningEffort:"(?:none|high)",isCustom:!([01]),noImageSupport:(?:\1\.noImageSupport|!1)/g,
|
|
1574
|
+
regexReplacement: "id:$1.model,modelProvider:$1.provider,displayName:$2,shortDisplayName:$2,supportedReasoningEfforts:[\"high\",\"max\",\"xhigh\"],defaultReasoningEffort:\"high\",isCustom:!$3,noImageSupport:!1",
|
|
1575
|
+
alreadyPatchedRegexPattern: /id:([A-Za-z$_])\.model,modelProvider:\1\.provider,displayName:([A-Za-z$_]),shortDisplayName:\2,supportedReasoningEfforts:\["high","max","xhigh"\],defaultReasoningEffort:"high",isCustom:!([01]),noImageSupport:!1/g
|
|
1576
|
+
});
|
|
1535
1577
|
patches.push({
|
|
1536
1578
|
name: "reasoningEffortSupportedXHighList",
|
|
1537
|
-
description: "Enable [\"
|
|
1579
|
+
description: "Enable [\"high\",\"max\",\"xhigh\"] in UI for custom model list",
|
|
1538
1580
|
pattern: Buffer.from(""),
|
|
1539
1581
|
replacement: Buffer.from(""),
|
|
1540
|
-
|
|
1541
|
-
|
|
1542
|
-
|
|
1582
|
+
skipIfAnySucceeded: ["reasoningEffortSupportedXHighListLegacy"],
|
|
1583
|
+
regexPattern: /id:([A-Za-z$_])\.id,displayName:\1\.displayName,shortDisplayName:\1\.displayName,modelProvider:\1\.provider,supportedReasoningEfforts:[A-Za-z$_]\?\["off","low","medium","high"\]:\["none"\],defaultReasoningEffort:\1\.reasoningEffort\?\?"none",isCustom:!([01]),noImageSupport:\1\.noImageSupport/g,
|
|
1584
|
+
regexReplacement: "id:$1.id,displayName:$1.displayName,shortDisplayName:$1.displayName,modelProvider:$1.provider,supportedReasoningEfforts:1?[\"high\",\"max\",\"xhigh\",\"none\"]:[\"high\"],defaultReasoningEffort:$1.reasoningEffort??\"high\",isCustom:!$2,noImageSupport:$1.noImageSupport",
|
|
1585
|
+
alreadyPatchedRegexPattern: /id:([A-Za-z$_])\.id,displayName:\1\.displayName,shortDisplayName:\1\.displayName,modelProvider:\1\.provider,supportedReasoningEfforts:1\?\["high","max","xhigh"(?:,"none")?\]\s{0,7}:\["high"\],defaultReasoningEffort:\1\.reasoningEffort\?\?"high",isCustom:!([01]),noImageSupport:\1\.noImageSupport/g
|
|
1543
1586
|
});
|
|
1544
1587
|
patches.push({
|
|
1545
1588
|
name: "reasoningEffortSupportedXHighResolver",
|
|
1546
|
-
description: "Enable [\"
|
|
1589
|
+
description: "Enable [\"high\",\"max\",\"xhigh\"] in UI for custom model config resolver",
|
|
1547
1590
|
pattern: Buffer.from(""),
|
|
1548
1591
|
replacement: Buffer.from(""),
|
|
1549
|
-
|
|
1550
|
-
|
|
1551
|
-
|
|
1592
|
+
skipIfAnySucceeded: ["reasoningEffortSupportedXHighResolverLegacy"],
|
|
1593
|
+
regexPattern: /id:([A-Za-z$_])\.model,modelProvider:\1\.provider,displayName:([A-Za-z$_]),shortDisplayName:\2,supportedReasoningEfforts:[A-Za-z$_]\?\["off","low","medium","high"\]:\["none"\],defaultReasoningEffort:\1\.reasoningEffort\?\?"none",isCustom:!([01]),noImageSupport:\1\.noImageSupport/g,
|
|
1594
|
+
regexReplacement: "id:$1.model,modelProvider:$1.provider,displayName:$2,shortDisplayName:$2,supportedReasoningEfforts:1?[\"high\",\"max\",\"xhigh\",\"none\"]:[\"high\"],defaultReasoningEffort:$1.reasoningEffort??\"high\",isCustom:!$3,noImageSupport:$1.noImageSupport",
|
|
1595
|
+
alreadyPatchedRegexPattern: /id:([A-Za-z$_])\.model,modelProvider:\1\.provider,displayName:([A-Za-z$_]),shortDisplayName:\2,supportedReasoningEfforts:1\?\["high","max","xhigh"(?:,"none")?\]\s{0,7}:\["high"\],defaultReasoningEffort:\1\.reasoningEffort\?\?"high",isCustom:!([01]),noImageSupport:\1\.noImageSupport/g
|
|
1552
1596
|
});
|
|
1553
1597
|
patches.push({
|
|
1554
1598
|
name: "reasoningEffortSupported",
|
|
@@ -1619,8 +1663,8 @@ bin("droid-patch", "CLI tool to patch droid binary with various modifications").
|
|
|
1619
1663
|
continue;
|
|
1620
1664
|
}
|
|
1621
1665
|
if (process.platform === "darwin") try {
|
|
1622
|
-
const { execSync
|
|
1623
|
-
execSync
|
|
1666
|
+
const { execSync } = await import("node:child_process");
|
|
1667
|
+
execSync(`codesign --force --deep --sign - "${outputPath}"`, { stdio: "pipe" });
|
|
1624
1668
|
if (verbose) console.log(styleText("gray", ` Re-signed binary`));
|
|
1625
1669
|
} catch {
|
|
1626
1670
|
console.log(styleText("yellow", ` [!] Could not re-sign binary`));
|
|
@@ -1643,7 +1687,7 @@ bin("droid-patch", "CLI tool to patch droid binary with various modifications").
|
|
|
1643
1687
|
}
|
|
1644
1688
|
delete meta.patches.statusline;
|
|
1645
1689
|
delete meta.patches.sessions;
|
|
1646
|
-
const { symlink
|
|
1690
|
+
const { symlink, unlink, readlink, lstat } = await import("node:fs/promises");
|
|
1647
1691
|
let aliasPath = meta.aliasPath;
|
|
1648
1692
|
if (!aliasPath) {
|
|
1649
1693
|
const commonPathDirs = [
|
|
@@ -1658,7 +1702,7 @@ bin("droid-patch", "CLI tool to patch droid binary with various modifications").
|
|
|
1658
1702
|
const possiblePath = join(dir, meta.name);
|
|
1659
1703
|
if (existsSync(possiblePath)) try {
|
|
1660
1704
|
if ((await lstat(possiblePath)).isSymbolicLink()) {
|
|
1661
|
-
const target = await readlink
|
|
1705
|
+
const target = await readlink(possiblePath);
|
|
1662
1706
|
if (target.includes(".droid-patch/bins") || target.includes(".droid-patch/proxy") || target.includes(".droid-patch/statusline")) {
|
|
1663
1707
|
aliasPath = possiblePath;
|
|
1664
1708
|
if (verbose) console.log(styleText("gray", ` Found existing symlink: ${aliasPath}`));
|
|
@@ -1670,13 +1714,13 @@ bin("droid-patch", "CLI tool to patch droid binary with various modifications").
|
|
|
1670
1714
|
}
|
|
1671
1715
|
if (aliasPath) try {
|
|
1672
1716
|
if (existsSync(aliasPath)) {
|
|
1673
|
-
if (await readlink
|
|
1674
|
-
await unlink
|
|
1675
|
-
await symlink
|
|
1717
|
+
if (await readlink(aliasPath) !== execTargetPath) {
|
|
1718
|
+
await unlink(aliasPath);
|
|
1719
|
+
await symlink(execTargetPath, aliasPath);
|
|
1676
1720
|
if (verbose) console.log(styleText("gray", ` Updated symlink: ${aliasPath}`));
|
|
1677
1721
|
}
|
|
1678
1722
|
} else {
|
|
1679
|
-
await symlink
|
|
1723
|
+
await symlink(execTargetPath, aliasPath);
|
|
1680
1724
|
if (verbose) console.log(styleText("gray", ` Recreated symlink: ${aliasPath}`));
|
|
1681
1725
|
}
|
|
1682
1726
|
meta.aliasPath = aliasPath;
|