@devrouter/cli 0.0.24 → 0.0.26
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 +51 -47
- package/dist/devrouter.js +4406 -3730
- package/package.json +9 -2
- package/upgrade-prompts/0.0.24.md +10 -0
- package/upgrade-prompts/0.0.25.md +20 -0
- package/upgrade-prompts/0.0.26.md +27 -0
package/README.md
CHANGED
|
@@ -2,18 +2,32 @@
|
|
|
2
2
|
|
|
3
3
|
Local-first routing for macOS development with one shared Traefik router.
|
|
4
4
|
|
|
5
|
+
## AI Agent Onboarding
|
|
6
|
+
|
|
7
|
+
If you are pair programming with an AI agent (such as Cursor, GitHub Copilot, Gemini, or Claude) to onboard or work on a repository, run the following command at the very start to generate a ready-to-copy, context-rich onboarding prompt for the agent:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Using npm/npx:
|
|
11
|
+
npx @devrouter/cli init --repo .
|
|
12
|
+
|
|
13
|
+
# Or using pnpm/pnpm dlx:
|
|
14
|
+
pnpm dlx @devrouter/cli init --repo .
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
This prints a canonical prompt containing the full config schemas, best-practice workflows, docker dependency configurations, and verification commands required to configure the repo's devrouter setup.
|
|
18
|
+
|
|
5
19
|
## What it solves
|
|
6
20
|
|
|
7
21
|
Run multiple repos concurrently without manual port juggling:
|
|
8
22
|
|
|
9
23
|
- HTTP apps by hostname: `web.localhost`, `api.localhost`
|
|
10
|
-
-
|
|
24
|
+
- Databases (Postgres, Redis, MariaDB, MySQL) by hostname on their standard shared ports via TLS/SNI: `db.localhost`, `redis.localhost`
|
|
11
25
|
|
|
12
26
|
Traefik owns:
|
|
13
27
|
|
|
14
28
|
- `:80` (HTTP)
|
|
15
29
|
- `:443` (HTTPS)
|
|
16
|
-
- `:5432
|
|
30
|
+
- Shared protocol ports for activated databases (e.g. `:5432`, `:6379`, `:3306`)
|
|
17
31
|
|
|
18
32
|
## Unified repo config
|
|
19
33
|
|
|
@@ -51,6 +65,12 @@ devrouter repo devcontainer verify --live --yes --json
|
|
|
51
65
|
|
|
52
66
|
Why prefer it: the environment is reproducible and runs anywhere the devcontainer
|
|
53
67
|
spec runs, while devrouter gives it stable local HTTPS and database hostnames.
|
|
68
|
+
|
|
69
|
+
We recommend **DevPod** to orchestrate the devcontainer lifecycle locally because:
|
|
70
|
+
- **IDE/Editor Independence**: DevPod manages the container lifecycle and code synchronization in the background, allowing developers to use any local editor (VS Code, JetBrains, vim) with the containerized toolchain.
|
|
71
|
+
- **No Vendor Lock-in**: It is a client-only, open-source runner that runs entirely locally on Docker without requiring Microsoft's proprietary VS Code extensions or cloud-based runners.
|
|
72
|
+
- **devrouter Integration**: DevPod spins up the devcontainer compose stack on the `devnet` network, and devrouter handles dynamic HTTPS domain routing (`*.localhost`), making manual port-forwarding management obsolete.
|
|
73
|
+
|
|
54
74
|
Agents can add the scaffold with `devrouter repo inspect`, `devrouter repo devcontainer write`,
|
|
55
75
|
and `devrouter repo devcontainer verify`, then include the JSON evidence in a PR. See
|
|
56
76
|
[`docs/DEVCONTAINER.md`](./docs/DEVCONTAINER.md) for the full reference.
|
|
@@ -63,7 +83,7 @@ vars. Use it when you are not (yet) on a devcontainer. Fully supported.
|
|
|
63
83
|
|
|
64
84
|
## Core commands
|
|
65
85
|
|
|
66
|
-
- `devrouter init [--repo <path>] [--entries-json <json>] [--json] [--write-agents] [--write-skill]
|
|
86
|
+
- `devrouter init [--repo <path>] [--entries-json <json>] [--json] [--write-agents] [--write-skill]`
|
|
67
87
|
- `devrouter -V [--repo <path>]` (installed CLI version, local repo version, next upgrade target)
|
|
68
88
|
- `devrouter upgrade [version] [--repo <path>]`
|
|
69
89
|
- `devrouter setup --yes [--repo <path>] [--json]`
|
|
@@ -78,7 +98,7 @@ vars. Use it when you are not (yet) on a devcontainer. Fully supported.
|
|
|
78
98
|
- `devrouter repo inspect [--repo <path>] [--json]`
|
|
79
99
|
- `devrouter repo devcontainer write [--repo <path>] [--dry-run] [--yes] [--json]`
|
|
80
100
|
- `devrouter repo devcontainer verify [--repo <path>] [--live] [--yes] [--json]`
|
|
81
|
-
- `devrouter repo agents [--repo <path>]
|
|
101
|
+
- `devrouter repo agents [--repo <path>]`
|
|
82
102
|
- `devrouter app add ...` (`--kind app|dependency`, default `app`)
|
|
83
103
|
- `devrouter app ls [--repo <path>] [--json]`
|
|
84
104
|
- `devrouter app run <name> [--repo <path>] [--yes] [--workspace <slug>]`
|
|
@@ -86,6 +106,7 @@ vars. Use it when you are not (yet) on a devcontainer. Fully supported.
|
|
|
86
106
|
- `devrouter app rm <name> [--repo <path>]`
|
|
87
107
|
- `devrouter logs [-f]`
|
|
88
108
|
- `devrouter workspace up <branch> [--path <dir>] [--no-devpod] [--open] [--repo <path>]`
|
|
109
|
+
- `devrouter workspace ensure [path] [--open]`
|
|
89
110
|
- `devrouter workspace ls [--repo <path>] [--json]`
|
|
90
111
|
- `devrouter workspace down <workspace|branch> [--keep-worktree] [--keep-devpod] [--repo <path>]`
|
|
91
112
|
|
|
@@ -100,12 +121,12 @@ mutate local route state.
|
|
|
100
121
|
|
|
101
122
|
A **workspace token** lets several git worktrees of the same repo run side-by-side without host or route collisions. The token is a single identity spanning three layers: the devpod workspace id, the routes devrouter registers, and the `${WORKSPACE}` placeholder in `.devrouter.yml` proxy upstreams and devcontainer compose network aliases.
|
|
102
123
|
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
124
|
+
Each linked worktree stores one stable identity in its Git metadata. Once stored,
|
|
125
|
+
that value is authoritative: an explicit flag or `DEVROUTER_WORKSPACE` may repeat
|
|
126
|
+
it but cannot silently rename the environment. On first use, devrouter reuses the
|
|
127
|
+
exact DevPod already bound to the worktree path or derives a sanitized identity
|
|
128
|
+
from the linked branch/path. Ambiguous identities and DevPods owned by another
|
|
129
|
+
worktree fail closed. The primary checkout keeps its plain, non-namespaced routes.
|
|
109
130
|
|
|
110
131
|
**When a workspace token is active:**
|
|
111
132
|
|
|
@@ -122,6 +143,9 @@ A **workspace token** lets several git worktrees of the same repo run side-by-si
|
|
|
122
143
|
# Bring up a feature branch as an isolated workspace
|
|
123
144
|
devrouter workspace up feat/my-feature
|
|
124
145
|
|
|
146
|
+
# Reconcile an existing linked worktree (canonical agent startup command)
|
|
147
|
+
devrouter workspace ensure .
|
|
148
|
+
|
|
125
149
|
# List git worktrees with workspace tokens and route counts
|
|
126
150
|
devrouter workspace ls
|
|
127
151
|
|
|
@@ -129,7 +153,16 @@ devrouter workspace ls
|
|
|
129
153
|
devrouter workspace down feat/my-feature
|
|
130
154
|
```
|
|
131
155
|
|
|
132
|
-
|
|
156
|
+
New worktrees default to the repository's ignored `trees/<workspace>` directory; use `--path` only when a repository intentionally follows another layout.
|
|
157
|
+
|
|
158
|
+
**devcontainer integration:** the devcontainer compose service exposes a devnet network alias `${WORKSPACE}-app` (defaulting to the project name in `devcontainer.env`); the proxy app uses `upstream: ${WORKSPACE}-app:<port>`. `.devcontainer/docker-compose.devrouter.yml` passes `WORKSPACE` and `DEVROUTER_WORKSPACE` into the app and bind-mounts `${DEVROUTER_GIT_COMMON_DIR}` to the same absolute container path, so linked-worktree `.git` pointers remain valid. Workspace `feat-a` → alias `feat-a-app`, host `app.feat-a.localhost`.
|
|
159
|
+
|
|
160
|
+
`workspace ensure` is intentionally proof-driven: it verifies exact worktree
|
|
161
|
+
ownership, the compose overlay and Git mount, workspace env, devnet aliases,
|
|
162
|
+
container health, Git access, HTTP route reachability, and unique running TCP
|
|
163
|
+
upstream ownership (plus health when configured) before reporting ready. It
|
|
164
|
+
retries one stale DevPod with `--recreate`; failed proof does not leave new routes
|
|
165
|
+
behind.
|
|
133
166
|
|
|
134
167
|
**Try it:** [`examples/workspace/`](examples/workspace/) is a runnable showcase — `./run.sh` brings up one app in two parallel worktrees (`wsdemo.localhost` and `wsdemo.feat-a.localhost`) served at once, then `./run.sh down` tears it down.
|
|
135
168
|
|
|
@@ -187,14 +220,6 @@ Optional repo artifact writes are explicit:
|
|
|
187
220
|
devrouter init --repo /absolute/path/to/repo --write-agents --write-skill
|
|
188
221
|
```
|
|
189
222
|
|
|
190
|
-
Optional: also bootstrap Linear workflow skill/templates and AGENTS section:
|
|
191
|
-
|
|
192
|
-
```bash
|
|
193
|
-
devrouter init --repo /absolute/path/to/repo --with-linear --write-agents --write-skill
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
When `--with-linear` is combined with AGENTS writes, devrouter captures minimal Linear mapping (workspace, team, project). In non-interactive mode it writes placeholders and prints a warning so values can be filled in later.
|
|
197
|
-
|
|
198
223
|
## Health diagnostics
|
|
199
224
|
|
|
200
225
|
Run check-only diagnostics for global router state, machine prerequisites, route state, and repo configuration:
|
|
@@ -378,38 +403,17 @@ See details:
|
|
|
378
403
|
|
|
379
404
|
`devrouter repo agents` writes a devrouter section into the repo's `AGENTS.md` and installs a skill file at `.agents/skills/devrouter/SKILL.md`. The skill content is embedded in the CLI bundle so it stays in sync across repos.
|
|
380
405
|
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
```bash
|
|
384
|
-
devrouter repo agents --with-linear
|
|
385
|
-
```
|
|
406
|
+
## Development quality
|
|
386
407
|
|
|
387
|
-
|
|
408
|
+
`pnpm check` runs Biome formatting, lint, and import-order checks. `pnpm check:fix` applies safe fixes automatically. `pnpm knip` detects unused files, dependencies, and unresolved imports. `pnpm typecheck` runs TypeScript checks across the repo.
|
|
388
409
|
|
|
389
|
-
-
|
|
390
|
-
- `.agents/skills/linear-workflow/references/LINEAR_ISSUE_TEMPLATE.md`
|
|
391
|
-
- `.agents/skills/linear-workflow/references/MILESTONE_PLAN_TEMPLATE.md`
|
|
392
|
-
- `.agents/skills/linear-workflow/references/PROGRESS_UPDATE_TEMPLATE.md`
|
|
410
|
+
Pre-commit hooks run on every commit once installed:
|
|
393
411
|
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
- `<!-- devrouter-linear-workflow-config:start -->`
|
|
399
|
-
- `<!-- devrouter-linear-workflow-config:end -->`
|
|
400
|
-
|
|
401
|
-
The block captures:
|
|
402
|
-
|
|
403
|
-
- `workspace.name`
|
|
404
|
-
- `team.name` (optional `team.key`)
|
|
405
|
-
- `project.name` (optional `project.id`)
|
|
406
|
-
|
|
407
|
-
Required Linear execution hygiene:
|
|
412
|
+
```sh
|
|
413
|
+
pre-commit install
|
|
414
|
+
```
|
|
408
415
|
|
|
409
|
-
|
|
410
|
-
2. Post progress comments at meaningful checkpoints during implementation.
|
|
411
|
-
3. Before ending a session, post a final comment with completed work, remaining work, risks, and next step.
|
|
412
|
-
4. Re-check status and comment freshness toward/at session end before stopping.
|
|
416
|
+
Hooks run Biome safe fixes, Knip, Gitleaks secret scanning, and basic file checks (trailing whitespace, merge conflict markers, large file guard).
|
|
413
417
|
|
|
414
418
|
## Known limitations (v1)
|
|
415
419
|
|