agent-dev-env 0.1.0-canary.2.fbbd044
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/LICENSE +21 -0
- package/README.md +106 -0
- package/dist/assets/bridge/bridge.js +202 -0
- package/dist/assets/guest/guest-agent-mac.js +586 -0
- package/dist/assets/guest/guest-agent-ubuntu.js +481 -0
- package/dist/assets/guest/guest-agent-windows.js +466 -0
- package/dist/assets/images/mac/CHANGELOG.md +265 -0
- package/dist/assets/images/mac/README.md +63 -0
- package/dist/assets/images/mac/sandbox.pkr.hcl +468 -0
- package/dist/assets/images/mac/vars/sandbox-macos-tahoe.pkrvars.hcl +39 -0
- package/dist/assets/images/ubuntu-arm64-vmware/CHANGELOG.md +239 -0
- package/dist/assets/images/ubuntu-arm64-vmware/README.md +177 -0
- package/dist/assets/images/ubuntu-arm64-vmware/autoinstall/meta-data +2 -0
- package/dist/assets/images/ubuntu-arm64-vmware/autoinstall/user-data +34 -0
- package/dist/assets/images/ubuntu-arm64-vmware/sandbox.pkr.hcl +776 -0
- package/dist/assets/images/ubuntu-arm64-vmware/vars/sandbox-ubuntu-24-04-arm64-vmware.pkrvars.hcl +71 -0
- package/dist/assets/images/windows-arm64-qemu/CHANGELOG.md +209 -0
- package/dist/assets/images/windows-arm64-qemu/README.md +142 -0
- package/dist/assets/images/windows-arm64-qemu/autounattend.xml +325 -0
- package/dist/assets/images/windows-arm64-qemu/qemu-with-tpm.sh +170 -0
- package/dist/assets/images/windows-arm64-qemu/sandbox.pkr.hcl +1012 -0
- package/dist/assets/images/windows-arm64-qemu/vars/sandbox-windows-11-arm64-qemu.pkrvars.hcl +83 -0
- package/dist/assets/images/windows-arm64-vmware/CHANGELOG.md +270 -0
- package/dist/assets/images/windows-arm64-vmware/README.md +171 -0
- package/dist/assets/images/windows-arm64-vmware/autounattend.xml +311 -0
- package/dist/assets/images/windows-arm64-vmware/sandbox.pkr.hcl +1036 -0
- package/dist/assets/images/windows-arm64-vmware/vars/sandbox-windows-11-arm64-vmware.pkrvars.hcl +83 -0
- package/dist/assets/rules/agent-rules-linux.md +68 -0
- package/dist/assets/rules/agent-rules.md +71 -0
- package/dist/assets/watchdog/watch-build-ocr.swift +40 -0
- package/dist/assets/watchdog/watch-build.py +275 -0
- package/dist/cli.js +52 -0
- package/dist/commands/delete.js +179 -0
- package/dist/commands/doctor.js +165 -0
- package/dist/commands/list.js +38 -0
- package/dist/commands/not-yet.js +15 -0
- package/dist/commands/register.js +150 -0
- package/dist/commands/run.js +65 -0
- package/dist/commands/status.js +142 -0
- package/dist/commands/stop.js +186 -0
- package/dist/commands/sync.js +98 -0
- package/dist/lib/exec.js +250 -0
- package/dist/lib/ghcr.js +82 -0
- package/dist/lib/git.js +100 -0
- package/dist/lib/logger.js +87 -0
- package/dist/lib/network.js +63 -0
- package/dist/lib/paths.js +116 -0
- package/dist/lib/platform.js +87 -0
- package/dist/lib/prompt.js +66 -0
- package/dist/lib/qemu.js +373 -0
- package/dist/lib/regex.js +9 -0
- package/dist/lib/ssh.js +230 -0
- package/dist/lib/tart.js +210 -0
- package/dist/lib/template.js +35 -0
- package/dist/lib/vars.js +99 -0
- package/dist/lib/vmrun.js +334 -0
- package/dist/lifecycle/build-macos.js +23 -0
- package/dist/lifecycle/build-qemu.js +204 -0
- package/dist/lifecycle/build-shared.js +355 -0
- package/dist/lifecycle/build-ubuntu.js +184 -0
- package/dist/lifecycle/build-watchdog.js +146 -0
- package/dist/lifecycle/build-windows-vmware.js +112 -0
- package/dist/lifecycle/build.js +55 -0
- package/dist/lifecycle/catalog.js +165 -0
- package/dist/lifecycle/deploy.js +161 -0
- package/dist/lifecycle/tag.js +77 -0
- package/dist/lifecycle/watch-build.js +64 -0
- package/dist/runners/bridges.js +156 -0
- package/dist/runners/framework.js +66 -0
- package/dist/runners/macos-bridges.js +143 -0
- package/dist/runners/macos-guest.js +76 -0
- package/dist/runners/macos-rules.js +77 -0
- package/dist/runners/macos-summary.js +145 -0
- package/dist/runners/macos.js +258 -0
- package/dist/runners/openchamber.js +60 -0
- package/dist/runners/options.js +56 -0
- package/dist/runners/qemu-image.js +183 -0
- package/dist/runners/rules.js +49 -0
- package/dist/runners/ubuntu-bridges.js +154 -0
- package/dist/runners/ubuntu-guest.js +136 -0
- package/dist/runners/ubuntu-image.js +26 -0
- package/dist/runners/ubuntu-rules.js +86 -0
- package/dist/runners/ubuntu-shared.js +65 -0
- package/dist/runners/ubuntu-summary.js +141 -0
- package/dist/runners/ubuntu.js +117 -0
- package/dist/runners/vmware-common.js +158 -0
- package/dist/runners/vmware-image.js +242 -0
- package/dist/runners/windows-autologon.js +119 -0
- package/dist/runners/windows-bridges.js +136 -0
- package/dist/runners/windows-guest.js +213 -0
- package/dist/runners/windows-image.js +23 -0
- package/dist/runners/windows-qemu-summary.js +85 -0
- package/dist/runners/windows-qemu.js +189 -0
- package/dist/runners/windows-shared.js +68 -0
- package/dist/runners/windows-summary.js +104 -0
- package/dist/runners/windows.js +96 -0
- package/dist/settings/common.js +107 -0
- package/dist/settings/macos-copy.js +223 -0
- package/dist/settings/macos.js +41 -0
- package/dist/settings/ubuntu-copy.js +223 -0
- package/dist/settings/ubuntu.js +68 -0
- package/package.json +52 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Andrey Meshkov
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
# agent-dev-env
|
|
2
|
+
|
|
3
|
+
[](https://github.com/ameshkov/agent-dev-env/actions/workflows/ci.yml)
|
|
4
|
+
[](https://www.npmjs.com/package/agent-dev-env)
|
|
5
|
+
[](https://github.com/ameshkov/agent-dev-env/releases)
|
|
6
|
+
|
|
7
|
+
Local sandbox virtual machines for AI coding agents. A pre-built image with
|
|
8
|
+
the full toolchain (macOS with Xcode/Homebrew, Windows 11 ARM64 with
|
|
9
|
+
VS2022/toolchains, or Ubuntu 24.04 with the open-source toolchain; OpenCode,
|
|
10
|
+
OpenCodeReview, OpenChamber, Docker CLI bridged to the host) runs on your
|
|
11
|
+
Mac. Your code stays on the host — you share a working directory into the VM
|
|
12
|
+
and let a coding agent work on it in an isolated sandbox. The
|
|
13
|
+
[`agent-dev-env`](https://www.npmjs.com/package/agent-dev-env) CLI builds,
|
|
14
|
+
runs, and wires up the sandboxes, and manages their image releases.
|
|
15
|
+
|
|
16
|
+
**Currently supported:** macOS host on Apple Silicon → macOS (Tart),
|
|
17
|
+
Windows 11 ARM64 (QEMU, VMware Fusion) and Ubuntu 24.04 LTS ARM64 (VMware
|
|
18
|
+
Fusion) guests. Linux hosts are coming soon.
|
|
19
|
+
|
|
20
|
+
## Quick start
|
|
21
|
+
|
|
22
|
+
Try it without installing:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
npx agent-dev-env doctor # host + tooling check for every platform
|
|
26
|
+
npx agent-dev-env run macos # pull, boot, and wire up the macOS sandbox
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Or install the CLI globally:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
npm install -g agent-dev-env
|
|
33
|
+
agent-dev-env run macos
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Want the latest build from the `master` branch? The CI publishes a canary
|
|
37
|
+
build on every push to npm under the `canary` dist-tag:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install -g agent-dev-env@canary
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
On first use the CLI asks before pulling the image (one-time, ~50 GB for
|
|
44
|
+
macOS) and creating the working VM, then starts it with the recommended
|
|
45
|
+
settings. Every guest gets the host's SSH agent and Docker engine bridged
|
|
46
|
+
in; the macOS and Ubuntu guests additionally share your work directory and
|
|
47
|
+
copy your user settings in. What works where differs per guest — see the
|
|
48
|
+
[macOS guide](docs/macos.md), [Ubuntu guide](docs/ubuntu-vmware.md),
|
|
49
|
+
[Windows QEMU guide](docs/windows-qemu.md) or
|
|
50
|
+
[Windows VMware guide](docs/windows-vmware.md) for your OS, and the
|
|
51
|
+
[CLI reference](docs/cli.md) for every command and option.
|
|
52
|
+
|
|
53
|
+
> Tip: `agent-dev-env doctor` checks Tart/QEMU/Fusion/oras and free disk
|
|
54
|
+
> before you start; the per-platform guides list the official install
|
|
55
|
+
> commands.
|
|
56
|
+
|
|
57
|
+
## Guides
|
|
58
|
+
|
|
59
|
+
Pick the guide for your operating system:
|
|
60
|
+
|
|
61
|
+
| Operating system | Guide |
|
|
62
|
+
| --- | --- |
|
|
63
|
+
| macOS (Apple Silicon) | [Set up your macOS sandbox](docs/macos.md) |
|
|
64
|
+
| Ubuntu (VMware) | [Set up your Ubuntu sandbox](docs/ubuntu-vmware.md) |
|
|
65
|
+
| Windows (QEMU) | [Set up your Windows sandbox](docs/windows-qemu.md) |
|
|
66
|
+
| Windows (VMware) | [Set up your Windows VMware sandbox](docs/windows-vmware.md) |
|
|
67
|
+
|
|
68
|
+
Each guide starts with a short quick setup — macOS takes four steps, the
|
|
69
|
+
others three — and is all you need to have a sandbox with a coding agent
|
|
70
|
+
running.
|
|
71
|
+
|
|
72
|
+
## Documentation
|
|
73
|
+
|
|
74
|
+
User guides and reference:
|
|
75
|
+
|
|
76
|
+
- [docs/cli.md](docs/cli.md) — the `agent-dev-env` CLI reference: commands,
|
|
77
|
+
options, environment variables, paths.
|
|
78
|
+
- [docs/macos.md](docs/macos.md) — user guide: pull, run, share code, run
|
|
79
|
+
the agent (macOS guest).
|
|
80
|
+
- [docs/ubuntu-vmware.md](docs/ubuntu-vmware.md) — Ubuntu 24.04 (ARM64)
|
|
81
|
+
guest under VMware Fusion.
|
|
82
|
+
- [docs/windows-qemu.md](docs/windows-qemu.md) — Windows 11 (ARM64) guest
|
|
83
|
+
under QEMU.
|
|
84
|
+
- [docs/windows-vmware.md](docs/windows-vmware.md) — Windows 11 (ARM64)
|
|
85
|
+
guest under VMware Fusion.
|
|
86
|
+
- [docs/ssh-agent.md](docs/ssh-agent.md) — how the SSH agent bridge shares
|
|
87
|
+
the host's passwords manager (Bitwarden, 1Password, ...) with the
|
|
88
|
+
sandbox.
|
|
89
|
+
|
|
90
|
+
Image recipes — per-platform build/publish commands:
|
|
91
|
+
|
|
92
|
+
- [images/mac/README.md](images/mac/README.md) — macOS images.
|
|
93
|
+
- [images/windows-arm64-qemu/README.md](images/windows-arm64-qemu/README.md)
|
|
94
|
+
— Windows 11 ARM64 under QEMU.
|
|
95
|
+
- [images/windows-arm64-vmware/README.md](images/windows-arm64-vmware/README.md)
|
|
96
|
+
— Windows 11 ARM64 under VMware.
|
|
97
|
+
- [images/ubuntu-arm64-vmware/README.md](images/ubuntu-arm64-vmware/README.md)
|
|
98
|
+
— Ubuntu 24.04 ARM64 under VMware.
|
|
99
|
+
|
|
100
|
+
For maintainers and contributors:
|
|
101
|
+
|
|
102
|
+
- [AGENTS.md](AGENTS.md) — project map, how to build and use the CLI and
|
|
103
|
+
the images, releases/tags/changelogs, code guidelines.
|
|
104
|
+
- [DEVELOPMENT.md](DEVELOPMENT.md) — prerequisites and how to build and
|
|
105
|
+
debug the CLI and the recipes.
|
|
106
|
+
- [CHANGELOG.md](CHANGELOG.md) — the repo changelog.
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
// packages/bridge-core/src/bin.ts
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
|
|
6
|
+
// packages/bridge-core/src/index.ts
|
|
7
|
+
import { rmSync, writeFileSync } from "node:fs";
|
|
8
|
+
|
|
9
|
+
// packages/bridge-core/src/endpoints.ts
|
|
10
|
+
var PIPE_PREFIX = "\\\\.\\pipe\\";
|
|
11
|
+
function parseEndpoint(spec) {
|
|
12
|
+
const sep = spec.indexOf(":");
|
|
13
|
+
if (sep <= 0) {
|
|
14
|
+
throw new Error(`invalid endpoint '${spec}' (expected unix:|pipe:|tcp:)`);
|
|
15
|
+
}
|
|
16
|
+
const scheme = spec.slice(0, sep);
|
|
17
|
+
const rest = spec.slice(sep + 1);
|
|
18
|
+
switch (scheme) {
|
|
19
|
+
case "unix": {
|
|
20
|
+
if (!rest) {
|
|
21
|
+
throw new Error(`invalid unix endpoint '${spec}': missing path`);
|
|
22
|
+
}
|
|
23
|
+
return { kind: "unix", path: rest };
|
|
24
|
+
}
|
|
25
|
+
case "pipe": {
|
|
26
|
+
if (!rest) {
|
|
27
|
+
throw new Error(`invalid pipe endpoint '${spec}': missing name`);
|
|
28
|
+
}
|
|
29
|
+
const name = rest.startsWith(PIPE_PREFIX) ? rest : `${PIPE_PREFIX}${rest}`;
|
|
30
|
+
return { kind: "pipe", name };
|
|
31
|
+
}
|
|
32
|
+
case "tcp": {
|
|
33
|
+
const m = /^([^:]+):(\d+)$/.exec(rest);
|
|
34
|
+
const port = m ? Number(m[2]) : NaN;
|
|
35
|
+
if (!m || !Number.isInteger(port) || port < 1 || port > 65535) {
|
|
36
|
+
throw new Error(`invalid tcp endpoint '${spec}' (expected tcp:host:port, port 1-65535)`);
|
|
37
|
+
}
|
|
38
|
+
return { kind: "tcp", host: m[1], port };
|
|
39
|
+
}
|
|
40
|
+
default:
|
|
41
|
+
throw new Error(
|
|
42
|
+
`unknown endpoint scheme '${scheme}' in '${spec}' (expected unix:|pipe:|tcp:)`
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function formatEndpoint(endpoint) {
|
|
47
|
+
switch (endpoint.kind) {
|
|
48
|
+
case "unix":
|
|
49
|
+
return `unix:${endpoint.path}`;
|
|
50
|
+
case "pipe":
|
|
51
|
+
return `pipe:${endpoint.name}`;
|
|
52
|
+
case "tcp":
|
|
53
|
+
return `tcp:${endpoint.host}:${endpoint.port}`;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// packages/bridge-core/src/forwarder.ts
|
|
58
|
+
import net from "node:net";
|
|
59
|
+
import { existsSync, unlinkSync } from "node:fs";
|
|
60
|
+
function startForwarder(options) {
|
|
61
|
+
const sockets = /* @__PURE__ */ new Set();
|
|
62
|
+
const server = net.createServer((client) => {
|
|
63
|
+
sockets.add(client);
|
|
64
|
+
client.on("close", () => sockets.delete(client));
|
|
65
|
+
forwardConnection(client, options.forward, sockets);
|
|
66
|
+
});
|
|
67
|
+
return bind(server, options.listen).then(() => {
|
|
68
|
+
options.log?.(
|
|
69
|
+
`listening on ${formatEndpoint(options.listen)} \u2192 ${formatEndpoint(options.forward)}`
|
|
70
|
+
);
|
|
71
|
+
return {
|
|
72
|
+
close: () => closeForwarder(server, sockets, options.listen, options.log)
|
|
73
|
+
};
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
function forwardConnection(client, target, sockets) {
|
|
77
|
+
const upstream = connectTo(target);
|
|
78
|
+
sockets.add(upstream);
|
|
79
|
+
upstream.on("close", () => sockets.delete(upstream));
|
|
80
|
+
upstream.once("connect", () => {
|
|
81
|
+
client.pipe(upstream);
|
|
82
|
+
upstream.pipe(client);
|
|
83
|
+
});
|
|
84
|
+
const tearDown = () => {
|
|
85
|
+
client.destroy();
|
|
86
|
+
upstream.destroy();
|
|
87
|
+
};
|
|
88
|
+
upstream.once("error", tearDown);
|
|
89
|
+
client.once("error", () => {
|
|
90
|
+
upstream.destroy();
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
async function bind(server, endpoint) {
|
|
94
|
+
switch (endpoint.kind) {
|
|
95
|
+
case "unix":
|
|
96
|
+
if (existsSync(endpoint.path)) {
|
|
97
|
+
unlinkSync(endpoint.path);
|
|
98
|
+
}
|
|
99
|
+
await listen(server, endpoint.path);
|
|
100
|
+
break;
|
|
101
|
+
case "pipe":
|
|
102
|
+
await listen(server, endpoint.name);
|
|
103
|
+
break;
|
|
104
|
+
case "tcp":
|
|
105
|
+
await listen(server, { port: endpoint.port, host: endpoint.host });
|
|
106
|
+
break;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
function listen(server, spec) {
|
|
110
|
+
return new Promise((resolve, reject) => {
|
|
111
|
+
server.once("error", reject);
|
|
112
|
+
server.listen(spec, () => {
|
|
113
|
+
server.removeListener("error", reject);
|
|
114
|
+
resolve();
|
|
115
|
+
});
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
function connectTo(endpoint) {
|
|
119
|
+
switch (endpoint.kind) {
|
|
120
|
+
case "unix":
|
|
121
|
+
return net.connect({ path: endpoint.path });
|
|
122
|
+
case "pipe":
|
|
123
|
+
return net.connect({ path: endpoint.name });
|
|
124
|
+
case "tcp":
|
|
125
|
+
return net.connect({ port: endpoint.port, host: endpoint.host });
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
function closeForwarder(server, sockets, listen2, log) {
|
|
129
|
+
return new Promise((resolve) => {
|
|
130
|
+
for (const socket of sockets) {
|
|
131
|
+
socket.destroy();
|
|
132
|
+
}
|
|
133
|
+
server.close(() => {
|
|
134
|
+
if (listen2.kind === "unix" && existsSync(listen2.path)) {
|
|
135
|
+
unlinkSync(listen2.path);
|
|
136
|
+
}
|
|
137
|
+
log?.("closed");
|
|
138
|
+
resolve();
|
|
139
|
+
});
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
// packages/bridge-core/src/index.ts
|
|
144
|
+
function parseBridgeArgs(argv) {
|
|
145
|
+
const values = /* @__PURE__ */ new Map();
|
|
146
|
+
for (let i = 0; i < argv.length; i += 2) {
|
|
147
|
+
const flag = argv[i];
|
|
148
|
+
if (flag === "--listen" || flag === "--forward" || flag === "--pidfile") {
|
|
149
|
+
values.set(flag, argv[i + 1] ?? "");
|
|
150
|
+
} else {
|
|
151
|
+
throw new Error(`unknown argument: ${flag}`);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
const listenSpec = values.get("--listen");
|
|
155
|
+
const forwardSpec = values.get("--forward");
|
|
156
|
+
if (!listenSpec || !forwardSpec) {
|
|
157
|
+
throw new Error("usage: bridge --listen <endpoint> --forward <endpoint> [--pidfile PATH]");
|
|
158
|
+
}
|
|
159
|
+
const pidfile = values.get("--pidfile");
|
|
160
|
+
return {
|
|
161
|
+
listen: parseEndpoint(listenSpec),
|
|
162
|
+
forward: parseEndpoint(forwardSpec),
|
|
163
|
+
pidfile: pidfile || void 0
|
|
164
|
+
};
|
|
165
|
+
}
|
|
166
|
+
async function runBridge(options) {
|
|
167
|
+
const running = await startForwarder(options);
|
|
168
|
+
if (options.pidfile) {
|
|
169
|
+
writeFileSync(options.pidfile, `${process.pid}
|
|
170
|
+
`);
|
|
171
|
+
}
|
|
172
|
+
await new Promise((resolve) => {
|
|
173
|
+
const stop = () => {
|
|
174
|
+
void running.close().then(() => {
|
|
175
|
+
if (options.pidfile) {
|
|
176
|
+
rmSync(options.pidfile, { force: true });
|
|
177
|
+
}
|
|
178
|
+
resolve();
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
process.on("SIGINT", stop);
|
|
182
|
+
process.on("SIGTERM", stop);
|
|
183
|
+
});
|
|
184
|
+
return 0;
|
|
185
|
+
}
|
|
186
|
+
async function main(argv) {
|
|
187
|
+
const args = parseBridgeArgs(argv);
|
|
188
|
+
return runBridge({
|
|
189
|
+
listen: args.listen,
|
|
190
|
+
forward: args.forward,
|
|
191
|
+
pidfile: args.pidfile,
|
|
192
|
+
log: (message) => process.stderr.write(`${message}
|
|
193
|
+
`)
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
// packages/bridge-core/src/bin.ts
|
|
198
|
+
if (process.argv[1] === fileURLToPath(import.meta.url)) {
|
|
199
|
+
void main(process.argv.slice(2)).then((code) => {
|
|
200
|
+
process.exit(code);
|
|
201
|
+
});
|
|
202
|
+
}
|