@devrouter/cli 0.5.5 → 0.5.6

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 CHANGED
@@ -82,6 +82,14 @@ Dev Container clients still see the full source configuration. Check
82
82
  `devrouter status` or `devrouter doctor` when you need the desired, active, and
83
83
  drift state.
84
84
 
85
+ Managed repositories can also declare a separate runtime variant in
86
+ `managedRuntime.variants` and select it with
87
+ `devrouter ensure . --variant <name>`. A profile continues to select resources;
88
+ the variant changes the managed process startup input. Declared
89
+ loopback-only service ports are available through `devrouter env . --json`. See
90
+ the [managed devcontainer contract](./docs/DEVCONTAINER.md) for ownership,
91
+ Compose, recovery, and capacity rules.
92
+
85
93
  Automation can inspect the same profile contract without touching a workspace,
86
94
  Docker, DevPod, Devsy, Traefik, Git, or global state:
87
95
 
@@ -9,8 +9,9 @@ Usage:
9
9
  devrouter-process status --name <name>
10
10
 
11
11
  Options:
12
- --fingerprint <value> Runtime identity. Defaults to command, workspace, adapter, and safe allowlisted environment identity.
13
- An explicit fingerprint is caller-owned, including preparation identity.
12
+ --fingerprint <value> Runtime identity. Defaults to command, workspace, adapter, non-default
13
+ managed variant, and safe allowlisted environment identity.
14
+ An explicit fingerprint remains caller-owned for preparation identity.
14
15
  --prepare-command <shell command>
15
16
  Ensure only: run a nonempty command with bash before a changed/new runtime.
16
17
  Included byte-for-byte in the default fingerprint; skipped on runtime reuse.
@@ -22,6 +23,7 @@ Options:
22
23
  Environment:
23
24
  DEVROUTER_PROCESS_ADAPTER_SHA256 Exact managed-adapter SHA-256 supplied by devrouter.
24
25
  DEVROUTER_PROCESS_FINGERPRINT_ENV Comma-separated non-secret environment names to fingerprint.
26
+ DEVROUTER_RUNTIME_VARIANT Managed runtime variant; defaults to 'default'. Non-default values are part of identity.
25
27
  EOF
26
28
  }
27
29
 
@@ -141,6 +143,18 @@ if [[ -v DEVROUTER_PROCESS_ADAPTER_SHA256 ]] &&
141
143
  die "DEVROUTER_PROCESS_ADAPTER_SHA256 must be a SHA-256 digest."
142
144
  fi
143
145
 
146
+ runtime_variant="${DEVROUTER_RUNTIME_VARIANT-default}"
147
+ if [ "${#runtime_variant}" -gt 64 ] ||
148
+ ! [[ "$runtime_variant" =~ ^[a-z0-9]+(-[a-z0-9]+)*$ ]]; then
149
+ die "DEVROUTER_RUNTIME_VARIANT must use lowercase alphanumeric segments separated by hyphens and be at most 64 characters."
150
+ fi
151
+ managed_variant_identity=0
152
+ [ "$runtime_variant" = "default" ] || managed_variant_identity=1
153
+ host_ports_identity="${DEVROUTER_PROCESS_HOST_PORTS_SHA256:-}"
154
+ if [ -n "$host_ports_identity" ] && ! [[ "$host_ports_identity" =~ ^[a-f0-9]{64}$ ]]; then
155
+ die "DEVROUTER_PROCESS_HOST_PORTS_SHA256 must be a SHA-256 digest."
156
+ fi
157
+
144
158
  if [ "$action" != "ensure" ] && [ "$#" -gt 0 ]; then
145
159
  die "Unexpected arguments for $action."
146
160
  fi
@@ -163,6 +177,12 @@ if [ -z "$fingerprint" ]; then
163
177
  emit_environment_field workspace WORKSPACE
164
178
  emit_environment_field devrouter-workspace DEVROUTER_WORKSPACE
165
179
  emit_environment_field adapter-sha256 DEVROUTER_PROCESS_ADAPTER_SHA256
180
+ if [ "$managed_variant_identity" -eq 1 ]; then
181
+ printf 'runtime-variant\0%s\0' "$runtime_variant"
182
+ fi
183
+ if [ -n "$host_ports_identity" ]; then
184
+ printf 'host-ports\0%s\0' "$host_ports_identity"
185
+ fi
166
186
  for argument in "$@"; do
167
187
  printf 'argv\0%s\0' "$argument"
168
188
  done
@@ -174,6 +194,13 @@ if [ -z "$fingerprint" ]; then
174
194
  emit_environment_field environment-value "$env_name"
175
195
  done
176
196
  } | LC_ALL=C sha256sum | awk '{print $1}')"
197
+ elif [ "$managed_variant_identity" -eq 1 ] || [ -n "$host_ports_identity" ]; then
198
+ fingerprint="$({
199
+ printf 'format\0devrouter-process-managed-variant-v1\0'
200
+ printf 'explicit-fingerprint\0%s\0' "$fingerprint"
201
+ printf 'runtime-variant\0%s\0' "$runtime_variant"
202
+ printf 'host-ports\0%s\0' "$host_ports_identity"
203
+ } | LC_ALL=C sha256sum | awk '{print $1}')"
177
204
  fi
178
205
  [[ "$fingerprint" =~ ^[a-zA-Z0-9][a-zA-Z0-9._:-]*$ ]] || die "--fingerprint must be a safe identifier."
179
206