@rbbtsn0w/adg 0.7.1-beta.1 → 0.7.1-beta.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.
|
@@ -1,8 +1,59 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { existsSync, readFileSync, rmSync, writeFileSync } from "node:fs";
|
|
2
2
|
import { join, resolve } from "node:path";
|
|
3
3
|
import { isExposed } from "../components.js";
|
|
4
4
|
import { mcpConfigPath } from "../mcp.js";
|
|
5
5
|
export const ANTIGRAVITY_MCP_CONFIG = "mcp_config.json";
|
|
6
|
+
const ANTIGRAVITY_MCP_SERVER_KEYS = new Set([
|
|
7
|
+
"command",
|
|
8
|
+
"serverUrl",
|
|
9
|
+
"args",
|
|
10
|
+
"env",
|
|
11
|
+
"cwd",
|
|
12
|
+
"headers",
|
|
13
|
+
"authProviderType",
|
|
14
|
+
"oauth",
|
|
15
|
+
"disabled",
|
|
16
|
+
"disabledTools",
|
|
17
|
+
]);
|
|
18
|
+
const ANTIGRAVITY_MCP_KEY_ALIASES = {
|
|
19
|
+
url: "serverUrl",
|
|
20
|
+
http_headers: "headers",
|
|
21
|
+
disabled_tools: "disabledTools",
|
|
22
|
+
};
|
|
23
|
+
function toAntigravityMcpServer(value) {
|
|
24
|
+
if (!value || typeof value !== "object" || Array.isArray(value))
|
|
25
|
+
return value;
|
|
26
|
+
const source = value;
|
|
27
|
+
const server = {};
|
|
28
|
+
for (const [key, field] of Object.entries(source)) {
|
|
29
|
+
if (ANTIGRAVITY_MCP_SERVER_KEYS.has(key))
|
|
30
|
+
server[key] = field;
|
|
31
|
+
}
|
|
32
|
+
for (const [sourceKey, targetKey] of Object.entries(ANTIGRAVITY_MCP_KEY_ALIASES)) {
|
|
33
|
+
if (server[targetKey] === undefined && source[sourceKey] !== undefined) {
|
|
34
|
+
server[targetKey] = source[sourceKey];
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
return server;
|
|
38
|
+
}
|
|
39
|
+
function toAntigravityMcpConfig(source) {
|
|
40
|
+
const parsed = JSON.parse(readFileSync(source, "utf8"));
|
|
41
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed))
|
|
42
|
+
return parsed;
|
|
43
|
+
const config = parsed;
|
|
44
|
+
const servers = config.mcpServers ?? config.servers;
|
|
45
|
+
if (!servers || typeof servers !== "object" || Array.isArray(servers))
|
|
46
|
+
return config;
|
|
47
|
+
const projected = {
|
|
48
|
+
...config,
|
|
49
|
+
mcpServers: {},
|
|
50
|
+
};
|
|
51
|
+
delete projected.servers;
|
|
52
|
+
for (const [name, value] of Object.entries(servers)) {
|
|
53
|
+
projected.mcpServers[name] = toAntigravityMcpServer(value);
|
|
54
|
+
}
|
|
55
|
+
return projected;
|
|
56
|
+
}
|
|
6
57
|
/**
|
|
7
58
|
* Generate an Antigravity (`agy`) plugin.json from an ADG manifest.
|
|
8
59
|
*
|
|
@@ -22,8 +73,9 @@ export function writeAntigravityMcpConfig(pluginDir, manifest, selection) {
|
|
|
22
73
|
// generated projection. Never remove or copy it onto itself.
|
|
23
74
|
if (source === resolve(target))
|
|
24
75
|
return;
|
|
25
|
-
rmSync(target, { force: true });
|
|
26
76
|
if (source && isExposed(selection, "mcp") && existsSync(source)) {
|
|
27
|
-
|
|
77
|
+
writeFileSync(target, `${JSON.stringify(toAntigravityMcpConfig(source), null, 2)}\n`);
|
|
78
|
+
return;
|
|
28
79
|
}
|
|
80
|
+
rmSync(target, { force: true });
|
|
29
81
|
}
|
|
@@ -355,13 +355,18 @@ export async function addPlugins(opts) {
|
|
|
355
355
|
try {
|
|
356
356
|
let { candidates, converted } = discoverPlugins(workRoot);
|
|
357
357
|
const existingLock = readLock(lockPath(opts.pluginsDir));
|
|
358
|
-
if (candidates.size > 0
|
|
359
|
-
|
|
358
|
+
if (candidates.size > 0) {
|
|
359
|
+
if (opts.structuralIdentity && !candidates.has(opts.structuralIdentity)) {
|
|
360
|
+
throw new Error(`source definition changed from Default DSL to explicit plugin(s), but none match the installed identity "${opts.structuralIdentity}"; re-add or migrate the plugin explicitly`);
|
|
361
|
+
}
|
|
362
|
+
if (opts.as && !opts.structuralIdentity) {
|
|
363
|
+
throw new Error("--as is only supported for a default structural plugin source");
|
|
364
|
+
}
|
|
360
365
|
}
|
|
361
366
|
if (candidates.size === 0) {
|
|
362
367
|
if (parsed.kind === "github" && !opts.preparedSourceDir && !opts.defaultDescription)
|
|
363
368
|
defaultDescription = await githubRepositoryDescription(parsed.source);
|
|
364
|
-
const structuralIdentity = opts.as ?? (parsed.kind === "github" ? parsed.source : basename(workRoot));
|
|
369
|
+
const structuralIdentity = opts.as ?? opts.structuralIdentity ?? (parsed.kind === "github" ? parsed.source : basename(workRoot));
|
|
365
370
|
const generated = resolveDefaultDsl(workRoot, {
|
|
366
371
|
name: structuralIdentity,
|
|
367
372
|
description: defaultDescription ?? opts.defaultDescription ?? structuralIdentity,
|
|
@@ -423,7 +428,9 @@ export async function addPlugins(opts) {
|
|
|
423
428
|
}
|
|
424
429
|
// A generated Default DSL replay retains its definition profile. Only an
|
|
425
430
|
// explicit manifest discovered from the source may replace that profile.
|
|
426
|
-
const definitionSwitches = definition
|
|
431
|
+
const definitionSwitches = definition
|
|
432
|
+
? []
|
|
433
|
+
: order.filter((name) => existingLock.plugins[name]?.definition && name !== opts.structuralIdentity);
|
|
427
434
|
if (definitionSwitches.length > 0) {
|
|
428
435
|
const names = definitionSwitches.sort().map((name) => `"${name}"`).join(", ");
|
|
429
436
|
throw new Error(`source definition changed from default DSL to a manifest for ${names}; re-add or migrate the plugin explicitly`);
|
|
@@ -136,6 +136,7 @@ export async function updatePlugins(opts) {
|
|
|
136
136
|
...structural.map(({ name, definition, selection }) => ({
|
|
137
137
|
plugins: [name],
|
|
138
138
|
as: definition.as,
|
|
139
|
+
structuralIdentity: name,
|
|
139
140
|
defaultDescription: definition.description,
|
|
140
141
|
authorizedComponents: definition.authorizedComponents,
|
|
141
142
|
replaySelection: selection ?? (definition.authorizedComponents ? { components: definition.authorizedComponents } : undefined),
|
|
@@ -163,6 +164,7 @@ export async function updatePlugins(opts) {
|
|
|
163
164
|
skipUnchanged: true,
|
|
164
165
|
nonInteractive: true,
|
|
165
166
|
...(request.authorizedComponents ? { authorizedComponents: request.authorizedComponents } : {}),
|
|
167
|
+
...(request.structuralIdentity ? { structuralIdentity: request.structuralIdentity } : {}),
|
|
166
168
|
...(request.replaySelection ? { replaySelection: request.replaySelection } : {}),
|
|
167
169
|
targets: opts.targets,
|
|
168
170
|
marketplaceName: group.source,
|
|
@@ -74,9 +74,11 @@ plugin root. The ADG adapter materializes files at these conventional locations.
|
|
|
74
74
|
|
|
75
75
|
- **Config file name**: `mcp_config.json` (at plugin root — required conventional name).
|
|
76
76
|
- **Config key**: N/A (no manifest key; discovered by file presence).
|
|
77
|
-
- **Special handling**: ADG
|
|
78
|
-
|
|
79
|
-
|
|
77
|
+
- **Special handling**: ADG projects the source `.mcp.json` to `mcp_config.json`
|
|
78
|
+
at the plugin root, normalizing canonical aliases such as `url`, `http_headers`,
|
|
79
|
+
and `disabled_tools` to Antigravity's schema. Unsupported source-runtime fields
|
|
80
|
+
are omitted. If the source IS already `mcp_config.json`, it is treated as a
|
|
81
|
+
native override and left unchanged.
|
|
80
82
|
|
|
81
83
|
---
|
|
82
84
|
|
package/docs/agents-spec.md
CHANGED
|
@@ -318,8 +318,8 @@ Hooks require the most complex adapter logic. See also
|
|
|
318
318
|
| :--- | :--- | :--- | :--- |
|
|
319
319
|
| **Config file** | `.mcp.json` or inline in manifest | `.mcp.json` reference | `mcp_config.json` at plugin root |
|
|
320
320
|
| **Manifest key** | `mcpServers` | `mcpServers` | N/A (discovered by file presence) |
|
|
321
|
-
| **Format** | `{ "mcpServers": { "<name>": { "command": ... } } }` | Same as Claude |
|
|
322
|
-
| **Projection** | Passed through | Passed through |
|
|
321
|
+
| **Format** | `{ "mcpServers": { "<name>": { "command": ... } } }` | Same as Claude | Native schema (`serverUrl`, `headers`, and other camelCase fields) |
|
|
322
|
+
| **Projection** | Passed through | Passed through | Field-normalized from source `.mcp.json`; native `mcp_config.json` overrides pass through |
|
|
323
323
|
|
|
324
324
|
---
|
|
325
325
|
|