@devrouter/cli 0.0.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 +194 -0
- package/dist/dev.js +2772 -0
- package/package.json +45 -0
package/README.md
ADDED
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
# devrouter
|
|
2
|
+
|
|
3
|
+
Local-first routing for macOS development with one shared Traefik router.
|
|
4
|
+
|
|
5
|
+
## What it solves
|
|
6
|
+
|
|
7
|
+
Run multiple repos concurrently without manual port juggling:
|
|
8
|
+
|
|
9
|
+
- HTTP apps by hostname: `web.localhost`, `api.localhost`
|
|
10
|
+
- PostgreSQL DBs by hostname on shared `:5432` via TLS/SNI: `db.localhost`
|
|
11
|
+
|
|
12
|
+
Traefik owns:
|
|
13
|
+
|
|
14
|
+
- `:80` (HTTP)
|
|
15
|
+
- `:443` (HTTPS)
|
|
16
|
+
- `:5432` (Postgres TCP routing)
|
|
17
|
+
|
|
18
|
+
## Unified repo config
|
|
19
|
+
|
|
20
|
+
Each repo now uses one file:
|
|
21
|
+
|
|
22
|
+
- `.devrouter.yml`
|
|
23
|
+
|
|
24
|
+
This is the only supported per-repo config for app routing/runtime definitions.
|
|
25
|
+
|
|
26
|
+
## Core commands
|
|
27
|
+
|
|
28
|
+
- `dev init [--repo <path>] [--entries-json <json>] [--json]`
|
|
29
|
+
- `dev up`
|
|
30
|
+
- `dev down`
|
|
31
|
+
- `dev status [--repo <path>] [--json]`
|
|
32
|
+
- `dev doctor|verify [--repo <path>] [--json]`
|
|
33
|
+
- `dev ls [--json]`
|
|
34
|
+
- `dev open <name>`
|
|
35
|
+
- `dev tls install`
|
|
36
|
+
- `dev repo init [--repo <path>]`
|
|
37
|
+
- `dev app add ...`
|
|
38
|
+
- `dev app ls [--repo <path>] [--json]`
|
|
39
|
+
- `dev app run <name> [--repo <path>] [--yes]`
|
|
40
|
+
- `dev app rm <name> [--repo <path>]`
|
|
41
|
+
|
|
42
|
+
## AI-native onboarding prompt
|
|
43
|
+
|
|
44
|
+
Generate a ready-to-copy onboarding prompt for an AI agent:
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
dev init --repo /absolute/path/to/repo
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Optional: embed target app entries as JSON:
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
dev init --repo /absolute/path/to/repo --entries-json '[{"name":"web","host":"web.localhost","protocol":"http","runtime":"host"}]'
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
JSON mode for machine consumption:
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
dev init --repo /absolute/path/to/repo --json
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
## Health diagnostics
|
|
63
|
+
|
|
64
|
+
Run deep checks for global router state and repo configuration:
|
|
65
|
+
|
|
66
|
+
```bash
|
|
67
|
+
dev doctor --repo /absolute/path/to/repo
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Machine-friendly output:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
dev doctor --repo /absolute/path/to/repo --json
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
`dev status` now includes readiness hints and next-step commands.
|
|
77
|
+
|
|
78
|
+
## `.devrouter.yml` example
|
|
79
|
+
|
|
80
|
+
```yaml
|
|
81
|
+
version: 1
|
|
82
|
+
project:
|
|
83
|
+
name: my-repo
|
|
84
|
+
apps:
|
|
85
|
+
- name: web
|
|
86
|
+
host: web.localhost
|
|
87
|
+
protocol: http
|
|
88
|
+
runtime: host
|
|
89
|
+
hostRun:
|
|
90
|
+
command: pnpm dev
|
|
91
|
+
cwd: .
|
|
92
|
+
strategy:
|
|
93
|
+
type: auto
|
|
94
|
+
denyPorts: [80, 443, 5432]
|
|
95
|
+
allowPortRange: "1024-65535"
|
|
96
|
+
dependencies:
|
|
97
|
+
- app: db
|
|
98
|
+
|
|
99
|
+
- name: db
|
|
100
|
+
host: db.localhost
|
|
101
|
+
protocol: tcp
|
|
102
|
+
tcpProtocol: postgres
|
|
103
|
+
runtime: docker
|
|
104
|
+
docker:
|
|
105
|
+
service: db
|
|
106
|
+
internalPort: 5432
|
|
107
|
+
composeFiles:
|
|
108
|
+
- docker-compose.yml
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Notes:
|
|
112
|
+
|
|
113
|
+
- TCP mode currently supports PostgreSQL first (`tcpProtocol: postgres`).
|
|
114
|
+
- Multi-DB hostname routing on shared `:5432` requires TLS/SNI.
|
|
115
|
+
- Plaintext Postgres is not supported for multiplexed hostname routing.
|
|
116
|
+
|
|
117
|
+
## Runtime behavior
|
|
118
|
+
|
|
119
|
+
`dev app run <name>`:
|
|
120
|
+
|
|
121
|
+
- reads `.devrouter.yml`
|
|
122
|
+
- prompts to start declared dependencies (or use `--yes`)
|
|
123
|
+
- starts only declared docker dependency services
|
|
124
|
+
- fails fast if host-runtime dependencies are configured (start those manually)
|
|
125
|
+
- starts host app command for host runtime apps
|
|
126
|
+
- generates docker overlay in `~/.config/devrouter/cache/...` for docker runtime apps
|
|
127
|
+
|
|
128
|
+
## First onboarding quick path
|
|
129
|
+
|
|
130
|
+
In a repo that has a host app and a Docker Postgres service:
|
|
131
|
+
|
|
132
|
+
```bash
|
|
133
|
+
dev repo init
|
|
134
|
+
dev app add --name web --host web.localhost --protocol http --runtime host --command "pnpm dev" --cwd .
|
|
135
|
+
dev app add --name db --host db.localhost --protocol tcp --runtime docker --tcp-protocol postgres --service db --port 5432 --compose-file docker-compose.yml
|
|
136
|
+
dev app add --name web --host web.localhost --protocol http --runtime host --command "pnpm dev" --cwd . --depends-on db
|
|
137
|
+
dev tls install
|
|
138
|
+
dev app run web --yes
|
|
139
|
+
dev ls
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
Expected endpoints:
|
|
143
|
+
|
|
144
|
+
- `https://web.localhost`
|
|
145
|
+
- `postgres://db.localhost:5432 (tls required)`
|
|
146
|
+
|
|
147
|
+
## Demo workspace (in this repo)
|
|
148
|
+
|
|
149
|
+
A complete sample repository is included at:
|
|
150
|
+
|
|
151
|
+
- [`./demo`](./demo)
|
|
152
|
+
|
|
153
|
+
It contains:
|
|
154
|
+
|
|
155
|
+
- one app running on host (`web-host`)
|
|
156
|
+
- the same app running in Docker (`web-docker`)
|
|
157
|
+
- Postgres in Docker (`db`)
|
|
158
|
+
- ready-to-use `.devrouter.yml`
|
|
159
|
+
|
|
160
|
+
Run the end-to-end smoke demo:
|
|
161
|
+
|
|
162
|
+
```bash
|
|
163
|
+
pnpm demo:smoke
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
See details:
|
|
167
|
+
|
|
168
|
+
- [`./demo/README.md`](./demo/README.md)
|
|
169
|
+
|
|
170
|
+
## Known limitations (v1)
|
|
171
|
+
|
|
172
|
+
- Host-runtime dependencies are not auto-started; only Docker dependencies are auto-started.
|
|
173
|
+
- TCP routing currently supports PostgreSQL only (`tcpProtocol: postgres`).
|
|
174
|
+
- Shared `:5432` hostname multiplexing requires TLS/SNI (`sslmode=require` or stronger).
|
|
175
|
+
|
|
176
|
+
## Router state
|
|
177
|
+
|
|
178
|
+
Global managed artifacts remain under:
|
|
179
|
+
|
|
180
|
+
- `~/.config/devrouter/compose.yml`
|
|
181
|
+
- `~/.config/devrouter/traefik/traefik.yml`
|
|
182
|
+
- `~/.config/devrouter/traefik/dynamic/base.yml`
|
|
183
|
+
- `~/.config/devrouter/traefik/dynamic/host-routes.yml`
|
|
184
|
+
- `~/.config/devrouter/host-routes-state.json`
|
|
185
|
+
- `~/.config/devrouter/cache/...`
|
|
186
|
+
- `~/.config/devrouter/certs/*`
|
|
187
|
+
|
|
188
|
+
## Docs
|
|
189
|
+
|
|
190
|
+
- Setup and bootstrapping: [`docs/GETTING_STARTED.md`](./docs/GETTING_STARTED.md)
|
|
191
|
+
- Onboarding repositories and AI prompt: [`docs/REPO_ONBOARDING.md`](./docs/REPO_ONBOARDING.md)
|
|
192
|
+
- Agent contributor guide: [`AGENTS.md`](./AGENTS.md)
|
|
193
|
+
- Demo workspace: [`./demo/README.md`](./demo/README.md)
|
|
194
|
+
- Roadmap: [`docs/PLAN.md`](./docs/PLAN.md)
|