agent-gate-installer 1.3.0 → 1.4.0

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.
Files changed (2) hide show
  1. package/bin/install.mjs +14 -55
  2. package/package.json +1 -1
package/bin/install.mjs CHANGED
@@ -1,10 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { execSync } from "node:child_process";
4
- import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync, rmSync } from "node:fs";
4
+ import { existsSync, mkdirSync, readFileSync, writeFileSync, rmSync } from "node:fs";
5
5
  import { createInterface } from "node:readline";
6
6
  import { join } from "node:path";
7
- import { homedir, platform, tmpdir } from "node:os";
7
+ import { homedir, platform } from "node:os";
8
8
 
9
9
  const CLAUDE_HOME = join(homedir(), ".claude");
10
10
  const INSTALL_DIR = join(CLAUDE_HOME, "agent-gate");
@@ -122,21 +122,6 @@ function mergeHooks(settings, venvPython) {
122
122
  }
123
123
  }
124
124
 
125
- function writeMcpJson(venvPython, directory) {
126
- const mcpJsonPath = join(directory, ".mcp.json");
127
- const config = {
128
- mcpServers: {
129
- "agent-gate": {
130
- type: "stdio",
131
- command: venvPython,
132
- args: [join(INSTALL_DIR, "src", "agent_gate", "server.py")],
133
- },
134
- },
135
- };
136
- writeFileSync(mcpJsonPath, JSON.stringify(config, null, 4) + "\n", "utf8");
137
- log(` + Wrote .mcp.json to ${directory}`);
138
- }
139
-
140
125
  function registerMcpServer(settings, venvPython) {
141
126
  settings.mcpServers = settings.mcpServers || {};
142
127
  settings.mcpServers["agent-gate"] = {
@@ -144,39 +129,22 @@ function registerMcpServer(settings, venvPython) {
144
129
  command: venvPython,
145
130
  args: [join(INSTALL_DIR, "src", "agent_gate", "server.py")],
146
131
  };
147
- log(" + Registered agent-gate MCP server in settings.json");
132
+ log(" + Registered agent-gate MCP server");
148
133
  }
149
134
 
150
- function patchWebMcpConfigs(venvPython) {
151
- const tmp = tmpdir();
152
- let patched = 0;
153
- let files;
154
- try {
155
- files = readdirSync(tmp);
156
- } catch {
157
- return patched;
158
- }
159
-
160
- for (const file of files) {
161
- if (!file.startsWith("mcp-config-") || !file.endsWith(".json")) continue;
162
- const filePath = join(tmp, file);
163
- try {
164
- const raw = readFileSync(filePath, "utf8");
165
- const config = JSON.parse(raw);
166
- if (config.mcpServers?.["agent-gate"]) continue;
167
- config.mcpServers = config.mcpServers || {};
168
- config.mcpServers["agent-gate"] = {
135
+ function writeMcpConfigFile(venvPython) {
136
+ const mcpConfigPath = join("/tmp", "agent-gate-mcp-config.json");
137
+ const config = {
138
+ mcpServers: {
139
+ "agent-gate": {
169
140
  type: "stdio",
170
141
  command: venvPython,
171
142
  args: [join(INSTALL_DIR, "src", "agent_gate", "server.py")],
172
- };
173
- writeFileSync(filePath, JSON.stringify(config) + "\n", "utf8");
174
- patched++;
175
- } catch {
176
- continue;
177
- }
178
- }
179
- return patched;
143
+ },
144
+ },
145
+ };
146
+ writeFileSync(mcpConfigPath, JSON.stringify(config, null, 4) + "\n", "utf8");
147
+ log(` + Wrote ${mcpConfigPath}`);
180
148
  }
181
149
 
182
150
  async function promptForToken() {
@@ -268,16 +236,7 @@ async function install() {
268
236
  registerMcpServer(settings, venvPython);
269
237
  writeSettings(settings);
270
238
 
271
- writeMcpJson(venvPython, INSTALL_DIR);
272
- const cwd = process.cwd();
273
- if (cwd !== INSTALL_DIR && existsSync(join(cwd, "src", "agent_gate"))) {
274
- writeMcpJson(venvPython, cwd);
275
- }
276
-
277
- const webPatched = patchWebMcpConfigs(venvPython);
278
- if (webPatched > 0) {
279
- log(` + Patched ${webPatched} web session MCP config(s) in ${tmpdir()}`);
280
- }
239
+ writeMcpConfigFile(venvPython);
281
240
 
282
241
  log(" + Verifying installation...");
283
242
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-gate-installer",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "One-command installer for agent-gate prompt evaluation gate",
5
5
  "type": "module",
6
6
  "bin": {