restoreSessionBranch

tcmts.cli.mcp.restoreSessionBranch · #3hkvn5yt · term · runs on the server

uses tcmts.cli.mcp.withCodebase, which uses process

A session's branch made again from the codebase's own if it's gone while its server runs (deleted by a tcm from before branches were claimed in a transaction): the session goes on, with its scratch files. Whether it was gone.

import { withCodebase } from "#codebase/tcmts/cli/mcp";

export function restoreSessionBranch(root: string, branch: string): boolean {
  return withCodebase(root, (cb) =>
    cb.store.transaction(() => {
      if (cb.store.hasBranch(branch)) return false;
      cb.store.createBranch(branch);
      return true;
    }),
  );
}

uses

used by