@desplega.ai/wts 0.2.0 → 0.2.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/dist/index.js +26 -15
- 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.2.
|
|
1880
|
+
version: "0.2.1",
|
|
1881
1881
|
description: "Git worktree manager with tmux integration",
|
|
1882
1882
|
type: "module",
|
|
1883
1883
|
bin: {
|
|
@@ -3337,7 +3337,7 @@ function printWorktreeTable(worktrees, projectName) {
|
|
|
3337
3337
|
}
|
|
3338
3338
|
|
|
3339
3339
|
// src/commands/merge.ts
|
|
3340
|
-
var mergeCommand = new Command2("merge").description("Merge a worktree branch into main").argument("[alias]", "Alias of the worktree to merge").option("--no-cleanup", "Skip cleanup prompt").option("-f, --force", "Skip confirmations (except cleanup)").action(async (alias, options) => {
|
|
3340
|
+
var mergeCommand = new Command2("merge").description("Merge a worktree branch into main").argument("[alias]", "Alias of the worktree to merge").option("--no-cleanup", "Skip cleanup prompt").option("--no-pull", "Skip pulling latest main").option("-f, --force", "Skip confirmations (except cleanup)").action(async (alias, options) => {
|
|
3341
3341
|
const gitRoot = await getGitRoot();
|
|
3342
3342
|
if (!gitRoot) {
|
|
3343
3343
|
console.error(source_default.red("Error: Not in a git repository"));
|
|
@@ -3345,6 +3345,12 @@ var mergeCommand = new Command2("merge").description("Merge a worktree branch in
|
|
|
3345
3345
|
}
|
|
3346
3346
|
const config = await resolveConfig(gitRoot);
|
|
3347
3347
|
const worktrees = await listWorktrees(gitRoot, config.projectName);
|
|
3348
|
+
const mainWorktree = worktrees.find((wt) => wt.isMain);
|
|
3349
|
+
if (!mainWorktree) {
|
|
3350
|
+
console.error(source_default.red("Error: Could not find main worktree"));
|
|
3351
|
+
process.exit(1);
|
|
3352
|
+
}
|
|
3353
|
+
const mainPath = mainWorktree.path;
|
|
3348
3354
|
let worktree;
|
|
3349
3355
|
if (alias) {
|
|
3350
3356
|
worktree = await findWorktreeByAlias(alias, gitRoot);
|
|
@@ -3381,16 +3387,21 @@ Merging ${source_default.cyan(branchToMerge)} into ${source_default.cyan(default
|
|
|
3381
3387
|
}
|
|
3382
3388
|
}
|
|
3383
3389
|
console.log(source_default.dim(`Switching to ${defaultBranch}...`));
|
|
3384
|
-
await Bun.$`git checkout ${defaultBranch}`.cwd(
|
|
3385
|
-
if (
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
+
await Bun.$`git checkout ${defaultBranch}`.cwd(mainPath);
|
|
3391
|
+
if (options.pull !== false) {
|
|
3392
|
+
if (!options.force) {
|
|
3393
|
+
const proceed = await confirm(`Pull latest ${defaultBranch}?`, true);
|
|
3394
|
+
if (!proceed) {
|
|
3395
|
+
console.log(source_default.dim("Skipped pull"));
|
|
3396
|
+
} else {
|
|
3397
|
+
console.log(source_default.dim(`Pulling latest...`));
|
|
3398
|
+
await Bun.$`git pull`.cwd(mainPath);
|
|
3399
|
+
}
|
|
3400
|
+
} else {
|
|
3401
|
+
console.log(source_default.dim(`Pulling latest...`));
|
|
3402
|
+
await Bun.$`git pull`.cwd(mainPath);
|
|
3390
3403
|
}
|
|
3391
3404
|
}
|
|
3392
|
-
console.log(source_default.dim(`Pulling latest...`));
|
|
3393
|
-
await Bun.$`git pull`.cwd(gitRoot);
|
|
3394
3405
|
if (!options.force) {
|
|
3395
3406
|
const proceed = await confirm(`Merge ${branchToMerge}?`, true);
|
|
3396
3407
|
if (!proceed) {
|
|
@@ -3399,18 +3410,18 @@ Merging ${source_default.cyan(branchToMerge)} into ${source_default.cyan(default
|
|
|
3399
3410
|
}
|
|
3400
3411
|
}
|
|
3401
3412
|
console.log(source_default.dim(`Merging ${branchToMerge}...`));
|
|
3402
|
-
await Bun.$`git merge ${branchToMerge}`.cwd(
|
|
3413
|
+
await Bun.$`git merge ${branchToMerge}`.cwd(mainPath);
|
|
3403
3414
|
if (!options.force) {
|
|
3404
3415
|
const proceed = await confirm(`Push to origin?`, true);
|
|
3405
3416
|
if (!proceed) {
|
|
3406
3417
|
console.log(source_default.dim("Skipped push"));
|
|
3407
3418
|
} else {
|
|
3408
3419
|
console.log(source_default.dim(`Pushing...`));
|
|
3409
|
-
await Bun.$`git push`.cwd(
|
|
3420
|
+
await Bun.$`git push`.cwd(mainPath);
|
|
3410
3421
|
}
|
|
3411
3422
|
} else {
|
|
3412
3423
|
console.log(source_default.dim(`Pushing...`));
|
|
3413
|
-
await Bun.$`git push`.cwd(
|
|
3424
|
+
await Bun.$`git push`.cwd(mainPath);
|
|
3414
3425
|
}
|
|
3415
3426
|
console.log(source_default.green(`
|
|
3416
3427
|
✓ Merged ${branchToMerge} into ${defaultBranch}`));
|
|
@@ -3419,9 +3430,9 @@ Merging ${source_default.cyan(branchToMerge)} into ${source_default.cyan(default
|
|
|
3419
3430
|
Clean up worktree and branch?`, false);
|
|
3420
3431
|
if (cleanup) {
|
|
3421
3432
|
console.log(source_default.dim(`Removing worktree...`));
|
|
3422
|
-
await removeWorktree(worktree.path, true,
|
|
3433
|
+
await removeWorktree(worktree.path, true, mainPath);
|
|
3423
3434
|
console.log(source_default.dim(`Deleting branch ${branchToMerge}...`));
|
|
3424
|
-
await deleteBranch(branchToMerge, true,
|
|
3435
|
+
await deleteBranch(branchToMerge, true, mainPath);
|
|
3425
3436
|
console.log(source_default.green(`✓ Cleaned up`));
|
|
3426
3437
|
}
|
|
3427
3438
|
}
|