dev-code-proxy 0.0.0-stage → 4.0.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mohamed Meabed
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 CHANGED
@@ -1,3 +1,92 @@
1
- # Temporary Holding Version
1
+ # dev-code-proxy (`dcp`)
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ [![ci](https://github.com/meabed/dev-code-proxy/actions/workflows/ci.yml/badge.svg)](https://github.com/meabed/dev-code-proxy/actions/workflows/ci.yml)
4
+ [![npm](https://img.shields.io/npm/v/dev-code-proxy)](https://www.npmjs.com/package/dev-code-proxy)
5
+ [![docs](https://img.shields.io/badge/docs-dev-code-proxy.vercel.app-blue)](https://dev-code-proxy.vercel.app)
6
+
7
+ Real HTTPS addresses for your local dev servers. On your machine, each app gets a trusted
8
+ `https://<name>.localhost`; online, each dev server gets a link through Tailscale, and through Cloudflare under
9
+ your own domain, that stays the same, for webhooks, OAuth callbacks, your phone and your teammates.
10
+
11
+ ```
12
+ https://api.acme.localhost → your app, only from this machine (found by itself)
13
+ https://bigfoot.tail1234.ts.net/api/webhooks/stripe → the same app, from anywhere (Tailscale, on by default)
14
+ https://api-acme-bigfoot.example.com/webhooks/stripe → the same app, from anywhere (Cloudflare: dcp share)
15
+ ```
16
+
17
+ **Docs: https://dev-code-proxy.vercel.app** · for coding agents: [llms-full.txt](https://dev-code-proxy.vercel.app/llms-full.txt)
18
+
19
+ ## Install
20
+
21
+ ```bash
22
+ brew install meabed/tap/dcp # macOS and Linux
23
+ npm i -g dev-code-proxy # anywhere (the command is dcp)
24
+ ```
25
+
26
+ macOS, Linux, Windows and WSL, on amd64 and arm64. There is also a
27
+ [desktop app](https://dev-code-proxy.vercel.app/desktop) for the menu bar.
28
+
29
+ ## Use it
30
+
31
+ ```bash
32
+ dcp service install # once per machine: https://*.localhost from boot (your password once)
33
+ dcp run # in an app folder: serves it at https://<name>.localhost
34
+ dcp ls # every app with each link: local, tailscale, cloudflare (grep-friendly, --json)
35
+ dcp url api --tailscale # just one URL: curl $(dcp url api --cloudflare)
36
+ dcp share # each provider online, or the problem and its fix (Tailscale is on by default)
37
+ dcp share cloudflare on --zone example.com --env-file .env # links under your own domain
38
+ dcp share --check # open every link from the outside: DNS, certificate, status
39
+ dcp doctor # check everything; each ✗ comes with the command that fixes it
40
+ dcp stats # how the proxies run: health, requests per name, p50/p95
41
+ dcp uninstall # remove everything dcp set up
42
+ ```
43
+
44
+ Start your dev servers the way you always do: the local proxy finds each one and serves it at
45
+ `https://<folder>.localhost`, with no script changes and nothing for teammates to install. Name a project in
46
+ the file its stack already has (first found wins): `.dcp.json`, `"dcp"` in `package.json` / `deno.json`,
47
+ `[tool.dcp]` in `pyproject.toml`, `[package.metadata.dcp]` in `Cargo.toml`, `"extra": {"dcp"}` in `composer.json`:
48
+
49
+ ```json
50
+ { "name": "api.acme" }
51
+ ```
52
+
53
+ `dcp run` is the other way, for an app that should get its port from dcp. It reads the name and dev script from
54
+ the same config, or takes any command:
55
+
56
+ ```jsonc
57
+ "scripts": { "dev": "dcp run", "dev:app": "vite --port $PORT --host $HOST" },
58
+ "dcp": { "name": "web.acme", "script": "dev:app" }
59
+ ```
60
+
61
+ ```bash
62
+ dcp run api -- 'uvicorn main:app --reload --port $PORT --host $HOST' # one quoted command: the shell expands $PORT
63
+ dcp run api -- node server.js # an app that reads PORT itself
64
+ ```
65
+
66
+ `https://dcp.localhost` lists what runs, with requests and latency per name (`/api/status` as JSON) and a Stop
67
+ button per app; `dcp stop <name|port>` does the same from a terminal. `http://*.localhost` opens the same pages over
68
+ https.
69
+
70
+ The local HTTPS proxy updates itself: a newer dcp (from brew, npm or its own daily, checksum-verified check)
71
+ takes over live once it proves it serves, and one that fails is set aside while the previous one keeps serving.
72
+ Everything dcp keeps is in `~/.dcp`.
73
+
74
+ | Guide | |
75
+ | --- | --- |
76
+ | [Install](https://dev-code-proxy.vercel.app/installation) | Set up local HTTPS and Tailscale |
77
+ | [Local HTTPS names](https://dev-code-proxy.vercel.app/local-https) | `dcp run`, certificates, the boot service |
78
+ | [Share online](https://dev-code-proxy.vercel.app/share) | Tailscale (Funnel or Serve) and Cloudflare, what gets found, what your app sees |
79
+ | [Webhooks & OAuth callbacks](https://dev-code-proxy.vercel.app/webhooks) | Stripe, GitHub, Slack, sign-in redirects |
80
+ | [Use with AI agents](https://dev-code-proxy.vercel.app/agents) | A prompt and an AGENTS.md section |
81
+ | [Commands](https://dev-code-proxy.vercel.app/commands) | Every command and flag |
82
+ | [Troubleshooting](https://dev-code-proxy.vercel.app/troubleshooting) | Symptoms and the fix for each |
83
+
84
+ ## Develop
85
+
86
+ Go, standard library only. `go test -race ./...`, `go vet ./...`; the site is `website/` (`bun run build`).
87
+ [AGENT.md](AGENT.md) has the rules and repo map, [docs/ARCHITECTURE.md](docs/ARCHITECTURE.md) how it works
88
+ inside, [docs/TESTING.md](docs/TESTING.md) and [docs/RELEASING.md](docs/RELEASING.md) the rest.
89
+
90
+ ## License
91
+
92
+ MIT
@@ -0,0 +1,138 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+
4
+ // Resolves the native `dcp` binary and runs it. Primary path: the per-platform
5
+ // optionalDependency package (installed automatically by npm). Fallback: download
6
+ // the matching binary from the GitHub release and cache it — so `npx
7
+ // dev-code-proxy` always just works, even if the optional package was skipped.
8
+
9
+ const { spawn, spawnSync } = require("node:child_process");
10
+ const fs = require("node:fs");
11
+ const os = require("node:os");
12
+ const path = require("node:path");
13
+
14
+ const REPO = "meabed/dev-code-proxy";
15
+ const VERSION = require("../package.json").version;
16
+
17
+ const PLATFORM = process.platform; // 'darwin' | 'linux' | 'win32'
18
+ const ARCH = process.arch; // 'x64' | 'arm64'
19
+ const EXE = PLATFORM === "win32" ? "dcp.exe" : "dcp";
20
+
21
+ // goreleaser archive naming uses Go's GOOS/GOARCH.
22
+ const GOOS = PLATFORM === "win32" ? "windows" : PLATFORM;
23
+ const GOARCH = ARCH === "x64" ? "amd64" : ARCH;
24
+
25
+ function fromOptionalDep() {
26
+ try {
27
+ return require.resolve(`dev-code-proxy-${PLATFORM}-${ARCH}/bin/${EXE}`);
28
+ } catch {
29
+ return null;
30
+ }
31
+ }
32
+
33
+ function cacheRoot() {
34
+ return path.join(process.env.XDG_CACHE_HOME || path.join(os.homedir(), ".cache"), "dev-code-proxy");
35
+ }
36
+
37
+ function cacheDir() {
38
+ return path.join(cacheRoot(), `v${VERSION}`);
39
+ }
40
+
41
+ // Downloaded binaries of other versions go: an update leaves only the one this
42
+ // launcher runs (or none, when the platform package supplies it).
43
+ function pruneCache(keep) {
44
+ let entries;
45
+ try {
46
+ entries = fs.readdirSync(cacheRoot());
47
+ } catch {
48
+ return;
49
+ }
50
+ for (const entry of entries) {
51
+ if (entry !== keep) fs.rmSync(path.join(cacheRoot(), entry), { recursive: true, force: true });
52
+ }
53
+ }
54
+
55
+ function fromCache() {
56
+ const p = path.join(cacheDir(), EXE);
57
+ return fs.existsSync(p) ? p : null;
58
+ }
59
+
60
+ function downloadToCache() {
61
+ const ext = PLATFORM === "win32" ? "zip" : "tar.gz";
62
+ const asset = `dcp_${GOOS}_${GOARCH}.${ext}`;
63
+ // Prefer the exact version; fall back to the latest release if that asset is
64
+ // missing (e.g. a stale/placeholder launcher version) so it always self-heals.
65
+ const urls = [
66
+ `https://github.com/${REPO}/releases/download/v${VERSION}/${asset}`,
67
+ `https://github.com/${REPO}/releases/latest/download/${asset}`,
68
+ ];
69
+ const dir = cacheDir();
70
+ fs.mkdirSync(dir, { recursive: true });
71
+ const archive = path.join(dir, asset);
72
+
73
+ let ok = false;
74
+ for (const url of urls) {
75
+ process.stderr.write(`dev-code-proxy: fetching ${asset}…\n`);
76
+ if (spawnSync("curl", ["-fsSL", "-o", archive, url], { stdio: ["ignore", "ignore", "inherit"] }).status === 0) {
77
+ ok = true;
78
+ break;
79
+ }
80
+ }
81
+ if (!ok) {
82
+ throw new Error(`could not download ${asset} for v${VERSION} or latest`);
83
+ }
84
+ // `tar` extracts both .tar.gz and .zip on macOS/Linux/Windows-10+.
85
+ const ex = spawnSync("tar", ["-xf", archive, "-C", dir], { stdio: ["ignore", "ignore", "inherit"] });
86
+ if (ex.status !== 0) {
87
+ throw new Error(`extract failed: ${archive}`);
88
+ }
89
+ fs.rmSync(archive, { force: true });
90
+ const bin = path.join(dir, EXE);
91
+ if (!fs.existsSync(bin)) {
92
+ throw new Error(`binary ${EXE} not found in ${asset}`);
93
+ }
94
+ fs.chmodSync(bin, 0o755);
95
+ return bin;
96
+ }
97
+
98
+ function resolveBinary() {
99
+ const bundled = fromOptionalDep();
100
+ if (bundled) {
101
+ pruneCache(null);
102
+ return bundled;
103
+ }
104
+ const bin = fromCache() || downloadToCache();
105
+ pruneCache(`v${VERSION}`);
106
+ return bin;
107
+ }
108
+
109
+ // Runs the binary with this process's arguments and exits with its code. Ctrl-C
110
+ // from the terminal reaches the binary directly (one process group), so this
111
+ // process only waits for it; a SIGTERM or SIGHUP sent to this process alone is
112
+ // passed on, so `dcp run` still releases its name and stops its app.
113
+ function main() {
114
+ let bin;
115
+ try {
116
+ bin = resolveBinary();
117
+ } catch (err) {
118
+ console.error(
119
+ `dev-code-proxy: could not obtain a binary for ${PLATFORM}-${ARCH} (v${VERSION}).\n` +
120
+ `${err.message}\n` +
121
+ `Install from source instead: go install github.com/${REPO}@latest\n` +
122
+ `Releases: https://github.com/${REPO}/releases`
123
+ );
124
+ process.exit(1);
125
+ }
126
+ const child = spawn(bin, process.argv.slice(2), { stdio: "inherit" });
127
+ process.on("SIGINT", () => {});
128
+ for (const signal of ["SIGTERM", "SIGHUP"]) {
129
+ process.on(signal, () => child.kill(signal));
130
+ }
131
+ child.on("error", (err) => {
132
+ console.error(err.message);
133
+ process.exit(1);
134
+ });
135
+ child.on("exit", (code, signal) => process.exit(code ?? (signal ? 128 + (os.constants.signals[signal] ?? 0) : 1)));
136
+ }
137
+
138
+ main();
package/package.json CHANGED
@@ -1,6 +1,93 @@
1
1
  {
2
2
  "name": "dev-code-proxy",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "4.0.0",
4
+ "description": "Discover local dev servers by port and expose them through one Tailscale Serve/Funnel entry, routed by project name, and serve them locally at https://<name>.localhost.",
5
+ "keywords": [
6
+ "tailscale",
7
+ "tailscale-funnel",
8
+ "tailscale-serve",
9
+ "funnel",
10
+ "serve",
11
+ "reverse-proxy",
12
+ "proxy",
13
+ "dev",
14
+ "discovery",
15
+ "localhost",
16
+ "https",
17
+ "local-https",
18
+ "tunnel",
19
+ "ngrok",
20
+ "ngrok-alternative",
21
+ "localtunnel"
22
+ ],
23
+ "homepage": "https://github.com/meabed/dev-code-proxy#readme",
24
+ "bugs": {
25
+ "url": "https://github.com/meabed/dev-code-proxy/issues",
26
+ "email": "mo@meabed.com"
27
+ },
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "git+https://github.com/meabed/dev-code-proxy.git"
31
+ },
32
+ "funding": {
33
+ "type": "github",
34
+ "url": "https://github.com/sponsors/meabed"
35
+ },
36
+ "license": "MIT",
37
+ "author": {
38
+ "name": "Mohamed Meabed",
39
+ "email": "mo@meabed.com",
40
+ "url": "https://meabed.com"
41
+ },
42
+ "bin": {
43
+ "dev-code-proxy": "bin/launcher.js",
44
+ "dcp": "bin/launcher.js"
45
+ },
46
+ "files": [
47
+ "bin/launcher.js",
48
+ "README.md"
49
+ ],
50
+ "scripts": {
51
+ "lint": "gofmt -l . && go vet ./...",
52
+ "format": "gofmt -w .",
53
+ "test": "go test ./...",
54
+ "test-ci": "go test -race -count=1 ./...",
55
+ "build:binaries": "goreleaser release --clean --snapshot --skip=publish,announce",
56
+ "build:npm": "node npm/build-platform-packages.mjs",
57
+ "prepare": "if [ -z \"$CI\" ] && [ -e .git ] && [ -x ./node_modules/.bin/husky ]; then ./node_modules/.bin/husky; fi",
58
+ "release": "semantic-release",
59
+ "release:dry": "semantic-release --dry-run",
60
+ "release:local": "node scripts/release-local.mjs"
61
+ },
62
+ "lint-staged": {
63
+ "*.go": [
64
+ "gofmt -w"
65
+ ]
66
+ },
67
+ "devDependencies": {
68
+ "@semantic-release/commit-analyzer": "^13.0.1",
69
+ "@semantic-release/exec": "^7.1.0",
70
+ "@semantic-release/github": "^12.0.11",
71
+ "@semantic-release/npm": "^13.2.0",
72
+ "@semantic-release/release-notes-generator": "^14.1.1",
73
+ "conventional-changelog-conventionalcommits": "^10.4.1",
74
+ "husky": "^9.1.7",
75
+ "lint-staged": "^17.6.2",
76
+ "semantic-release": "^26.0.1"
77
+ },
78
+ "optionalDependencies": {
79
+ "dev-code-proxy-darwin-arm64": "4.0.0",
80
+ "dev-code-proxy-darwin-x64": "4.0.0",
81
+ "dev-code-proxy-linux-x64": "4.0.0",
82
+ "dev-code-proxy-linux-arm64": "4.0.0",
83
+ "dev-code-proxy-win32-x64": "4.0.0",
84
+ "dev-code-proxy-win32-arm64": "4.0.0"
85
+ },
86
+ "packageManager": "bun@1.4.5",
87
+ "engines": {
88
+ "node": ">= 18.0"
89
+ },
90
+ "publishConfig": {
91
+ "access": "public"
92
+ }
93
+ }