@desplega.ai/wts 0.1.3 → 0.1.4

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.
Files changed (2) hide show
  1. package/dist/index.js +29 -20
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1877,7 +1877,7 @@ var {
1877
1877
  // package.json
1878
1878
  var package_default = {
1879
1879
  name: "@desplega.ai/wts",
1880
- version: "0.1.3",
1880
+ version: "0.1.4",
1881
1881
  description: "Git worktree manager with tmux integration",
1882
1882
  type: "module",
1883
1883
  bin: {
@@ -3046,14 +3046,19 @@ async function runSetupScript(worktreePath, scriptPath, gitRoot) {
3046
3046
  }
3047
3047
  const ext = scriptPath.split(".").pop()?.toLowerCase();
3048
3048
  try {
3049
+ const env2 = {
3050
+ ...process.env,
3051
+ WTS_WORKTREE_PATH: worktreePath,
3052
+ WTS_GIT_ROOT: gitRoot
3053
+ };
3049
3054
  if (ext === "ts") {
3050
- await Bun.$`bun ${fullScriptPath}`.cwd(worktreePath).env({ ...process.env, WTS_WORKTREE_PATH: worktreePath });
3055
+ await Bun.$`bun ${fullScriptPath}`.cwd(worktreePath).env(env2);
3051
3056
  } else if (ext === "sh") {
3052
- await Bun.$`bash ${fullScriptPath}`.cwd(worktreePath).env({ ...process.env, WTS_WORKTREE_PATH: worktreePath });
3057
+ await Bun.$`bash ${fullScriptPath}`.cwd(worktreePath).env(env2);
3053
3058
  } else if (ext === "js" || ext === "mjs") {
3054
- await Bun.$`bun ${fullScriptPath}`.cwd(worktreePath).env({ ...process.env, WTS_WORKTREE_PATH: worktreePath });
3059
+ await Bun.$`bun ${fullScriptPath}`.cwd(worktreePath).env(env2);
3055
3060
  } else {
3056
- await Bun.$`${fullScriptPath}`.cwd(worktreePath).env({ ...process.env, WTS_WORKTREE_PATH: worktreePath });
3061
+ await Bun.$`${fullScriptPath}`.cwd(worktreePath).env(env2);
3057
3062
  }
3058
3063
  console.log(source_default.green("Setup script completed"));
3059
3064
  } catch (error) {
@@ -3413,8 +3418,13 @@ import { access as access2, chmod } from "node:fs/promises";
3413
3418
  import { join as join5 } from "node:path";
3414
3419
  var SHELL_TEMPLATE = `#!/bin/bash
3415
3420
  # wts setup script - runs after worktree creation
3416
- # Working directory: the new worktree
3417
- # Environment: WTS_WORKTREE_PATH contains the worktree path
3421
+ #
3422
+ # Environment variables:
3423
+ # WTS_WORKTREE_PATH - path to the new worktree (also the working directory)
3424
+ # WTS_GIT_ROOT - path to the main repository root
3425
+ #
3426
+ # Example: copy .env from main repo to worktree
3427
+ # cp "$WTS_GIT_ROOT/.env" "$WTS_WORKTREE_PATH/.env"
3418
3428
 
3419
3429
  set -e
3420
3430
 
@@ -3424,20 +3434,21 @@ echo "Setting up worktree..."
3424
3434
  # npm install
3425
3435
  # bun install
3426
3436
 
3427
- # Copy environment files
3428
- # cp .env.example .env
3429
-
3430
- # Run any other setup tasks
3431
- # ...
3437
+ # Copy files from main repo
3438
+ # cp "$WTS_GIT_ROOT/.env" .env
3439
+ # cp -r "$WTS_GIT_ROOT/node_modules" .
3432
3440
 
3433
3441
  echo "Setup complete!"
3434
3442
  `;
3435
3443
  var TS_TEMPLATE = `#!/usr/bin/env bun
3436
3444
  // wts setup script - runs after worktree creation
3437
- // Working directory: the new worktree
3438
- // Environment: WTS_WORKTREE_PATH contains the worktree path
3445
+ //
3446
+ // Environment variables:
3447
+ // WTS_WORKTREE_PATH - path to the new worktree (also the working directory)
3448
+ // WTS_GIT_ROOT - path to the main repository root
3439
3449
 
3440
- const worktreePath = process.env.WTS_WORKTREE_PATH;
3450
+ const worktreePath = process.env.WTS_WORKTREE_PATH!;
3451
+ const gitRoot = process.env.WTS_GIT_ROOT!;
3441
3452
 
3442
3453
  console.log("Setting up worktree...");
3443
3454
 
@@ -3445,11 +3456,9 @@ console.log("Setting up worktree...");
3445
3456
  // await Bun.$\`npm install\`;
3446
3457
  // await Bun.$\`bun install\`;
3447
3458
 
3448
- // Copy environment files
3449
- // await Bun.$\`cp .env.example .env\`;
3450
-
3451
- // Run any other setup tasks
3452
- // ...
3459
+ // Copy files from main repo
3460
+ // await Bun.$\`cp \${gitRoot}/.env .env\`;
3461
+ // await Bun.$\`cp -r \${gitRoot}/node_modules .\`;
3453
3462
 
3454
3463
  console.log("Setup complete!");
3455
3464
  `;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@desplega.ai/wts",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "Git worktree manager with tmux integration",
5
5
  "type": "module",
6
6
  "bin": {