worktree-launcher 1.5.1 → 1.5.3

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 +57 -21
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -798,12 +798,14 @@ function showNewWorktreeForm() {
798
798
  input.readInput();
799
799
  }
800
800
  function showAIToolSelector(branchName) {
801
+ const options = ["Claude Code", "Codex", "Skip"];
802
+ let selectedIdx = 0;
801
803
  const form = blessed.box({
802
804
  parent: screen,
803
805
  top: "center",
804
806
  left: "center",
805
807
  width: 40,
806
- height: 9,
808
+ height: 10,
807
809
  border: { type: "line" },
808
810
  style: { fg: "default", border: { fg: "cyan" } },
809
811
  label: " Launch AI Tool "
@@ -815,26 +817,44 @@ function showAIToolSelector(branchName) {
815
817
  content: "Which AI assistant to launch?",
816
818
  style: { fg: "default" }
817
819
  });
818
- const list = blessed.list({
820
+ const optionBoxes = [];
821
+ options.forEach((opt, i) => {
822
+ const box = blessed.box({
823
+ parent: form,
824
+ top: 3 + i,
825
+ left: 2,
826
+ width: 34,
827
+ height: 1,
828
+ content: ` ${opt}`,
829
+ style: { fg: "default" }
830
+ });
831
+ optionBoxes.push(box);
832
+ });
833
+ blessed.text({
819
834
  parent: form,
820
- top: 3,
835
+ top: 7,
821
836
  left: 2,
822
- width: 34,
823
- height: 3,
824
- keys: true,
825
- vi: true,
826
- style: {
827
- selected: { bg: "cyan", fg: "black" },
828
- item: { fg: "default" }
829
- },
830
- items: [" Claude Code", " Codex", " Skip"]
837
+ content: "[\u2191/\u2193] select [Enter] confirm [Esc] cancel",
838
+ style: { fg: "cyan" }
831
839
  });
832
- list.focus();
833
- screen.render();
834
- list.on("select", async (_item, index) => {
835
- const tool = index === 0 ? "claude" : index === 1 ? "codex" : null;
840
+ function updateSelection() {
841
+ optionBoxes.forEach((box, i) => {
842
+ if (i === selectedIdx) {
843
+ box.style.bg = "cyan";
844
+ box.style.fg = "black";
845
+ } else {
846
+ box.style.bg = "default";
847
+ box.style.fg = "default";
848
+ }
849
+ });
850
+ screen.render();
851
+ }
852
+ updateSelection();
853
+ form.focus();
854
+ const confirmSelection = async () => {
855
+ const tool = selectedIdx === 0 ? "claude" : selectedIdx === 1 ? "codex" : null;
836
856
  form.destroy();
837
- setStatus(`Selected: ${tool ?? "skip"}, creating worktree...`);
857
+ setStatus(`Creating worktree...`);
838
858
  screen.render();
839
859
  try {
840
860
  await createNewWorktree(branchName, tool);
@@ -843,11 +863,19 @@ function showAIToolSelector(branchName) {
843
863
  worktreeList.focus();
844
864
  screen.render();
845
865
  }
866
+ };
867
+ form.key(["up", "k"], () => {
868
+ selectedIdx = (selectedIdx - 1 + options.length) % options.length;
869
+ updateSelection();
846
870
  });
847
- list.key(["enter"], () => {
848
- list.emit("select", list.items[list.selected], list.selected);
871
+ form.key(["down", "j"], () => {
872
+ selectedIdx = (selectedIdx + 1) % options.length;
873
+ updateSelection();
849
874
  });
850
- list.key(["escape"], () => {
875
+ form.key(["enter"], () => {
876
+ confirmSelection();
877
+ });
878
+ form.key(["escape"], () => {
851
879
  form.destroy();
852
880
  screen.render();
853
881
  worktreeList.focus();
@@ -855,13 +883,21 @@ function showAIToolSelector(branchName) {
855
883
  }
856
884
  async function createNewWorktree(branchName, tool) {
857
885
  setStatus(`Creating ${branchName}...`);
886
+ screen.render();
858
887
  try {
859
888
  const worktreePath = getWorktreePath(mainRepoPath, branchName);
889
+ setStatus(`Path: ${worktreePath}`);
890
+ screen.render();
860
891
  await createWorktree(worktreePath, branchName);
892
+ setStatus(`Worktree created, copying .env...`);
893
+ screen.render();
861
894
  await copyEnvFiles(mainRepoPath, worktreePath);
895
+ setStatus(`Done! Refreshing list...`);
896
+ screen.render();
862
897
  await refreshWorktrees();
863
898
  setStatus(`Created ${branchName}`);
864
899
  worktreeList.focus();
900
+ screen.render();
865
901
  if (tool) {
866
902
  await launchInWorktree(worktreePath, tool);
867
903
  }
@@ -956,7 +992,7 @@ async function deleteSelected() {
956
992
 
957
993
  // src/index.ts
958
994
  var program = new Command();
959
- program.name("wt").description("CLI tool to streamline git worktrees with AI coding assistants").version("1.5.1").action(async () => {
995
+ program.name("wt").description("CLI tool to streamline git worktrees with AI coding assistants").version("1.5.3").action(async () => {
960
996
  await interactiveCommand();
961
997
  });
962
998
  program.command("new <branch-name>").description("Create a new worktree and launch AI assistant").option("-i, --install", "Run package manager install after creating worktree").option("-s, --skip-launch", "Create worktree without launching AI assistant").option("-p, --push", "Push branch to remote (visible on GitHub)").action(async (branchName, options) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "worktree-launcher",
3
- "version": "1.5.1",
3
+ "version": "1.5.3",
4
4
  "description": "CLI tool for managing git worktrees with AI coding assistants",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",