@neobiotechlabs/neobiotech-dev-agent 0.1.41 → 0.1.42
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/.claude-plugin/marketplace.json +1 -1
- package/.claude-plugin/plugin.json +1 -1
- package/dist/doctor.js +17 -6
- package/dist/doctor.js.map +1 -1
- package/dist/index.js +18 -7
- package/dist/index.js.map +1 -1
- package/dist/setup-antigravity.js +66 -1
- package/dist/setup-antigravity.js.map +1 -1
- package/package.json +1 -1
|
@@ -8,17 +8,82 @@ const __dirname = __dn(__filename);
|
|
|
8
8
|
|
|
9
9
|
// src/cli/setup-antigravity.ts
|
|
10
10
|
import { spawnSync } from "child_process";
|
|
11
|
+
import fs from "fs";
|
|
12
|
+
import os from "os";
|
|
11
13
|
import path from "path";
|
|
12
14
|
import { fileURLToPath } from "url";
|
|
15
|
+
var PLUGIN_NAME = "neobiotech-dev-agent";
|
|
16
|
+
function getAgyPluginDir() {
|
|
17
|
+
return path.join(os.homedir(), ".gemini", "config", "plugins", PLUGIN_NAME);
|
|
18
|
+
}
|
|
19
|
+
function stagePluginToTmpDir(pluginRoot) {
|
|
20
|
+
const stagingRoot = fs.mkdtempSync(
|
|
21
|
+
path.join(os.tmpdir(), `${PLUGIN_NAME}-antigravity-`)
|
|
22
|
+
);
|
|
23
|
+
const pluginDir = path.join(stagingRoot, PLUGIN_NAME);
|
|
24
|
+
fs.cpSync(pluginRoot, pluginDir, { recursive: true });
|
|
25
|
+
return { pluginDir, stagingRoot };
|
|
26
|
+
}
|
|
27
|
+
function cleanupStagingRoot(stagingRoot) {
|
|
28
|
+
try {
|
|
29
|
+
fs.rmSync(stagingRoot, { recursive: true, force: true });
|
|
30
|
+
} catch (error) {
|
|
31
|
+
process.stderr.write(
|
|
32
|
+
`Warning: failed to remove Antigravity staging directory ${stagingRoot}: ${error.message}
|
|
33
|
+
`
|
|
34
|
+
);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function patchMcpConfigCwd() {
|
|
38
|
+
const agyPluginDir = getAgyPluginDir();
|
|
39
|
+
const configPath = path.join(agyPluginDir, "mcp_config.json");
|
|
40
|
+
if (!fs.existsSync(configPath)) {
|
|
41
|
+
process.stderr.write(
|
|
42
|
+
`Warning: mcp_config.json not found at ${configPath}; skipping cwd patch.
|
|
43
|
+
`
|
|
44
|
+
);
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
try {
|
|
48
|
+
const raw = fs.readFileSync(configPath, "utf-8");
|
|
49
|
+
const cfg = JSON.parse(raw);
|
|
50
|
+
for (const server of Object.values(cfg.mcpServers ?? {})) {
|
|
51
|
+
if (server.cwd === ".") server.cwd = agyPluginDir;
|
|
52
|
+
}
|
|
53
|
+
fs.writeFileSync(configPath, JSON.stringify(cfg, null, 2) + "\n", "utf-8");
|
|
54
|
+
return true;
|
|
55
|
+
} catch (err) {
|
|
56
|
+
process.stderr.write(
|
|
57
|
+
`Warning: failed to patch mcp_config.json cwd: ${err.message}
|
|
58
|
+
`
|
|
59
|
+
);
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
13
63
|
function runSetupAntigravityCli(installer = (command, args, options) => spawnSync(command, args, options)) {
|
|
14
64
|
const pluginRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
15
|
-
const
|
|
65
|
+
const stagedPlugin = stagePluginToTmpDir(pluginRoot);
|
|
66
|
+
let result;
|
|
67
|
+
try {
|
|
68
|
+
result = installer("agy", ["plugin", "install", stagedPlugin.pluginDir], {
|
|
69
|
+
stdio: "inherit"
|
|
70
|
+
});
|
|
71
|
+
} catch (error) {
|
|
72
|
+
process.stderr.write(
|
|
73
|
+
`Antigravity plugin install failed: ${error.message}
|
|
74
|
+
`
|
|
75
|
+
);
|
|
76
|
+
return 1;
|
|
77
|
+
} finally {
|
|
78
|
+
cleanupStagingRoot(stagedPlugin.stagingRoot);
|
|
79
|
+
}
|
|
16
80
|
if (result.error) {
|
|
17
81
|
process.stderr.write(`Antigravity plugin install failed: ${result.error.message}
|
|
18
82
|
`);
|
|
19
83
|
return 1;
|
|
20
84
|
}
|
|
21
85
|
if (result.status !== 0) return result.status ?? 1;
|
|
86
|
+
patchMcpConfigCwd();
|
|
22
87
|
process.stdout.write(
|
|
23
88
|
[
|
|
24
89
|
"Antigravity plugin installed: neobiotech-dev-agent",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli/setup-antigravity.ts"],"sourcesContent":["import { spawnSync } from 'node:child_process';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\ntype InstallerResult = {\n error?: Error;\n status: number | null;\n};\n\ntype Installer = (\n command: string,\n args: string[],\n options: { stdio: 'inherit' },\n) => InstallerResult;\n\nexport function runSetupAntigravityCli(\n installer: Installer = (command, args, options) => spawnSync(command, args, options),\n) {\n const pluginRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');\n const result = installer('agy', ['plugin', 'install',
|
|
1
|
+
{"version":3,"sources":["../src/cli/setup-antigravity.ts"],"sourcesContent":["import { spawnSync } from 'node:child_process';\nimport fs from 'node:fs';\nimport os from 'node:os';\nimport path from 'node:path';\nimport { fileURLToPath } from 'node:url';\n\ntype InstallerResult = {\n error?: Error;\n status: number | null;\n};\n\ntype Installer = (\n command: string,\n args: string[],\n options: { stdio: 'inherit' },\n) => InstallerResult;\n\nconst PLUGIN_NAME = 'neobiotech-dev-agent';\n\ntype StagedPlugin = {\n pluginDir: string;\n stagingRoot: string;\n};\n\nfunction getAgyPluginDir(): string {\n return path.join(os.homedir(), '.gemini', 'config', 'plugins', PLUGIN_NAME);\n}\n\n/**\n * Copy the plugin directory to a temp location without `@scope` in the path.\n *\n * Antigravity CLI ≤1.1.22 interprets `@scope/name` inside a path as\n * `plugin@marketplace` syntax and rejects the install. By staging the\n * plugin under `/tmp/neobiotech-dev-agent-antigravity/` we give `agy`\n * a clean path that passes its marketplace heuristic.\n */\nfunction stagePluginToTmpDir(pluginRoot: string): StagedPlugin {\n const stagingRoot = fs.mkdtempSync(\n path.join(os.tmpdir(), `${PLUGIN_NAME}-antigravity-`),\n );\n const pluginDir = path.join(stagingRoot, PLUGIN_NAME);\n fs.cpSync(pluginRoot, pluginDir, { recursive: true });\n return { pluginDir, stagingRoot };\n}\n\nfunction cleanupStagingRoot(stagingRoot: string): void {\n try {\n fs.rmSync(stagingRoot, { recursive: true, force: true });\n } catch (error) {\n process.stderr.write(\n `Warning: failed to remove Antigravity staging directory ${stagingRoot}: ${(error as Error).message}\\n`,\n );\n }\n}\n\n/**\n * After `agy plugin install` copies the plugin into Antigravity's plugin\n * directory, the bundled `mcp_config.json` still has `\"cwd\": \".\"` which\n * Antigravity resolves against the *user's* CWD — not the plugin dir.\n *\n * We patch the installed copy so that `cwd` points to the absolute plugin\n * directory, making `dist/index.js` resolvable regardless of where the\n * user launches Antigravity.\n */\nfunction patchMcpConfigCwd(): boolean {\n const agyPluginDir = getAgyPluginDir();\n const configPath = path.join(agyPluginDir, 'mcp_config.json');\n if (!fs.existsSync(configPath)) {\n process.stderr.write(\n `Warning: mcp_config.json not found at ${configPath}; skipping cwd patch.\\n`,\n );\n return false;\n }\n try {\n const raw = fs.readFileSync(configPath, 'utf-8');\n const cfg = JSON.parse(raw);\n for (const server of Object.values(cfg.mcpServers ?? {}) as Array<{ cwd?: string }>) {\n if (server.cwd === '.') server.cwd = agyPluginDir;\n }\n fs.writeFileSync(configPath, JSON.stringify(cfg, null, 2) + '\\n', 'utf-8');\n return true;\n } catch (err) {\n process.stderr.write(\n `Warning: failed to patch mcp_config.json cwd: ${(err as Error).message}\\n`,\n );\n return false;\n }\n}\n\nexport function runSetupAntigravityCli(\n installer: Installer = (command, args, options) => spawnSync(command, args, options),\n) {\n const pluginRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');\n const stagedPlugin = stagePluginToTmpDir(pluginRoot);\n let result: InstallerResult;\n\n try {\n result = installer('agy', ['plugin', 'install', stagedPlugin.pluginDir], {\n stdio: 'inherit',\n });\n } catch (error) {\n process.stderr.write(\n `Antigravity plugin install failed: ${(error as Error).message}\\n`,\n );\n return 1;\n } finally {\n cleanupStagingRoot(stagedPlugin.stagingRoot);\n }\n\n if (result.error) {\n process.stderr.write(`Antigravity plugin install failed: ${result.error.message}\\n`);\n return 1;\n }\n if (result.status !== 0) return result.status ?? 1;\n\n patchMcpConfigCwd();\n\n process.stdout.write(\n [\n 'Antigravity plugin installed: neobiotech-dev-agent',\n 'Required environment variables: JIRA_URL, JIRA_EMAIL, JIRA_API_TOKEN',\n 'Restart Antigravity, then verify /mcp and /agents.',\n 'Run /gate-parallel-review for a full Gate review.',\n ].join('\\n') + '\\n',\n );\n return 0;\n}\n\nif (process.argv[1] === fileURLToPath(import.meta.url)) {\n process.exitCode = runSetupAntigravityCli();\n}\n"],"mappings":";;;;;;;;;AAAA,SAAS,iBAAiB;AAC1B,OAAO,QAAQ;AACf,OAAO,QAAQ;AACf,OAAO,UAAU;AACjB,SAAS,qBAAqB;AAa9B,IAAM,cAAc;AAOpB,SAAS,kBAA0B;AACjC,SAAO,KAAK,KAAK,GAAG,QAAQ,GAAG,WAAW,UAAU,WAAW,WAAW;AAC5E;AAUA,SAAS,oBAAoB,YAAkC;AAC7D,QAAM,cAAc,GAAG;AAAA,IACrB,KAAK,KAAK,GAAG,OAAO,GAAG,GAAG,WAAW,eAAe;AAAA,EACtD;AACA,QAAM,YAAY,KAAK,KAAK,aAAa,WAAW;AACpD,KAAG,OAAO,YAAY,WAAW,EAAE,WAAW,KAAK,CAAC;AACpD,SAAO,EAAE,WAAW,YAAY;AAClC;AAEA,SAAS,mBAAmB,aAA2B;AACrD,MAAI;AACF,OAAG,OAAO,aAAa,EAAE,WAAW,MAAM,OAAO,KAAK,CAAC;AAAA,EACzD,SAAS,OAAO;AACd,YAAQ,OAAO;AAAA,MACb,2DAA2D,WAAW,KAAM,MAAgB,OAAO;AAAA;AAAA,IACrG;AAAA,EACF;AACF;A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