@iloom/cli 0.1.16 → 0.1.18

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 (120) hide show
  1. package/README.md +20 -7
  2. package/dist/ClaudeContextManager-LD3VB6EM.js +13 -0
  3. package/dist/ClaudeService-CFFI7DD5.js +12 -0
  4. package/dist/{GitHubService-F7Z3XJOS.js → GitHubService-SH4H6VS5.js} +3 -3
  5. package/dist/{LoomLauncher-MODG2SEM.js → LoomLauncher-FB2MV2ZI.js} +7 -7
  6. package/dist/{PromptTemplateManager-7FINLRDE.js → PromptTemplateManager-WM5GIPEF.js} +2 -2
  7. package/dist/{SettingsManager-VAZF26S2.js → SettingsManager-SKLUVE3K.js} +6 -2
  8. package/dist/{add-issue-22JBNOML.js → add-issue-L5HX6LEV.js} +23 -8
  9. package/dist/add-issue-L5HX6LEV.js.map +1 -0
  10. package/dist/{chunk-U3WU5OWO.js → chunk-4XIDC3NF.js} +2 -2
  11. package/dist/chunk-4XIDC3NF.js.map +1 -0
  12. package/dist/{chunk-SSR5AVRJ.js → chunk-6OTVPRXH.js} +21 -8
  13. package/dist/chunk-6OTVPRXH.js.map +1 -0
  14. package/dist/{chunk-KQDEK2ZW.js → chunk-DGEKUT7Q.js} +9 -5
  15. package/dist/chunk-DGEKUT7Q.js.map +1 -0
  16. package/dist/chunk-FXV24OYZ.js +83 -0
  17. package/dist/chunk-FXV24OYZ.js.map +1 -0
  18. package/dist/{chunk-HPJJSYNS.js → chunk-H5LDRGVK.js} +6 -8
  19. package/dist/{chunk-HPJJSYNS.js.map → chunk-H5LDRGVK.js.map} +1 -1
  20. package/dist/{chunk-WKEWRSDB.js → chunk-HURVAQRK.js} +3 -3
  21. package/dist/{chunk-T7QPXANZ.js → chunk-IIPTBZQW.js} +17 -17
  22. package/dist/chunk-IIPTBZQW.js.map +1 -0
  23. package/dist/{chunk-QEPVTTHD.js → chunk-IO4WFTL2.js} +17 -11
  24. package/dist/chunk-IO4WFTL2.js.map +1 -0
  25. package/dist/{chunk-JQ7VOSTC.js → chunk-KOCQAD2E.js} +3 -3
  26. package/dist/{chunk-F3XBU2R7.js → chunk-L4QGC27H.js} +68 -2
  27. package/dist/chunk-L4QGC27H.js.map +1 -0
  28. package/dist/{chunk-YYSKGAZT.js → chunk-LAPY6NAE.js} +17 -8
  29. package/dist/chunk-LAPY6NAE.js.map +1 -0
  30. package/dist/{chunk-O2QWO64Z.js → chunk-PV3GAXQO.js} +56 -3
  31. package/dist/chunk-PV3GAXQO.js.map +1 -0
  32. package/dist/{chunk-CP2NU2JC.js → chunk-Q2KYPAH2.js} +7 -7
  33. package/dist/{chunk-CP2NU2JC.js.map → chunk-Q2KYPAH2.js.map} +1 -1
  34. package/dist/{chunk-Y7SAGNUT.js → chunk-SLIMABFA.js} +2 -2
  35. package/dist/{chunk-W3DQTW63.js → chunk-USVVV3FP.js} +4 -4
  36. package/dist/chunk-VVH3ANF2.js +307 -0
  37. package/dist/chunk-VVH3ANF2.js.map +1 -0
  38. package/dist/{chunk-JBH2ZYYZ.js → chunk-VYQLLHZ7.js} +22 -3
  39. package/dist/chunk-VYQLLHZ7.js.map +1 -0
  40. package/dist/{chunk-SJUQ2NDR.js → chunk-ZMNQBJUI.js} +24 -19
  41. package/dist/chunk-ZMNQBJUI.js.map +1 -0
  42. package/dist/{cleanup-3LUWPSM7.js → cleanup-ZHROIBSQ.js} +12 -16
  43. package/dist/cleanup-ZHROIBSQ.js.map +1 -0
  44. package/dist/cli.js +97 -49
  45. package/dist/cli.js.map +1 -1
  46. package/dist/{enhance-XJIQHVPD.js → enhance-VVMAKMVZ.js} +18 -8
  47. package/dist/enhance-VVMAKMVZ.js.map +1 -0
  48. package/dist/{feedback-23CLXKFT.js → feedback-AKHD7QIM.js} +8 -8
  49. package/dist/{finish-CY4CIH6O.js → finish-WGPISUEH.js} +60 -313
  50. package/dist/finish-WGPISUEH.js.map +1 -0
  51. package/dist/{git-LVRZ57GJ.js → git-OUYMVYJX.js} +2 -2
  52. package/dist/{ignite-WXEF2ID5.js → ignite-JEN3K3OT.js} +7 -7
  53. package/dist/index.d.ts +791 -712
  54. package/dist/index.js +126 -32
  55. package/dist/index.js.map +1 -1
  56. package/dist/init-EVUT4ZQJ.js +339 -0
  57. package/dist/init-EVUT4ZQJ.js.map +1 -0
  58. package/dist/mcp/github-comment-server.js +12 -9
  59. package/dist/mcp/github-comment-server.js.map +1 -1
  60. package/dist/neon-helpers-ZVIRPKCI.js +10 -0
  61. package/dist/{open-X6BTENPV.js → open-ETZUFSE4.js} +15 -17
  62. package/dist/{open-X6BTENPV.js.map → open-ETZUFSE4.js.map} +1 -1
  63. package/dist/prompts/init-prompt.txt +746 -0
  64. package/dist/prompts/issue-prompt.txt +48 -5
  65. package/dist/prompts/pr-prompt.txt +46 -1
  66. package/dist/prompts/regular-prompt.txt +22 -0
  67. package/dist/rebase-KBWFDZCN.js +95 -0
  68. package/dist/rebase-KBWFDZCN.js.map +1 -0
  69. package/dist/remote-GJEZWRCC.js +14 -0
  70. package/dist/{run-2JCPQAX3.js → run-4SVQ3WEU.js} +15 -17
  71. package/dist/{run-2JCPQAX3.js.map → run-4SVQ3WEU.js.map} +1 -1
  72. package/dist/schema/settings.schema.json +51 -1
  73. package/dist/{start-LWVRBJ6S.js → start-2NEZU7SE.js} +54 -53
  74. package/dist/{start-LWVRBJ6S.js.map → start-2NEZU7SE.js.map} +1 -1
  75. package/dist/{test-git-XPF4SZXJ.js → test-git-MKZATGZN.js} +3 -3
  76. package/dist/{test-prefix-XGFXFAYN.js → test-prefix-ZNLWDI3K.js} +3 -3
  77. package/dist/{update-3ZT2XX2G.js → update-4TDDUR5K.js} +11 -5
  78. package/dist/{update-3ZT2XX2G.js.map → update-4TDDUR5K.js.map} +1 -1
  79. package/dist/{update-notifier-QSSEB5KC.js → update-notifier-QEX3CJHA.js} +2 -2
  80. package/package.json +1 -1
  81. package/dist/ClaudeContextManager-XOSXQ67R.js +0 -13
  82. package/dist/ClaudeService-YSZ6EXWP.js +0 -12
  83. package/dist/NeonProvider-PAGPUH7F.js +0 -12
  84. package/dist/add-issue-22JBNOML.js.map +0 -1
  85. package/dist/chunk-37DYYFVK.js +0 -29
  86. package/dist/chunk-37DYYFVK.js.map +0 -1
  87. package/dist/chunk-F3XBU2R7.js.map +0 -1
  88. package/dist/chunk-JBH2ZYYZ.js.map +0 -1
  89. package/dist/chunk-KQDEK2ZW.js.map +0 -1
  90. package/dist/chunk-O2QWO64Z.js.map +0 -1
  91. package/dist/chunk-QEPVTTHD.js.map +0 -1
  92. package/dist/chunk-SJUQ2NDR.js.map +0 -1
  93. package/dist/chunk-SSR5AVRJ.js.map +0 -1
  94. package/dist/chunk-T7QPXANZ.js.map +0 -1
  95. package/dist/chunk-U3WU5OWO.js.map +0 -1
  96. package/dist/chunk-YYSKGAZT.js.map +0 -1
  97. package/dist/cleanup-3LUWPSM7.js.map +0 -1
  98. package/dist/enhance-XJIQHVPD.js.map +0 -1
  99. package/dist/env-MDFL4ZXL.js +0 -23
  100. package/dist/finish-CY4CIH6O.js.map +0 -1
  101. package/dist/init-RHACUR4E.js +0 -123
  102. package/dist/init-RHACUR4E.js.map +0 -1
  103. /package/dist/{ClaudeContextManager-XOSXQ67R.js.map → ClaudeContextManager-LD3VB6EM.js.map} +0 -0
  104. /package/dist/{ClaudeService-YSZ6EXWP.js.map → ClaudeService-CFFI7DD5.js.map} +0 -0
  105. /package/dist/{GitHubService-F7Z3XJOS.js.map → GitHubService-SH4H6VS5.js.map} +0 -0
  106. /package/dist/{LoomLauncher-MODG2SEM.js.map → LoomLauncher-FB2MV2ZI.js.map} +0 -0
  107. /package/dist/{NeonProvider-PAGPUH7F.js.map → PromptTemplateManager-WM5GIPEF.js.map} +0 -0
  108. /package/dist/{PromptTemplateManager-7FINLRDE.js.map → SettingsManager-SKLUVE3K.js.map} +0 -0
  109. /package/dist/{chunk-WKEWRSDB.js.map → chunk-HURVAQRK.js.map} +0 -0
  110. /package/dist/{chunk-JQ7VOSTC.js.map → chunk-KOCQAD2E.js.map} +0 -0
  111. /package/dist/{chunk-Y7SAGNUT.js.map → chunk-SLIMABFA.js.map} +0 -0
  112. /package/dist/{chunk-W3DQTW63.js.map → chunk-USVVV3FP.js.map} +0 -0
  113. /package/dist/{feedback-23CLXKFT.js.map → feedback-AKHD7QIM.js.map} +0 -0
  114. /package/dist/{SettingsManager-VAZF26S2.js.map → git-OUYMVYJX.js.map} +0 -0
  115. /package/dist/{ignite-WXEF2ID5.js.map → ignite-JEN3K3OT.js.map} +0 -0
  116. /package/dist/{env-MDFL4ZXL.js.map → neon-helpers-ZVIRPKCI.js.map} +0 -0
  117. /package/dist/{git-LVRZ57GJ.js.map → remote-GJEZWRCC.js.map} +0 -0
  118. /package/dist/{test-git-XPF4SZXJ.js.map → test-git-MKZATGZN.js.map} +0 -0
  119. /package/dist/{test-prefix-XGFXFAYN.js.map → test-prefix-ZNLWDI3K.js.map} +0 -0
  120. /package/dist/{update-notifier-QSSEB5KC.js.map → update-notifier-QEX3CJHA.js.map} +0 -0
@@ -1,7 +1,10 @@
1
1
  #!/usr/bin/env node
2
+ import {
3
+ MergeManager
4
+ } from "./chunk-VVH3ANF2.js";
2
5
  import {
3
6
  ResourceCleanup
4
- } from "./chunk-CP2NU2JC.js";
7
+ } from "./chunk-Q2KYPAH2.js";
5
8
  import {
6
9
  IdentifierParser
7
10
  } from "./chunk-H4E4THUZ.js";
@@ -12,16 +15,18 @@ import {
12
15
  CLIIsolationManager,
13
16
  DatabaseManager,
14
17
  EnvironmentManager
15
- } from "./chunk-HPJJSYNS.js";
16
- import "./chunk-37DYYFVK.js";
18
+ } from "./chunk-H5LDRGVK.js";
19
+ import {
20
+ loadEnvIntoProcess
21
+ } from "./chunk-ZMNQBJUI.js";
17
22
  import {
18
23
  detectPackageManager,
19
24
  installDependencies,
20
25
  runScript
21
26
  } from "./chunk-BLCTGFZN.js";
22
27
  import {
23
- NeonProvider
24
- } from "./chunk-YYSKGAZT.js";
28
+ createNeonProviderFromSettings
29
+ } from "./chunk-LAPY6NAE.js";
25
30
  import {
26
31
  ProjectCapabilityDetector
27
32
  } from "./chunk-CWR2SANQ.js";
@@ -30,26 +35,27 @@ import {
30
35
  readPackageJson
31
36
  } from "./chunk-2ZPFJQ3B.js";
32
37
  import {
33
- GitHubService
34
- } from "./chunk-T7QPXANZ.js";
35
- import "./chunk-KQDEK2ZW.js";
38
+ getConfiguredRepoFromSettings,
39
+ hasMultipleRemotes
40
+ } from "./chunk-FXV24OYZ.js";
36
41
  import {
37
- loadEnvIntoProcess
38
- } from "./chunk-SJUQ2NDR.js";
42
+ GitHubService
43
+ } from "./chunk-IIPTBZQW.js";
44
+ import "./chunk-DGEKUT7Q.js";
39
45
  import {
40
46
  detectClaudeCli,
41
47
  launchClaude
42
48
  } from "./chunk-PXZBAC2M.js";
43
49
  import {
44
50
  GitWorktreeManager
45
- } from "./chunk-QEPVTTHD.js";
51
+ } from "./chunk-IO4WFTL2.js";
46
52
  import {
47
53
  SettingsManager
48
- } from "./chunk-JBH2ZYYZ.js";
54
+ } from "./chunk-VYQLLHZ7.js";
49
55
  import {
50
56
  executeGitCommand,
51
57
  findMainWorktreePathWithSettings
52
- } from "./chunk-JQ7VOSTC.js";
58
+ } from "./chunk-KOCQAD2E.js";
53
59
  import "./chunk-JNKJ7NJV.js";
54
60
  import {
55
61
  logger
@@ -377,11 +383,11 @@ Run '${runCommand}' to see detailed errors.`
377
383
  getClaudePrompt(validationType, validationCommand) {
378
384
  switch (validationType) {
379
385
  case "typecheck":
380
- return `There are TypeScript errors in this codebase. Please analyze the typecheck output, identify all type errors, and fix them. Run '${validationCommand}' to see the errors, then make the necessary code changes to resolve all type issues.When you are done, tell the user to quit to continue the validation process.`;
386
+ return `There are TypeScript errors in this codebase. Please analyze the typecheck output, identify all type errors, and fix them. Run '${validationCommand}' to see the errors, then make the necessary code changes to resolve all type issues. When you are done, tell the user to quit using /exit to continue the validation process.`;
381
387
  case "lint":
382
- return `There are ESLint errors in this codebase. Please analyze the linting output, identify all linting issues, and fix them. Run '${validationCommand}' to see the errors, then make the necessary code changes to resolve all linting issues. Focus on code quality, consistency, and following the project's linting rules.When you are done, tell the user to quit to continue the validation process.`;
388
+ return `There are ESLint errors in this codebase. Please analyze the linting output, identify all linting issues, and fix them. Run '${validationCommand}' to see the errors, then make the necessary code changes to resolve all linting issues. Focus on code quality, consistency, and following the project's linting rules. When you are done, tell the user to quit using /exit to continue the validation process.`;
383
389
  case "test":
384
- return `There are unit test failures in this codebase. Please analyze the test output to understand what's failing, then fix the issues. This might involve updating test code, fixing bugs in the source code, or updating tests to match new behavior. Run '${validationCommand}' to see the detailed test failures, then make the necessary changes to get all tests passing.When you are done, tell the user to quit to continue the validation process.`;
390
+ return `There are unit test failures in this codebase. Please analyze the test output to understand what's failing, then fix the issues. This might involve updating test code, fixing bugs in the source code, or updating tests to match new behavior. Run '${validationCommand}' to see the detailed test failures, then make the necessary changes to get all tests passing. When you are done, tell the user to quit using /exit to continue the validation process.`;
385
391
  }
386
392
  }
387
393
  };
@@ -697,293 +703,6 @@ Start your response immediately with the commit message text.
697
703
  }
698
704
  };
699
705
 
700
- // src/lib/MergeManager.ts
701
- var MergeManager = class {
702
- constructor(settingsManager) {
703
- this.settingsManager = settingsManager ?? new SettingsManager();
704
- }
705
- /**
706
- * Get the main branch name from settings (defaults to 'main')
707
- * @private
708
- */
709
- async getMainBranch() {
710
- const settings = await this.settingsManager.loadSettings();
711
- return settings.mainBranch ?? "main";
712
- }
713
- /**
714
- * Rebase current branch on main with fail-fast on conflicts
715
- * Ports bash/merge-and-clean.sh lines 781-913
716
- *
717
- * @param worktreePath - Path to the worktree
718
- * @param options - Merge options (dryRun, force)
719
- * @throws Error if main branch doesn't exist, uncommitted changes exist, or conflicts occur
720
- */
721
- async rebaseOnMain(worktreePath, options = {}) {
722
- const { dryRun = false, force = false } = options;
723
- const mainBranch = await this.getMainBranch();
724
- logger.info(`Starting rebase on ${mainBranch} branch...`);
725
- try {
726
- await executeGitCommand(["show-ref", "--verify", "--quiet", `refs/heads/${mainBranch}`], {
727
- cwd: worktreePath
728
- });
729
- } catch {
730
- throw new Error(
731
- `Main branch "${mainBranch}" does not exist. Cannot rebase.
732
- Ensure the repository has a "${mainBranch}" branch or create it first.`
733
- );
734
- }
735
- const statusOutput = await executeGitCommand(["status", "--porcelain"], {
736
- cwd: worktreePath
737
- });
738
- if (statusOutput.trim()) {
739
- throw new Error(
740
- "Uncommitted changes detected. Please commit or stash changes before rebasing.\nRun: git status to see uncommitted changes\nOr: il finish will automatically commit them for you"
741
- );
742
- }
743
- const mergeBase = await executeGitCommand(["merge-base", mainBranch, "HEAD"], {
744
- cwd: worktreePath
745
- });
746
- const mainHead = await executeGitCommand(["rev-parse", mainBranch], {
747
- cwd: worktreePath
748
- });
749
- const mergeBaseTrimmed = mergeBase.trim();
750
- const mainHeadTrimmed = mainHead.trim();
751
- if (mergeBaseTrimmed === mainHeadTrimmed) {
752
- logger.success(`Branch is already up to date with ${mainBranch}. No rebase needed.`);
753
- return;
754
- }
755
- const commitsOutput = await executeGitCommand(["log", "--oneline", `${mainBranch}..HEAD`], {
756
- cwd: worktreePath
757
- });
758
- const commits = commitsOutput.trim();
759
- const commitLines = commits ? commits.split("\n") : [];
760
- if (commits) {
761
- logger.info(`Found ${commitLines.length} commit(s) to rebase:`);
762
- commitLines.forEach((commit) => logger.info(` ${commit}`));
763
- } else {
764
- logger.info(`${mainBranch} branch has moved forward. Rebasing to update branch...`);
765
- }
766
- if (!force && !dryRun) {
767
- logger.info("Proceeding with rebase... (use --force to skip confirmations)");
768
- }
769
- if (dryRun) {
770
- logger.info(`[DRY RUN] Would execute: git rebase ${mainBranch}`);
771
- if (commitLines.length > 0) {
772
- logger.info(`[DRY RUN] This would rebase ${commitLines.length} commit(s)`);
773
- }
774
- return;
775
- }
776
- try {
777
- await executeGitCommand(["rebase", mainBranch], { cwd: worktreePath });
778
- logger.success("Rebase completed successfully!");
779
- } catch (error) {
780
- const conflictedFiles = await this.detectConflictedFiles(worktreePath);
781
- if (conflictedFiles.length > 0) {
782
- logger.info("Merge conflicts detected, attempting Claude-assisted resolution...");
783
- const resolved = await this.attemptClaudeConflictResolution(
784
- worktreePath,
785
- conflictedFiles
786
- );
787
- if (resolved) {
788
- logger.success("Conflicts resolved with Claude assistance, rebase completed");
789
- return;
790
- }
791
- const conflictError = this.formatConflictError(conflictedFiles);
792
- throw new Error(conflictError);
793
- }
794
- throw new Error(
795
- `Rebase failed: ${error instanceof Error ? error.message : String(error)}
796
- Run: git status for more details
797
- Or: git rebase --abort to cancel the rebase`
798
- );
799
- }
800
- }
801
- /**
802
- * Validate that fast-forward merge is possible
803
- * Ports bash/merge-and-clean.sh lines 957-968
804
- *
805
- * @param branchName - Name of the branch to merge
806
- * @param mainWorktreePath - Path where main branch is checked out
807
- * @throws Error if fast-forward is not possible
808
- */
809
- async validateFastForwardPossible(branchName, mainWorktreePath) {
810
- const mainBranch = await this.getMainBranch();
811
- const mergeBase = await executeGitCommand(["merge-base", mainBranch, branchName], {
812
- cwd: mainWorktreePath
813
- });
814
- const mainHead = await executeGitCommand(["rev-parse", mainBranch], {
815
- cwd: mainWorktreePath
816
- });
817
- const mergeBaseTrimmed = mergeBase.trim();
818
- const mainHeadTrimmed = mainHead.trim();
819
- if (mergeBaseTrimmed !== mainHeadTrimmed) {
820
- throw new Error(
821
- `Cannot perform fast-forward merge.
822
- The ${mainBranch} branch has moved forward since this branch was created.
823
- Merge base: ${mergeBaseTrimmed}
824
- Main HEAD: ${mainHeadTrimmed}
825
-
826
- To fix this:
827
- 1. Rebase the branch on ${mainBranch}: git rebase ${mainBranch}
828
- 2. Or use: il finish to automatically rebase and merge
829
- `
830
- );
831
- }
832
- }
833
- /**
834
- * Perform fast-forward only merge
835
- * Ports bash/merge-and-clean.sh lines 938-994
836
- *
837
- * @param branchName - Name of the branch to merge
838
- * @param worktreePath - Path to the worktree
839
- * @param options - Merge options (dryRun, force)
840
- * @throws Error if checkout, validation, or merge fails
841
- */
842
- async performFastForwardMerge(branchName, worktreePath, options = {}) {
843
- const { dryRun = false, force = false } = options;
844
- const mainBranch = await this.getMainBranch();
845
- logger.info("Starting fast-forward merge...");
846
- const mainWorktreePath = options.repoRoot ?? await findMainWorktreePathWithSettings(worktreePath, this.settingsManager);
847
- logger.debug(`Using ${mainBranch} branch location: ${mainWorktreePath}`);
848
- const currentBranch = await executeGitCommand(["branch", "--show-current"], {
849
- cwd: mainWorktreePath
850
- });
851
- if (currentBranch.trim() !== mainBranch) {
852
- throw new Error(
853
- `Expected ${mainBranch} branch but found: ${currentBranch.trim()}
854
- At location: ${mainWorktreePath}
855
- This indicates the main worktree detection failed.`
856
- );
857
- }
858
- await this.validateFastForwardPossible(branchName, mainWorktreePath);
859
- const commitsOutput = await executeGitCommand(["log", "--oneline", `${mainBranch}..${branchName}`], {
860
- cwd: mainWorktreePath
861
- });
862
- const commits = commitsOutput.trim();
863
- if (!commits) {
864
- logger.success(`Branch is already merged into ${mainBranch}. No merge needed.`);
865
- return;
866
- }
867
- const commitLines = commits.split("\n");
868
- logger.info(`Found ${commitLines.length} commit(s) to merge:`);
869
- commitLines.forEach((commit) => logger.info(` ${commit}`));
870
- if (!force && !dryRun) {
871
- logger.info("Proceeding with fast-forward merge... (use --force to skip confirmations)");
872
- }
873
- if (dryRun) {
874
- logger.info(`[DRY RUN] Would execute: git merge --ff-only ${branchName}`);
875
- logger.info(`[DRY RUN] This would merge ${commitLines.length} commit(s)`);
876
- return;
877
- }
878
- try {
879
- await executeGitCommand(["merge", "--ff-only", branchName], { cwd: mainWorktreePath });
880
- logger.success(`Fast-forward merge completed! Merged ${commitLines.length} commit(s).`);
881
- } catch (error) {
882
- throw new Error(
883
- `Fast-forward merge failed: ${error instanceof Error ? error.message : String(error)}
884
-
885
- To recover:
886
- 1. Check merge status: git status
887
- 2. Abort merge if needed: git merge --abort
888
- 3. Verify branch is rebased: git rebase main
889
- 4. Try merge again: il finish`
890
- );
891
- }
892
- }
893
- /**
894
- * Helper: Detect conflicted files after failed rebase
895
- * @private
896
- */
897
- async detectConflictedFiles(worktreePath) {
898
- try {
899
- const output = await executeGitCommand(["diff", "--name-only", "--diff-filter=U"], {
900
- cwd: worktreePath
901
- });
902
- return output.trim().split("\n").filter((file) => file.length > 0);
903
- } catch {
904
- return [];
905
- }
906
- }
907
- /**
908
- * Helper: Format conflict error message with manual resolution steps
909
- * @private
910
- */
911
- formatConflictError(conflictedFiles) {
912
- const fileList = conflictedFiles.map((file) => ` \u2022 ${file}`).join("\n");
913
- return "Rebase failed - merge conflicts detected in:\n" + fileList + "\n\nTo resolve manually:\n 1. Fix conflicts in the files above\n 2. Stage resolved files: git add <files>\n 3. Continue rebase: git rebase --continue\n 4. Or abort rebase: git rebase --abort\n 5. Then re-run: il finish <issue-number>";
914
- }
915
- /**
916
- * Attempt to resolve conflicts using Claude
917
- * Ports bash/merge-and-clean.sh lines 839-894
918
- *
919
- * @param worktreePath - Path to the worktree
920
- * @param conflictedFiles - List of files with conflicts
921
- * @returns true if conflicts resolved, false otherwise
922
- * @private
923
- */
924
- async attemptClaudeConflictResolution(worktreePath, conflictedFiles) {
925
- const isClaudeAvailable = await detectClaudeCli();
926
- if (!isClaudeAvailable) {
927
- logger.debug("Claude CLI not available, skipping conflict resolution");
928
- return false;
929
- }
930
- logger.info(`Launching Claude to resolve conflicts in ${conflictedFiles.length} file(s)...`);
931
- const prompt = `Please help resolve the git rebase conflicts in this repository. Analyze the conflicted files, understand the changes from both branches, fix the conflicts, then run 'git add .' to stage the resolved files, and finally run 'git rebase --continue' to continue the rebase process. Handle the entire workflow for me.`;
932
- try {
933
- await launchClaude(prompt, {
934
- addDir: worktreePath,
935
- headless: false
936
- // Interactive - runs in current terminal with stdio: inherit
937
- });
938
- const remainingConflicts = await this.detectConflictedFiles(worktreePath);
939
- if (remainingConflicts.length > 0) {
940
- logger.warn(
941
- `Conflicts still exist in ${remainingConflicts.length} file(s) after Claude assistance`
942
- );
943
- return false;
944
- }
945
- const rebaseInProgress = await this.isRebaseInProgress(worktreePath);
946
- if (rebaseInProgress) {
947
- logger.warn("Rebase still in progress after Claude assistance");
948
- return false;
949
- }
950
- logger.success("Claude successfully resolved conflicts and completed rebase");
951
- return true;
952
- } catch (error) {
953
- logger.warn("Claude conflict resolution failed", {
954
- error: error instanceof Error ? error.message : String(error)
955
- });
956
- return false;
957
- }
958
- }
959
- /**
960
- * Check if a git rebase is currently in progress
961
- * Checks for .git/rebase-merge or .git/rebase-apply directories
962
- * Ports bash script logic from lines 853-856
963
- *
964
- * @param worktreePath - Path to the worktree
965
- * @returns true if rebase in progress, false otherwise
966
- * @private
967
- */
968
- async isRebaseInProgress(worktreePath) {
969
- const fs = await import("fs/promises");
970
- const path2 = await import("path");
971
- const rebaseMergePath = path2.join(worktreePath, ".git", "rebase-merge");
972
- const rebaseApplyPath = path2.join(worktreePath, ".git", "rebase-apply");
973
- try {
974
- await fs.access(rebaseMergePath);
975
- return true;
976
- } catch {
977
- }
978
- try {
979
- await fs.access(rebaseApplyPath);
980
- return true;
981
- } catch {
982
- }
983
- return false;
984
- }
985
- };
986
-
987
706
  // src/lib/BuildRunner.ts
988
707
  var BuildRunner = class {
989
708
  constructor(capabilityDetector) {
@@ -1096,10 +815,7 @@ var FinishCommand = class {
1096
815
  const settings = await this.settingsManager.loadSettings();
1097
816
  const databaseUrlEnvVarName = ((_b = (_a = settings.capabilities) == null ? void 0 : _a.database) == null ? void 0 : _b.databaseUrlEnvVarName) ?? "DATABASE_URL";
1098
817
  const environmentManager = new EnvironmentManager();
1099
- const neonProvider = new NeonProvider({
1100
- projectId: process.env.NEON_PROJECT_ID ?? "",
1101
- parentBranch: process.env.NEON_PARENT_BRANCH ?? ""
1102
- });
818
+ const neonProvider = createNeonProviderFromSettings(settings);
1103
819
  const databaseManager = new DatabaseManager(neonProvider, environmentManager, databaseUrlEnvVarName);
1104
820
  const cliIsolationManager = new CLIIsolationManager();
1105
821
  this.resourceCleanup = new ResourceCleanup(
@@ -1114,8 +830,15 @@ var FinishCommand = class {
1114
830
  */
1115
831
  async execute(input) {
1116
832
  try {
833
+ const settings = await this.settingsManager.loadSettings();
834
+ let repo;
835
+ const multipleRemotes = await hasMultipleRemotes();
836
+ if (multipleRemotes) {
837
+ repo = await getConfiguredRepoFromSettings(settings);
838
+ logger.info(`Using GitHub repository: ${repo}`);
839
+ }
1117
840
  const parsed = await this.parseInput(input.identifier, input.options);
1118
- const worktrees = await this.validateInput(parsed, input.options);
841
+ const worktrees = await this.validateInput(parsed, input.options, repo);
1119
842
  logger.info(`Validated input: ${this.formatParsedInput(parsed)}`);
1120
843
  const worktree = worktrees[0];
1121
844
  if (!worktree) {
@@ -1125,7 +848,7 @@ var FinishCommand = class {
1125
848
  if (!parsed.number) {
1126
849
  throw new Error("Invalid PR number");
1127
850
  }
1128
- const pr = await this.gitHubService.fetchPR(parsed.number);
851
+ const pr = await this.gitHubService.fetchPR(parsed.number, repo);
1129
852
  await this.executePRWorkflow(parsed, input.options, worktree, pr);
1130
853
  } else {
1131
854
  await this.executeIssueWorkflow(parsed, input.options, worktree);
@@ -1251,7 +974,7 @@ var FinishCommand = class {
1251
974
  /**
1252
975
  * Validate the parsed input based on its type
1253
976
  */
1254
- async validateInput(parsed, options) {
977
+ async validateInput(parsed, options, repo) {
1255
978
  switch (parsed.type) {
1256
979
  case "pr": {
1257
980
  if (!parsed.number) {
@@ -1265,7 +988,7 @@ var FinishCommand = class {
1265
988
  if (!parsed.number) {
1266
989
  throw new Error("Invalid issue number");
1267
990
  }
1268
- const issue = await this.gitHubService.fetchIssue(parsed.number);
991
+ const issue = await this.gitHubService.fetchIssue(parsed.number, repo);
1269
992
  if (issue.state === "closed" && !options.force) {
1270
993
  throw new Error(
1271
994
  `Issue #${parsed.number} is closed. Use --force to finish anyway.`
@@ -1466,7 +1189,7 @@ var FinishCommand = class {
1466
1189
  logger.info(`[DRY RUN] Would push changes to origin/${pr.branch}`);
1467
1190
  } else {
1468
1191
  logger.info("Pushing changes to remote...");
1469
- const { pushBranchToRemote } = await import("./git-LVRZ57GJ.js");
1192
+ const { pushBranchToRemote } = await import("./git-OUYMVYJX.js");
1470
1193
  await pushBranchToRemote(pr.branch, worktree.path, {
1471
1194
  dryRun: false
1472
1195
  });
@@ -1505,6 +1228,10 @@ var FinishCommand = class {
1505
1228
  if (!result.success) {
1506
1229
  logger.warn("Some cleanup operations failed - manual cleanup may be required");
1507
1230
  this.showManualCleanupInstructions(worktree);
1231
+ } else {
1232
+ if (this.isRunningFromWithinWorktree(worktree.path)) {
1233
+ this.showTerminalCloseWarning(worktree);
1234
+ }
1508
1235
  }
1509
1236
  } catch (error) {
1510
1237
  const errorMessage = error instanceof Error ? error.message : "Unknown error";
@@ -1567,6 +1294,9 @@ var FinishCommand = class {
1567
1294
  } else {
1568
1295
  logger.success("Post-merge cleanup completed successfully");
1569
1296
  }
1297
+ if (this.isRunningFromWithinWorktree(worktree.path)) {
1298
+ this.showTerminalCloseWarning(worktree);
1299
+ }
1570
1300
  } catch (error) {
1571
1301
  const errorMessage = error instanceof Error ? error.message : "Unknown error";
1572
1302
  logger.warn(`Cleanup failed: ${errorMessage}`);
@@ -1601,8 +1331,25 @@ var FinishCommand = class {
1601
1331
  logger.info(` 2. Delete branch: git branch -d ${worktree.branch}`);
1602
1332
  logger.info(` 3. Check dev servers: lsof -i :PORT (and kill if needed)`);
1603
1333
  }
1334
+ /**
1335
+ * Check if current working directory is within the target worktree
1336
+ */
1337
+ isRunningFromWithinWorktree(worktreePath) {
1338
+ const normalizedCwd = path.normalize(process.cwd());
1339
+ const normalizedWorktree = path.normalize(worktreePath);
1340
+ return normalizedCwd.startsWith(normalizedWorktree);
1341
+ }
1342
+ /**
1343
+ * Display warning to close terminal/IDE when running from within finished loom
1344
+ */
1345
+ showTerminalCloseWarning(worktree) {
1346
+ logger.info("");
1347
+ logger.info("You are currently in the directory of the loom that was just finished.");
1348
+ logger.info("Please close this terminal and any IDE/terminal windows using this directory.");
1349
+ logger.info(`Directory: ${worktree.path}`);
1350
+ }
1604
1351
  };
1605
1352
  export {
1606
1353
  FinishCommand
1607
1354
  };
1608
- //# sourceMappingURL=finish-CY4CIH6O.js.map
1355
+ //# sourceMappingURL=finish-WGPISUEH.js.map