@devrouter/cli 0.0.26 → 0.0.28

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/dist/devrouter.js CHANGED
@@ -46,10 +46,23 @@ function buildDevrouterSection() {
46
46
  "- `devrouter up`",
47
47
  "- `devrouter tls install` (required when repo defines tcp/postgres apps)",
48
48
  "- `devrouter app ls --repo .`",
49
- "- `devrouter app run <host-app> --repo . --yes`",
50
- "- `devrouter ls`"
49
+ "- Linked devcontainer worktree: `devrouter workspace ensure .`",
50
+ "- Host/docker runtime app only: `devrouter app run <host-app> --repo . --yes`",
51
+ "- `devrouter ls`",
52
+ DEVROUTER_END_SENTINEL
51
53
  ].join("\n");
52
54
  }
55
+ function replaceDevrouterSection(content) {
56
+ const start = content.indexOf(DEVROUTER_SENTINEL);
57
+ if (start < 0) return void 0;
58
+ const endSentinel = content.indexOf(DEVROUTER_END_SENTINEL, start);
59
+ const legacyEnd = content.indexOf(LEGACY_DEVROUTER_SECTION_END, start);
60
+ let end = -1;
61
+ if (endSentinel >= 0) end = endSentinel + DEVROUTER_END_SENTINEL.length;
62
+ else if (legacyEnd >= 0) end = legacyEnd + LEGACY_DEVROUTER_SECTION_END.length;
63
+ if (end < 0) return void 0;
64
+ return `${content.slice(0, start)}${buildDevrouterSection()}${content.slice(end)}`;
65
+ }
53
66
  function writeRepoFile(repoPath, relPath, content) {
54
67
  const absolutePath = (0, import_node_path.join)(repoPath, relPath);
55
68
  (0, import_node_fs.mkdirSync)((0, import_node_path.dirname)(absolutePath), { recursive: true });
@@ -61,7 +74,10 @@ function ensureAgentsMdSection(repoPath) {
61
74
  if ((0, import_node_fs.existsSync)(filePath)) {
62
75
  const content = (0, import_node_fs.readFileSync)(filePath, "utf-8");
63
76
  if (content.includes(DEVROUTER_SENTINEL)) {
64
- return { path: filePath, written: false };
77
+ const updated = replaceDevrouterSection(content);
78
+ if (updated === void 0 || updated === content) return { path: filePath, written: false };
79
+ (0, import_node_fs.writeFileSync)(filePath, updated, "utf-8");
80
+ return { path: filePath, written: true };
65
81
  }
66
82
  (0, import_node_fs.writeFileSync)(filePath, `${content.trimEnd()}
67
83
 
@@ -79,13 +95,15 @@ function ensureSkillFile(repoPath) {
79
95
  const filePath = writeRepoFile(repoPath, DEVROUTER_SKILL_REL_PATH, DEVROUTER_SKILL_CONTENT);
80
96
  return { path: filePath, written: true };
81
97
  }
82
- var import_node_fs, import_node_path, DEVROUTER_SENTINEL, AGENTS_MD, DEVROUTER_SKILL_REL_PATH, DEVROUTER_SKILL_CONTENT;
98
+ var import_node_fs, import_node_path, DEVROUTER_SENTINEL, DEVROUTER_END_SENTINEL, LEGACY_DEVROUTER_SECTION_END, AGENTS_MD, DEVROUTER_SKILL_REL_PATH, DEVROUTER_SKILL_CONTENT;
83
99
  var init_agents_md = __esm({
84
100
  "src/core/agents-md.ts"() {
85
101
  "use strict";
86
102
  import_node_fs = require("fs");
87
103
  import_node_path = require("path");
88
104
  DEVROUTER_SENTINEL = "<!-- devrouter -->";
105
+ DEVROUTER_END_SENTINEL = "<!-- /devrouter -->";
106
+ LEGACY_DEVROUTER_SECTION_END = "- `devrouter ls`";
89
107
  AGENTS_MD = "AGENTS.md";
90
108
  DEVROUTER_SKILL_REL_PATH = ".agents/skills/devrouter/SKILL.md";
91
109
  DEVROUTER_SKILL_CONTENT = `---
@@ -222,7 +240,7 @@ Run several worktrees of one repo in parallel without host/route collisions. A *
222
240
  - **Identity**: each linked worktree stores one authoritative identity in Git metadata. First use reuses an exact-path DevPod or derives a sanitized branch/path slug. Later flags or \`DEVROUTER_WORKSPACE\` may repeat the identity but cannot rename it. Ambiguous identities fail closed. The primary checkout remains non-namespaced.
223
241
  - **When active**: hosts auto-namespace (\`web.localhost\` \u2192 \`web.<ws>.localhost\`), \`\${WORKSPACE}\` in \`upstream\` is substituted with the token, and the docker \`router\` key is suffixed per workspace. The runtime config is computed in memory only \u2014 the committed \`.devrouter.yml\` is never rewritten.
224
242
  - **TLS**: namespaced hosts (\`web.<ws>.localhost\`) are not covered by the \`*.localhost\` wildcard; devrouter auto-extends the mkcert cert SANs for active hosts when TLS is enabled.
225
- - **devcontainer integration**: \`devcontainer.json\` lists the base compose file, then \`\${localEnv:DEVCONTAINER_COMPOSE_OVERLAY:docker-compose.default.yml}\`. The default overlay contains \`services: {}\`; \`.devcontainer/docker-compose.devrouter.yml\` passes \`WORKSPACE\` and \`DEVROUTER_WORKSPACE\` into the app and bind-mounts \`\${DEVROUTER_GIT_COMMON_DIR}\` to the same absolute app-container path. The app exposes \`\${WORKSPACE}-app\`; the proxy uses \`upstream: \${WORKSPACE}-app:<port>\`.
243
+ - **devcontainer integration**: managed scaffolds list the base compose file, then \`\${localEnv:DEVCONTAINER_COMPOSE_OVERLAY:docker-compose.default.yml}\`; custom repositories may keep another default overlay. Selecting \`.devcontainer/docker-compose.devrouter.yml\` for linked worktrees must pass \`WORKSPACE\` and \`DEVROUTER_WORKSPACE\` across the combined base/overlay config and bind-mount \`\${DEVROUTER_GIT_COMMON_DIR}\` to the same absolute app-container path. The app exposes \`\${WORKSPACE}-app\`; the proxy uses \`upstream: \${WORKSPACE}-app:<port>\`.
226
244
  - **Lifecycle**: \`devrouter workspace up <branch>\` creates and starts a new worktree under the repository's ignored \`trees/<workspace>\` directory; \`devrouter workspace ensure .\` is the canonical startup/reconciliation command in an existing linked worktree; \`workspace ls\` lists identity/route state; \`workspace down\` serializes teardown with ensure. Ensure proves exact DevPod ownership, overlay/Git mounts, env, aliases, health, Git, HTTP route reachability, and unique running TCP upstream ownership before success, with one bounded recreate for stale state.
227
245
 
228
246
  ## Secret manager interop (Infisical/Doppler)
@@ -310,7 +328,7 @@ For devcontainer onboarding:
310
328
  7. In a linked worktree, start and prove the devcontainer with \`devrouter workspace ensure .\` (use \`devpod up .\` for a primary checkout)
311
329
  8. \`devrouter repo devcontainer verify --repo . --live --yes --json\`
312
330
 
313
- For existing host/docker runtime apps:
331
+ For host/docker runtime apps only:
314
332
 
315
333
  1. \`devrouter setup --repo . --yes\`
316
334
  2. \`devrouter doctor --repo .\`
@@ -1769,7 +1787,7 @@ function loadRepoConfig(repoPath) {
1769
1787
  const config = parseConfig(parsed ?? {}, configPath);
1770
1788
  const requiredVersion = config.devrouter?.version;
1771
1789
  if (requiredVersion && !hasWarnedVersionMismatch) {
1772
- const cliVersion = true ? "0.0.26" : "0.0.0-dev";
1790
+ const cliVersion = true ? "0.0.28" : "0.0.0-dev";
1773
1791
  if (cliVersion !== "0.0.0-dev" && compareSemver(requiredVersion, cliVersion) > 0) {
1774
1792
  hasWarnedVersionMismatch = true;
1775
1793
  process.stderr.write(
@@ -2873,8 +2891,11 @@ function resolvePromptDirectory(explicitPath) {
2873
2891
  }
2874
2892
  const entryFile = process.argv[1] ? import_node_path6.default.resolve(process.argv[1]) : __filename;
2875
2893
  const entryDir = import_node_path6.default.dirname(entryFile);
2894
+ const resolvedEntryDir = import_node_fs7.default.existsSync(entryFile) ? import_node_path6.default.dirname(import_node_fs7.default.realpathSync(entryFile)) : entryDir;
2876
2895
  const candidates = [
2896
+ import_node_path6.default.resolve(resolvedEntryDir, "..", UPGRADE_PROMPTS_DIR),
2877
2897
  import_node_path6.default.resolve(entryDir, "..", UPGRADE_PROMPTS_DIR),
2898
+ import_node_path6.default.resolve(__dirname, "..", UPGRADE_PROMPTS_DIR),
2878
2899
  import_node_path6.default.resolve(__dirname, "..", "..", UPGRADE_PROMPTS_DIR),
2879
2900
  import_node_path6.default.resolve(process.cwd(), UPGRADE_PROMPTS_DIR)
2880
2901
  ];
@@ -4369,7 +4390,7 @@ async function buildDoctorReport(options = {}) {
4369
4390
  const config = runtimeConfig.config;
4370
4391
  loadedConfig = config;
4371
4392
  loadedWorkspace = runtimeConfig.workspace;
4372
- const cliVersion = true ? "0.0.26" : "0.0.0-dev";
4393
+ const cliVersion = true ? "0.0.28" : "0.0.0-dev";
4373
4394
  const configVersion = config.devrouter?.version;
4374
4395
  if (configVersion && cliVersion !== "0.0.0-dev" && compareSemver(configVersion, cliVersion) > 0) {
4375
4396
  addCheck(checks, {
@@ -8532,7 +8553,7 @@ var init_version = __esm({
8532
8553
 
8533
8554
  // src/cli.ts
8534
8555
  var import_commander = require("commander");
8535
- var CLI_VERSION = true ? "0.0.26" : "0.0.0-dev";
8556
+ var CLI_VERSION = true ? "0.0.28" : "0.0.0-dev";
8536
8557
  var VERSION_FLAGS = /* @__PURE__ */ new Set(["-V", "--version"]);
8537
8558
  function withErrorHandling(action2) {
8538
8559
  return async (...args) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devrouter/cli",
3
- "version": "0.0.26",
3
+ "version": "0.0.28",
4
4
  "description": "Local dev routing CLI with shared Traefik reverse proxy",
5
5
  "author": "Roland Schlaefli",
6
6
  "homepage": "https://github.com/rschlaefli/devrouter#readme",
@@ -0,0 +1,21 @@
1
+ You are upgrading a repository that uses devrouter to version 0.0.27.
2
+
3
+ Changes in this release:
4
+ - Fixed bundled `upgrade-prompts/` discovery when the installed CLI is launched through npm's `.bin` symlink.
5
+ - No CLI flags, configuration schema, or workspace lifecycle behavior changed from 0.0.26.
6
+
7
+ Task:
8
+ 1) Bump `.devrouter.yml` `devrouter.version` to `0.0.27`.
9
+ 2) Keep the 0.0.26 worktree lifecycle integration unchanged.
10
+ 3) Refresh discoverability artifacts with `devrouter repo agents --repo <repo>`.
11
+
12
+ Validation:
13
+ - `devrouter -V --repo <repo>` shows installed and local version `0.0.27` without a missing `upgrade-prompts` error.
14
+ - `devrouter upgrade --repo <repo>` reads the bundled prompt catalog without an error.
15
+ - Existing `devrouter workspace ensure .` runtime and route proof still pass from a linked worktree.
16
+
17
+ Report:
18
+ - `.devrouter.yml` version before and after
19
+ - version and upgrade command results
20
+ - workspace ensure result
21
+ - unresolved risks or manual follow-ups
@@ -0,0 +1,26 @@
1
+ You are upgrading a repository that uses devrouter to version 0.0.28.
2
+
3
+ Changes in this release:
4
+ - Generated agent guidance now uses `devrouter workspace ensure .` for linked devcontainer worktrees.
5
+ - `devrouter repo agents` refreshes its existing generated `AGENTS.md` section and preserves content outside its owned markers.
6
+ - Host/docker `devrouter app run` guidance is explicitly separate.
7
+ - Custom repositories may retain their existing default compose overlay. The combined base and worktree overlay must still pass both `WORKSPACE` and `DEVROUTER_WORKSPACE`.
8
+ - No CLI flags, configuration schema, or workspace lifecycle behavior changed from 0.0.27.
9
+
10
+ Task:
11
+ 1) Bump `.devrouter.yml` `devrouter.version` to `0.0.28`.
12
+ 2) Refresh discoverability artifacts with `devrouter repo agents --repo <repo>`.
13
+ 3) Preserve a repository-specific default compose overlay if it is intentional.
14
+ 4) Confirm the combined base plus `.devcontainer/docker-compose.devrouter.yml` config passes both workspace identity variables.
15
+
16
+ Validation:
17
+ - `devrouter -V --repo <repo>` shows installed and local version `0.0.28`.
18
+ - The generated `AGENTS.md` section tells linked devcontainer worktrees to run `devrouter workspace ensure .`.
19
+ - The generated Devrouter skill does not require `docker-compose.default.yml` for custom repositories.
20
+ - Existing `devrouter workspace ensure .` runtime and route proof still pass from a linked worktree.
21
+
22
+ Report:
23
+ - `.devrouter.yml` version before and after
24
+ - generated guidance paths
25
+ - workspace ensure result
26
+ - unresolved risks or manual follow-ups