agent-gate-installer 1.0.0 → 1.2.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.
package/README.md CHANGED
@@ -5,7 +5,7 @@ One-command setup for the [agent-gate](https://github.com/jl-cmd/agent-gate) pro
5
5
  ## Prerequisites
6
6
 
7
7
  - Node.js 18+
8
- - Python 3.12+
8
+ - Python 3.11+
9
9
  - git
10
10
  - A GitHub personal access token with access to `jl-cmd/agent-gate`
11
11
 
@@ -26,7 +26,7 @@ Without `GH_TOKEN`, the installer prompts interactively.
26
26
 
27
27
  ### What it does
28
28
 
29
- 1. Detects Python 3.12+ (tries `python3`, `python`, `py -3`)
29
+ 1. Detects Python 3.11+ (tries `python3`, `python`, `py -3`)
30
30
  2. Clones `jl-cmd/agent-gate` to `~/.claude/agent-gate/`
31
31
  3. Creates a Python venv at `~/.claude/agent-gate/.venv/`
32
32
  4. Installs all agent-gate sub-packages in editable mode
package/bin/install.mjs CHANGED
@@ -1,16 +1,16 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import { execSync } from "node:child_process";
4
- import { existsSync, mkdirSync, readFileSync, writeFileSync, rmSync } from "node:fs";
4
+ import { existsSync, mkdirSync, readFileSync, readdirSync, writeFileSync, rmSync } from "node:fs";
5
5
  import { createInterface } from "node:readline";
6
6
  import { join } from "node:path";
7
- import { homedir, platform } from "node:os";
7
+ import { homedir, platform, tmpdir } from "node:os";
8
8
 
9
9
  const CLAUDE_HOME = join(homedir(), ".claude");
10
10
  const INSTALL_DIR = join(CLAUDE_HOME, "agent-gate");
11
11
  const SETTINGS_PATH = join(CLAUDE_HOME, "settings.json");
12
12
  const REPO_URL = "https://github.com/jl-cmd/agent-gate.git";
13
- const MINIMUM_PYTHON_VERSION = [3, 12];
13
+ const MINIMUM_PYTHON_VERSION = [3, 11];
14
14
  const IS_WINDOWS = platform() === "win32";
15
15
 
16
16
  const HOOK_FILENAMES = ["gate_enforcer.py", "gate_trigger.py", "session_cleanup.py"];
@@ -57,7 +57,7 @@ function detectPython() {
57
57
  continue;
58
58
  }
59
59
  }
60
- log("Error: Python 3.12+ is required but not found.");
60
+ log("Error: Python 3.11+ is required but not found.");
61
61
  log("Install from https://www.python.org/downloads/");
62
62
  process.exit(1);
63
63
  }
@@ -129,7 +129,39 @@ function registerMcpServer(settings, venvPython) {
129
129
  command: venvPython,
130
130
  args: [join(INSTALL_DIR, "src", "agent_gate", "server.py")],
131
131
  };
132
- log(" + Registered agent-gate MCP server");
132
+ log(" + Registered agent-gate MCP server in settings.json");
133
+ }
134
+
135
+ function patchWebMcpConfigs(venvPython) {
136
+ const tmp = tmpdir();
137
+ let patched = 0;
138
+ let files;
139
+ try {
140
+ files = readdirSync(tmp);
141
+ } catch {
142
+ return patched;
143
+ }
144
+
145
+ for (const file of files) {
146
+ if (!file.startsWith("mcp-config-") || !file.endsWith(".json")) continue;
147
+ const filePath = join(tmp, file);
148
+ try {
149
+ const raw = readFileSync(filePath, "utf8");
150
+ const config = JSON.parse(raw);
151
+ if (config.mcpServers?.["agent-gate"]) continue;
152
+ config.mcpServers = config.mcpServers || {};
153
+ config.mcpServers["agent-gate"] = {
154
+ type: "stdio",
155
+ command: venvPython,
156
+ args: [join(INSTALL_DIR, "src", "agent_gate", "server.py")],
157
+ };
158
+ writeFileSync(filePath, JSON.stringify(config) + "\n", "utf8");
159
+ patched++;
160
+ } catch {
161
+ continue;
162
+ }
163
+ }
164
+ return patched;
133
165
  }
134
166
 
135
167
  async function promptForToken() {
@@ -221,6 +253,11 @@ async function install() {
221
253
  registerMcpServer(settings, venvPython);
222
254
  writeSettings(settings);
223
255
 
256
+ const webPatched = patchWebMcpConfigs(venvPython);
257
+ if (webPatched > 0) {
258
+ log(` + Patched ${webPatched} web session MCP config(s) in ${tmpdir()}`);
259
+ }
260
+
224
261
  log(" + Verifying installation...");
225
262
  try {
226
263
  run(`"${venvPython}" -c "from agent_gate.server import create_mcp; print('OK')"`);
@@ -335,7 +372,7 @@ Environment:
335
372
 
336
373
  Prerequisites:
337
374
  - Node.js 18+
338
- - Python 3.12+
375
+ - Python 3.11+
339
376
  - git
340
377
  `);
341
378
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-gate-installer",
3
- "version": "1.0.0",
3
+ "version": "1.2.0",
4
4
  "description": "One-command installer for agent-gate prompt evaluation gate",
5
5
  "type": "module",
6
6
  "bin": {