@mylasecurity/gate 0.2.1 → 0.3.1
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 +63 -41
- package/bin/gate.mjs +1906 -31
- package/package.json +15 -3
package/README.md
CHANGED
|
@@ -1,63 +1,85 @@
|
|
|
1
1
|
# @mylasecurity/gate
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
atomically, and prints exactly what it changed — so a non-developer never has to find a hidden folder
|
|
6
|
-
or merge JSON by hand.
|
|
3
|
+
Put the [Myla](https://mylasecurity.app) Gate in front of the AI agents on your machine, so a tool
|
|
4
|
+
call is judged before it runs instead of explained afterwards.
|
|
7
5
|
|
|
8
|
-
|
|
6
|
+
Two ways in, depending on what the agent is:
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
# A coding agent (Claude Code, Cursor, Codex): merges the Gate into its hooks
|
|
9
10
|
npx @mylasecurity/gate install <claim-code>
|
|
11
|
+
|
|
12
|
+
# Any MCP client (Claude Desktop and friends): puts the Gate in front of its MCP servers
|
|
13
|
+
npx @mylasecurity/gate mcp install <claim-code>
|
|
10
14
|
```
|
|
11
15
|
|
|
16
|
+
The claim code comes from Myla, where you add the agent. It works once. Everything else the command
|
|
17
|
+
needs, it works out for itself: there is no folder to find and no JSON to merge by hand.
|
|
18
|
+
|
|
19
|
+
## What it does to your machine
|
|
20
|
+
|
|
21
|
+
* It **merges**, never replaces. Your own hooks, and hooks pointing anywhere else, are kept.
|
|
22
|
+
* It **backs up every file before it changes it**, and writes atomically.
|
|
23
|
+
* It **prints exactly what it changed**, file by file and server by server.
|
|
24
|
+
* A reinstall is idempotent: a previous Myla entry is replaced, not duplicated.
|
|
25
|
+
* If a file it needs is not valid JSON, it stops, names the problem, and changes nothing.
|
|
26
|
+
* It **never prints your credential**: not in `--dry-run`, not in an error, not in `doctor`. The
|
|
27
|
+
credential is stored owner-read only in your home folder, and never passed on a command line,
|
|
28
|
+
where any process on the machine could read it.
|
|
29
|
+
|
|
12
30
|
## Commands
|
|
13
31
|
|
|
14
32
|
| Command | What it does |
|
|
15
33
|
| --- | --- |
|
|
16
|
-
| `install <code>` |
|
|
17
|
-
| `install <code> --dry-run` |
|
|
18
|
-
| `doctor` |
|
|
19
|
-
| `uninstall` | Remove
|
|
34
|
+
| `install <code>` | Put the Gate in front of a coding agent: fetch, validate, back up, merge, write, report. Also names any other Myla config it finds on the machine, without touching it. |
|
|
35
|
+
| `install <code> --dry-run` | Print exactly what would be written, with the credential masked. Writes nothing. |
|
|
36
|
+
| `doctor` | Is the hook installed, which host does it point at, and does the Gate still recognise the token? One read-only call. Writes nothing. |
|
|
37
|
+
| `uninstall` | Remove only Myla's hook entries, backing up first. |
|
|
38
|
+
| `mcp` | What is behind the Gate on this machine and what is not, per app, with the files it read. Read-only. |
|
|
39
|
+
| `mcp install <code>` | Put every MCP server configured in Claude Desktop, Claude Code and Cursor behind the Gate, as its own agent. |
|
|
40
|
+
| `mcp uninstall` | Put those servers back exactly as they were. |
|
|
41
|
+
| `offline on` | Keep deciding when Myla cannot be reached (see below). `offline off` explains the way back. |
|
|
42
|
+
| `sync` | Hand over anything decided offline, and take a fresh copy of the rules. |
|
|
43
|
+
| `log` | What this machine decided and the rules it used. Reads only your home folder, works with no network. `--html` writes a self-contained page. |
|
|
44
|
+
| `serve` | The same, live, as a page at `127.0.0.1`. Nothing leaves the machine. |
|
|
45
|
+
| `ask` | Ask about one call from any agent: `{"tool","args"}` on stdin, a verdict on stdout. For scripts and agents with no hooks. |
|
|
20
46
|
|
|
21
|
-
|
|
47
|
+
Flags: `--client claude-code|cursor|codex` (default `claude-code`), `--origin <url>` to install
|
|
48
|
+
against a staging deployment, `--dry-run`, `--help`.
|
|
22
49
|
|
|
23
|
-
|
|
24
|
-
- `--origin <url>` — which Myla deployment (default the production host). Needed to install against a
|
|
25
|
-
staging or local deployment.
|
|
26
|
-
- `--dry-run` — `install`/`uninstall`: don't write, just show.
|
|
50
|
+
## When the network is gone
|
|
27
51
|
|
|
28
|
-
|
|
52
|
+
By default every decision is Myla's: the hook asks her and waits. `offline on` adds the Gate itself
|
|
53
|
+
to the machine, and from then on:
|
|
29
54
|
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
line, and changes nothing — no write, no backup.
|
|
36
|
-
- **A reinstall is idempotent.** A prior Myla block is replaced, not duplicated.
|
|
55
|
+
1. Myla is still asked first, with a short timeout. Her answer wins whenever she can be reached.
|
|
56
|
+
2. When she cannot, the signed copy of the rules on the machine decides, instead of the call going
|
|
57
|
+
through unchecked.
|
|
58
|
+
3. What was decided offline is recorded there and handed over on the next `sync`, marked as having
|
|
59
|
+
been decided on the machine.
|
|
37
60
|
|
|
38
|
-
|
|
61
|
+
The rules are signed and have a life of their own: past it, a decision made from them is marked
|
|
62
|
+
stale rather than presented as current. `gate log` and `gate serve` read that record with no
|
|
63
|
+
network at all, so the one moment you most want to see what your agents did is not the moment the
|
|
64
|
+
product stops working.
|
|
39
65
|
|
|
40
|
-
|
|
41
|
-
|
|
66
|
+
The cost, plainly: for Claude Code, the hook today is an HTTP call and nothing runs on your machine.
|
|
67
|
+
`offline on` runs a command on every tool call instead. For Cursor and Codex the hook already runs a
|
|
68
|
+
command, so it swaps one for another.
|
|
42
69
|
|
|
43
|
-
|
|
44
|
-
# From the repo root — same tsx the rest of the repo's scripts use:
|
|
45
|
-
npx tsx packages/gate-cli/src/cli.ts install <claim-code>
|
|
46
|
-
npx tsx packages/gate-cli/src/cli.ts install <claim-code> --dry-run
|
|
47
|
-
npx tsx packages/gate-cli/src/cli.ts doctor
|
|
48
|
-
```
|
|
70
|
+
## Requirements
|
|
49
71
|
|
|
50
|
-
|
|
72
|
+
Node 18 or newer. No dependencies, and no network access except to your Myla deployment.
|
|
51
73
|
|
|
52
|
-
|
|
53
|
-
cd packages/gate-cli && npm run build # esbuild → bin/gate.mjs (a single file, no node_modules)
|
|
54
|
-
node packages/gate-cli/bin/gate.mjs doctor
|
|
55
|
-
```
|
|
74
|
+
## Developing
|
|
56
75
|
|
|
57
|
-
`bin/gate.mjs` is a build artifact
|
|
58
|
-
|
|
76
|
+
The source in `src/` is the single source of truth. `bin/gate.mjs` is a build artifact
|
|
77
|
+
(git-ignored, rebuilt on publish):
|
|
59
78
|
|
|
60
|
-
|
|
79
|
+
```bash
|
|
80
|
+
cd packages/gate-cli && npm run build # esbuild, one file, no node_modules
|
|
81
|
+
node bin/gate.mjs doctor
|
|
82
|
+
```
|
|
61
83
|
|
|
62
|
-
|
|
63
|
-
`npm run check:gate-cli`
|
|
84
|
+
Tests are fixture-driven and offline, and run against the source rather than the bundle:
|
|
85
|
+
`npm run check:gate-cli`, `check:offline`, `check:offline-view`, `check:ask`, `check:mcp-proxy`.
|