@paleo/worktree-env 0.4.0 → 0.4.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.
@@ -8,7 +8,7 @@ import { defaultComputePorts, resolvePortScheme } from "./ports.js";
8
8
  import { handleSetOwner, readSlots, resolveAndRegisterSlot, validateSlotAvailability, writeSlots, } from "./slots.js";
9
9
  import { createBranch, detectWorktree, enforceWorktreeMode, getCurrentBranch, removeWorktree, useExistingBranch, verifyBranchAbsentFromRemote, } from "./worktree.js";
10
10
  import { cleanupPidFile, isProcessAlive, isProcessGroupAlive, killProcessGroup, readPid, } from "./process-control.js";
11
- function makeLog(verbose) {
11
+ function makeVerboseLog(verbose) {
12
12
  return (msg) => {
13
13
  if (verbose)
14
14
  console.log(msg);
@@ -64,7 +64,7 @@ export async function runSetupWorktree(config) {
64
64
  await runSetup(args, ctx, run, config);
65
65
  }
66
66
  async function runSetup(args, ctx, run, config) {
67
- const log = makeLog(run.verbose);
67
+ const verboseLog = makeVerboseLog(run.verbose);
68
68
  const scheme = resolvePortScheme(config);
69
69
  const portsFn = resolvePortsFn(config);
70
70
  validateSlotAvailability(args.slot, {
@@ -83,12 +83,13 @@ async function runSetup(args, ctx, run, config) {
83
83
  requestedOwner: args.owner,
84
84
  });
85
85
  const ports = portsFn(slot);
86
- log(`Using slot ${slot} (${Object.entries(ports)
86
+ verboseLog(`Using slot ${slot} (${Object.entries(ports)
87
87
  .map(([k, v]) => `${k}: ${v}`)
88
88
  .join(", ")})`);
89
+ console.log(`WORKTREE_CREATED path=${setupCtx.currentWorktree} branch=${branch} slot=${slot}`);
89
90
  const sharedDirs = config.sharedDirs ?? [".local", ".plans"];
90
- linkSharedDirectories(setupCtx, sharedDirs, log);
91
- generateConfigFiles(setupCtx, config.configFiles, slot, ports, args.force ?? false, log);
91
+ linkSharedDirectories(setupCtx, sharedDirs, verboseLog);
92
+ generateConfigFiles(setupCtx, config.configFiles, slot, ports, args.force ?? false, verboseLog);
92
93
  const force = args.force ?? false;
93
94
  const setupContext = {
94
95
  currentWorktree: setupCtx.currentWorktree,
@@ -207,7 +208,7 @@ async function stopDevServerByPidFiles(worktreePath, pidFiles, log) {
207
208
  }
208
209
  }
209
210
  async function handleRemove(args, ctx, run, config) {
210
- const log = makeLog(run.verbose);
211
+ const verboseLog = makeVerboseLog(run.verbose);
211
212
  const removeHere = Boolean(args["remove-here"]);
212
213
  const registry = readSlots(ctx.mainWorktree);
213
214
  const target = resolveRemoveTarget(args, ctx, registry, removeHere);
@@ -222,7 +223,7 @@ async function handleRemove(args, ctx, run, config) {
222
223
  console.log(`Removed registry entry for branch "${target.branch}" (slot ${target.slotPort}${ownerSuffix}).`);
223
224
  return;
224
225
  }
225
- await stopDevServerByPidFiles(target.worktreePath, config.devServerPidFiles, log);
226
+ await stopDevServerByPidFiles(target.worktreePath, config.devServerPidFiles, verboseLog);
226
227
  if (config.teardownInfrastructure) {
227
228
  await config.teardownInfrastructure({
228
229
  worktree: target.worktreePath,
package/dist/worktree.js CHANGED
@@ -54,7 +54,6 @@ export function createBranch(requestedBranch, ctx, run) {
54
54
  execFileSync("git", ["worktree", "add", "-b", finalBranch, worktreePath], {
55
55
  stdio: stdioFor(run),
56
56
  });
57
- console.log(`Branch: ${finalBranch}`);
58
57
  return { ...ctx, currentWorktree: worktreePath, isMainWorktree: false };
59
58
  }
60
59
  export function verifyBranchAbsentFromRemote(branch, run) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@paleo/worktree-env",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "description": "Worktree-based concurrent local environment kernel.",
5
5
  "keywords": [
6
6
  "worktree",