@devrouter/cli 0.2.0 → 0.3.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 CHANGED
@@ -116,6 +116,13 @@ Use devrouter lifecycle commands for managed environments. Raw DevPod or Devsy
116
116
  Devrouter auto-detects the installed workspace runtime CLI (DevPod or Devsy) and
117
117
  you can pin it with `DEVROUTER_WORKSPACE_RUNTIME=devpod|devsy`.
118
118
 
119
+ ## Cleaning up worktrees
120
+
121
+ Agent sessions and devcontainers leave many worktrees, dependencies and Docker
122
+ stacks behind. `devrouter workspace cleanup --all-worktrees --check-merged`
123
+ reports which are safe to remove; removal applies only a list a person
124
+ approved by its SHA-256. See [Cleaning up worktrees](./docs/WORKTREE_CLEANUP.md).
125
+
119
126
  ## Agent onboarding
120
127
 
121
128
  Generate the canonical, non-mutating onboarding prompt from a target repository:
@@ -5373,7 +5373,7 @@ function retain(session, previous) {
5373
5373
 
5374
5374
  // src/core/reliability-operation-store.ts
5375
5375
  function installedCliVersion() {
5376
- return true ? "0.2.0" : "0.0.0-dev";
5376
+ return true ? "0.3.1" : "0.0.0-dev";
5377
5377
  }
5378
5378
  function compareCliVersions(left, right) {
5379
5379
  const parts = (value) => value.split(".").map((part) => Number.parseInt(part, 10) || 0);
@@ -7371,7 +7371,7 @@ function loadRepoConfig(repoPath, read2 = (file) => import_node_fs19.default.rea
7371
7371
  const config = parseConfig(parsed ?? {}, configPath);
7372
7372
  const requiredVersion = config.devrouter?.version;
7373
7373
  if (requiredVersion && !hasWarnedVersionMismatch) {
7374
- const cliVersion = true ? "0.2.0" : "0.0.0-dev";
7374
+ const cliVersion = true ? "0.3.1" : "0.0.0-dev";
7375
7375
  if (cliVersion !== "0.0.0-dev" && compareSemver2(requiredVersion, cliVersion) > 0) {
7376
7376
  hasWarnedVersionMismatch = true;
7377
7377
  process.stderr.write(
@@ -10237,6 +10237,25 @@ function inspectExactOwnership(devsyId, worktreePath) {
10237
10237
  if (ownership.status === "conflict") throw new Error(ownership.reason);
10238
10238
  return ownership;
10239
10239
  }
10240
+ function checkoutVanished(worktreePath) {
10241
+ try {
10242
+ import_node_fs26.default.lstatSync(worktreePath);
10243
+ return false;
10244
+ } catch (error) {
10245
+ return error.code === "ENOENT";
10246
+ }
10247
+ }
10248
+ function deleteVanishedCheckoutRegistration(devsyId, worktreePath, originalError) {
10249
+ if (!checkoutVanished(worktreePath)) throw originalError;
10250
+ const runtime = inspectDevsyRuntimeStatus(devsyId);
10251
+ if (runtime !== "stopped" && runtime !== "not-found") throw originalError;
10252
+ runDevsyAction("delete", devsyId, true, worktreePath);
10253
+ if (inspectExactOwnership(devsyId, worktreePath).status !== "absent") {
10254
+ throw new Error(
10255
+ `Devsy workspace '${devsyId}' still owns vanished checkout '${worktreePath}' after forced provider delete.`
10256
+ );
10257
+ }
10258
+ }
10240
10259
  function mutateOwnedDevsyWorkspace(action, devsyId, worktreePath) {
10241
10260
  return withMutationLock(`Devsy ${action}`, worktreePath, () => {
10242
10261
  restoreRecordedManagedDevcontainerConfig(worktreePath);
@@ -10250,7 +10269,13 @@ function mutateOwnedDevsyWorkspace(action, devsyId, worktreePath) {
10250
10269
  }
10251
10270
  const before = inspectExactOwnership(devsyId, worktreePath);
10252
10271
  if (before.status === "absent") return { status: "absent" };
10253
- runDevsyAction(action, devsyId, false, worktreePath);
10272
+ try {
10273
+ runDevsyAction(action, devsyId, false, worktreePath);
10274
+ } catch (error) {
10275
+ if (action !== "delete") throw error;
10276
+ deleteVanishedCheckoutRegistration(devsyId, worktreePath, error);
10277
+ return { status: "changed" };
10278
+ }
10254
10279
  let after = inspectExactOwnership(devsyId, worktreePath);
10255
10280
  if (action === "stop" && after.status !== "owned") {
10256
10281
  throw new Error(