@rbbtsn0w/adg 0.7.1-beta.8 → 0.7.1-beta.9
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { existsSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
1
|
+
import { existsSync, lstatSync, readFileSync, rmSync, unlinkSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { join, resolve } from "node:path";
|
|
3
3
|
import { isExposed } from "../components.js";
|
|
4
4
|
import { extractMcpServers, mcpConfigPath } from "../mcp.js";
|
|
@@ -20,6 +20,20 @@ const ANTIGRAVITY_MCP_KEY_ALIASES = {
|
|
|
20
20
|
http_headers: "headers",
|
|
21
21
|
disabled_tools: "disabledTools",
|
|
22
22
|
};
|
|
23
|
+
function removeProjectionTarget(target) {
|
|
24
|
+
try {
|
|
25
|
+
if (lstatSync(target).isSymbolicLink()) {
|
|
26
|
+
unlinkSync(target);
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
if (error.code === "ENOENT")
|
|
32
|
+
return;
|
|
33
|
+
throw error;
|
|
34
|
+
}
|
|
35
|
+
rmSync(target, { force: true });
|
|
36
|
+
}
|
|
23
37
|
function toAntigravityMcpServer(value) {
|
|
24
38
|
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
25
39
|
return value;
|
|
@@ -71,8 +85,10 @@ export function writeAntigravityMcpConfig(pluginDir, manifest, selection) {
|
|
|
71
85
|
if (source === resolve(target))
|
|
72
86
|
return;
|
|
73
87
|
if (source && isExposed(selection, "mcp") && existsSync(source)) {
|
|
74
|
-
|
|
88
|
+
const projected = `${JSON.stringify(toAntigravityMcpConfig(source), null, 2)}\n`;
|
|
89
|
+
removeProjectionTarget(target);
|
|
90
|
+
writeFileSync(target, projected);
|
|
75
91
|
return;
|
|
76
92
|
}
|
|
77
|
-
|
|
93
|
+
removeProjectionTarget(target);
|
|
78
94
|
}
|