@akiojin/gwt 4.11.6 → 4.12.0

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 (172) hide show
  1. package/bin/gwt.js +1 -1
  2. package/dist/claude.d.ts +1 -0
  3. package/dist/claude.d.ts.map +1 -1
  4. package/dist/claude.js +50 -24
  5. package/dist/claude.js.map +1 -1
  6. package/dist/cli/ui/App.solid.d.ts.map +1 -1
  7. package/dist/cli/ui/App.solid.js +247 -49
  8. package/dist/cli/ui/App.solid.js.map +1 -1
  9. package/dist/cli/ui/components/solid/QuickStartStep.d.ts.map +1 -1
  10. package/dist/cli/ui/components/solid/QuickStartStep.js +35 -22
  11. package/dist/cli/ui/components/solid/QuickStartStep.js.map +1 -1
  12. package/dist/cli/ui/components/solid/SelectInput.d.ts.map +1 -1
  13. package/dist/cli/ui/components/solid/SelectInput.js +2 -1
  14. package/dist/cli/ui/components/solid/SelectInput.js.map +1 -1
  15. package/dist/cli/ui/components/solid/WizardController.d.ts.map +1 -1
  16. package/dist/cli/ui/components/solid/WizardController.js +19 -11
  17. package/dist/cli/ui/components/solid/WizardController.js.map +1 -1
  18. package/dist/cli/ui/components/solid/WizardSteps.d.ts.map +1 -1
  19. package/dist/cli/ui/components/solid/WizardSteps.js +26 -69
  20. package/dist/cli/ui/components/solid/WizardSteps.js.map +1 -1
  21. package/dist/cli/ui/core/theme.d.ts +9 -0
  22. package/dist/cli/ui/core/theme.d.ts.map +1 -1
  23. package/dist/cli/ui/core/theme.js +21 -0
  24. package/dist/cli/ui/core/theme.js.map +1 -1
  25. package/dist/cli/ui/screens/solid/BranchListScreen.d.ts +9 -2
  26. package/dist/cli/ui/screens/solid/BranchListScreen.d.ts.map +1 -1
  27. package/dist/cli/ui/screens/solid/BranchListScreen.js +101 -28
  28. package/dist/cli/ui/screens/solid/BranchListScreen.js.map +1 -1
  29. package/dist/cli/ui/screens/solid/ConfirmScreen.d.ts +2 -1
  30. package/dist/cli/ui/screens/solid/ConfirmScreen.d.ts.map +1 -1
  31. package/dist/cli/ui/screens/solid/ConfirmScreen.js +11 -3
  32. package/dist/cli/ui/screens/solid/ConfirmScreen.js.map +1 -1
  33. package/dist/cli/ui/screens/solid/EnvironmentScreen.d.ts.map +1 -1
  34. package/dist/cli/ui/screens/solid/EnvironmentScreen.js +9 -10
  35. package/dist/cli/ui/screens/solid/EnvironmentScreen.js.map +1 -1
  36. package/dist/cli/ui/screens/solid/LogScreen.d.ts +7 -1
  37. package/dist/cli/ui/screens/solid/LogScreen.d.ts.map +1 -1
  38. package/dist/cli/ui/screens/solid/LogScreen.js +254 -16
  39. package/dist/cli/ui/screens/solid/LogScreen.js.map +1 -1
  40. package/dist/cli/ui/screens/solid/ProfileEnvScreen.d.ts.map +1 -1
  41. package/dist/cli/ui/screens/solid/ProfileEnvScreen.js +8 -5
  42. package/dist/cli/ui/screens/solid/ProfileEnvScreen.js.map +1 -1
  43. package/dist/cli/ui/screens/solid/SelectorScreen.d.ts.map +1 -1
  44. package/dist/cli/ui/screens/solid/SelectorScreen.js +12 -4
  45. package/dist/cli/ui/screens/solid/SelectorScreen.js.map +1 -1
  46. package/dist/cli/ui/types.d.ts +1 -0
  47. package/dist/cli/ui/types.d.ts.map +1 -1
  48. package/dist/cli/ui/utils/branchFormatter.d.ts +1 -0
  49. package/dist/cli/ui/utils/branchFormatter.d.ts.map +1 -1
  50. package/dist/cli/ui/utils/branchFormatter.js +29 -7
  51. package/dist/cli/ui/utils/branchFormatter.js.map +1 -1
  52. package/dist/cli/ui/utils/continueSession.d.ts +14 -0
  53. package/dist/cli/ui/utils/continueSession.d.ts.map +1 -1
  54. package/dist/cli/ui/utils/continueSession.js +61 -3
  55. package/dist/cli/ui/utils/continueSession.js.map +1 -1
  56. package/dist/cli/ui/utils/versionCache.d.ts +37 -0
  57. package/dist/cli/ui/utils/versionCache.d.ts.map +1 -0
  58. package/dist/cli/ui/utils/versionCache.js +70 -0
  59. package/dist/cli/ui/utils/versionCache.js.map +1 -0
  60. package/dist/cli/ui/utils/versionFetcher.d.ts +41 -0
  61. package/dist/cli/ui/utils/versionFetcher.d.ts.map +1 -0
  62. package/dist/cli/ui/utils/versionFetcher.js +89 -0
  63. package/dist/cli/ui/utils/versionFetcher.js.map +1 -0
  64. package/dist/codex.d.ts +1 -0
  65. package/dist/codex.d.ts.map +1 -1
  66. package/dist/codex.js +48 -19
  67. package/dist/codex.js.map +1 -1
  68. package/dist/config/index.d.ts.map +1 -1
  69. package/dist/config/index.js +10 -1
  70. package/dist/config/index.js.map +1 -1
  71. package/dist/gemini.d.ts +1 -0
  72. package/dist/gemini.d.ts.map +1 -1
  73. package/dist/gemini.js +36 -3
  74. package/dist/gemini.js.map +1 -1
  75. package/dist/index.d.ts.map +1 -1
  76. package/dist/index.js +32 -2
  77. package/dist/index.js.map +1 -1
  78. package/dist/launcher.d.ts.map +1 -1
  79. package/dist/launcher.js +43 -8
  80. package/dist/launcher.js.map +1 -1
  81. package/dist/logging/agentOutput.d.ts +21 -0
  82. package/dist/logging/agentOutput.d.ts.map +1 -0
  83. package/dist/logging/agentOutput.js +164 -0
  84. package/dist/logging/agentOutput.js.map +1 -0
  85. package/dist/logging/formatter.d.ts.map +1 -1
  86. package/dist/logging/formatter.js +18 -4
  87. package/dist/logging/formatter.js.map +1 -1
  88. package/dist/logging/logger.d.ts.map +1 -1
  89. package/dist/logging/logger.js +2 -0
  90. package/dist/logging/logger.js.map +1 -1
  91. package/dist/logging/reader.d.ts +21 -0
  92. package/dist/logging/reader.d.ts.map +1 -1
  93. package/dist/logging/reader.js +79 -0
  94. package/dist/logging/reader.js.map +1 -1
  95. package/dist/opentui/index.solid.js +2306 -653
  96. package/dist/services/dependency-installer.js +2 -2
  97. package/dist/services/dependency-installer.js.map +1 -1
  98. package/dist/utils/session/common.d.ts +8 -0
  99. package/dist/utils/session/common.d.ts.map +1 -1
  100. package/dist/utils/session/common.js +22 -0
  101. package/dist/utils/session/common.js.map +1 -1
  102. package/dist/utils/session/parsers/claude.d.ts +10 -4
  103. package/dist/utils/session/parsers/claude.d.ts.map +1 -1
  104. package/dist/utils/session/parsers/claude.js +64 -18
  105. package/dist/utils/session/parsers/claude.js.map +1 -1
  106. package/dist/utils/session/parsers/codex.d.ts.map +1 -1
  107. package/dist/utils/session/parsers/codex.js +48 -28
  108. package/dist/utils/session/parsers/codex.js.map +1 -1
  109. package/dist/utils/session/parsers/gemini.d.ts.map +1 -1
  110. package/dist/utils/session/parsers/gemini.js +43 -6
  111. package/dist/utils/session/parsers/gemini.js.map +1 -1
  112. package/dist/utils/session/parsers/opencode.d.ts.map +1 -1
  113. package/dist/utils/session/parsers/opencode.js +43 -6
  114. package/dist/utils/session/parsers/opencode.js.map +1 -1
  115. package/dist/utils/session/types.d.ts +7 -0
  116. package/dist/utils/session/types.d.ts.map +1 -1
  117. package/dist/web/client/src/components/ui/alert.d.ts +1 -1
  118. package/dist/worktree.d.ts +4 -1
  119. package/dist/worktree.d.ts.map +1 -1
  120. package/dist/worktree.js +21 -15
  121. package/dist/worktree.js.map +1 -1
  122. package/package.json +2 -1
  123. package/src/claude.ts +64 -28
  124. package/src/cli/ui/App.solid.tsx +324 -51
  125. package/src/cli/ui/__tests__/solid/AppSolid.cleanup.test.tsx +830 -1
  126. package/src/cli/ui/__tests__/solid/BranchListScreen.test.tsx +105 -5
  127. package/src/cli/ui/__tests__/solid/ConfirmScreen.test.tsx +77 -0
  128. package/src/cli/ui/__tests__/solid/LogScreen.test.tsx +351 -0
  129. package/src/cli/ui/__tests__/solid/components/QuickStartStep.test.tsx +73 -2
  130. package/src/cli/ui/__tests__/solid/components/WizardSteps.test.tsx +4 -1
  131. package/src/cli/ui/__tests__/utils/branchFormatter.test.ts +72 -45
  132. package/src/cli/ui/components/solid/QuickStartStep.tsx +35 -23
  133. package/src/cli/ui/components/solid/SearchInput.tsx +1 -1
  134. package/src/cli/ui/components/solid/SelectInput.tsx +4 -0
  135. package/src/cli/ui/components/solid/WizardController.tsx +20 -11
  136. package/src/cli/ui/components/solid/WizardSteps.tsx +29 -86
  137. package/src/cli/ui/core/theme.ts +32 -0
  138. package/src/cli/ui/hooks/solid/useAsyncOperation.ts +8 -6
  139. package/src/cli/ui/hooks/solid/useGitOperations.ts +6 -5
  140. package/src/cli/ui/screens/solid/BranchListScreen.tsx +135 -32
  141. package/src/cli/ui/screens/solid/ConfirmScreen.tsx +20 -8
  142. package/src/cli/ui/screens/solid/EnvironmentScreen.tsx +22 -20
  143. package/src/cli/ui/screens/solid/LogScreen.tsx +364 -35
  144. package/src/cli/ui/screens/solid/ProfileEnvScreen.tsx +19 -15
  145. package/src/cli/ui/screens/solid/SelectorScreen.tsx +25 -14
  146. package/src/cli/ui/screens/solid/SettingsScreen.tsx +5 -3
  147. package/src/cli/ui/types.ts +1 -0
  148. package/src/cli/ui/utils/__tests__/branchFormatter.test.ts +53 -6
  149. package/src/cli/ui/utils/branchFormatter.ts +35 -7
  150. package/src/cli/ui/utils/continueSession.ts +90 -3
  151. package/src/cli/ui/utils/versionCache.ts +93 -0
  152. package/src/cli/ui/utils/versionFetcher.ts +120 -0
  153. package/src/codex.ts +62 -20
  154. package/src/config/__tests__/saveSession.test.ts +2 -2
  155. package/src/config/index.ts +11 -1
  156. package/src/gemini.ts +50 -4
  157. package/src/index.test.ts +16 -10
  158. package/src/index.ts +38 -1
  159. package/src/launcher.ts +49 -8
  160. package/src/logging/agentOutput.ts +216 -0
  161. package/src/logging/formatter.ts +23 -4
  162. package/src/logging/logger.ts +2 -0
  163. package/src/logging/reader.ts +117 -0
  164. package/src/services/__tests__/BatchMergeService.test.ts +34 -14
  165. package/src/services/dependency-installer.ts +2 -2
  166. package/src/utils/session/common.ts +28 -0
  167. package/src/utils/session/parsers/claude.ts +79 -29
  168. package/src/utils/session/parsers/codex.ts +50 -26
  169. package/src/utils/session/parsers/gemini.ts +46 -5
  170. package/src/utils/session/parsers/opencode.ts +46 -5
  171. package/src/utils/session/types.ts +4 -0
  172. package/src/worktree.ts +28 -15
@@ -13,8 +13,10 @@ import type { OpenCodeSessionInfo, SessionSearchOptions } from "../types.js";
13
13
  import {
14
14
  collectFilesIterative,
15
15
  matchesCwd,
16
+ resolveBranchFromCwd,
16
17
  readSessionInfoFromFile,
17
18
  } from "../common.js";
19
+ import { listAllWorktrees } from "../../../worktree.js";
18
20
 
19
21
  /**
20
22
  * Returns the OpenCode session directory
@@ -73,15 +75,50 @@ export async function findLatestOpenCodeSession(
73
75
  return b.mtime - a.mtime;
74
76
  });
75
77
 
78
+ const branchFilter =
79
+ typeof options.branch === "string" && options.branch.trim().length > 0
80
+ ? options.branch.trim()
81
+ : null;
82
+ const shouldCheckBranch = Boolean(branchFilter);
83
+ const shouldCheckCwd = Boolean(options.cwd) && !shouldCheckBranch;
84
+
85
+ let worktrees: { path: string; branch: string }[] = [];
86
+ if (shouldCheckBranch) {
87
+ if (Array.isArray(options.worktrees) && options.worktrees.length > 0) {
88
+ worktrees = options.worktrees
89
+ .filter((entry) => entry?.path && entry?.branch)
90
+ .map((entry) => ({ path: entry.path, branch: entry.branch }));
91
+ } else {
92
+ try {
93
+ const allWorktrees = await listAllWorktrees();
94
+ worktrees = allWorktrees
95
+ .filter((entry) => entry?.path && entry?.branch)
96
+ .map((entry) => ({ path: entry.path, branch: entry.branch }));
97
+ } catch {
98
+ worktrees = [];
99
+ }
100
+ }
101
+ if (!worktrees.length) return null;
102
+ }
103
+
76
104
  for (const file of pool) {
77
105
  const info = await readSessionInfoFromFile(file.fullPath);
78
106
  if (!info.id) continue;
79
- if (options.cwd) {
80
- if (matchesCwd(info.cwd, options.cwd)) {
81
- return { id: info.id, mtime: file.mtime };
107
+ const sessionCwd = info.cwd ?? null;
108
+
109
+ if (shouldCheckBranch) {
110
+ const resolvedBranch = resolveBranchFromCwd(sessionCwd, worktrees);
111
+ if (resolvedBranch !== branchFilter) {
112
+ continue;
82
113
  }
83
- continue;
84
114
  }
115
+
116
+ if (shouldCheckCwd && options.cwd) {
117
+ if (!matchesCwd(sessionCwd, options.cwd)) {
118
+ continue;
119
+ }
120
+ }
121
+
85
122
  return { id: info.id, mtime: file.mtime };
86
123
  }
87
124
 
@@ -98,7 +135,11 @@ export async function findLatestOpenCodeSessionId(
98
135
  cwd: string,
99
136
  options: SessionSearchOptions = {},
100
137
  ): Promise<string | null> {
101
- const searchOptions: SessionSearchOptions = { cwd: options.cwd ?? cwd };
138
+ const searchOptions: SessionSearchOptions = {
139
+ cwd: options.cwd ?? cwd,
140
+ branch: options.branch ?? null,
141
+ worktrees: options.worktrees ?? null,
142
+ };
102
143
  if (options.since !== undefined) searchOptions.since = options.since;
103
144
  if (options.until !== undefined) searchOptions.until = options.until;
104
145
  if (options.preferClosestTo !== undefined)
@@ -16,6 +16,10 @@ export interface SessionSearchOptions {
16
16
  windowMs?: number;
17
17
  /** Working directory filter */
18
18
  cwd?: string | null;
19
+ /** Branch name filter (resolved from session cwd via worktree paths) */
20
+ branch?: string | null;
21
+ /** Optional worktree list to avoid shelling out for branch mapping */
22
+ worktrees?: { path: string; branch: string }[] | null;
19
23
  }
20
24
 
21
25
  /**
package/src/worktree.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { execa } from "execa";
2
- import fs from "node:fs/promises";
2
+ import { lstat, mkdir, readFile, rm } from "node:fs/promises";
3
3
  import path from "node:path";
4
4
  import chalk from "chalk";
5
5
  import { createLogger } from "./logging/logger.js";
@@ -247,6 +247,10 @@ async function listWorktrees(): Promise<WorktreeInfo[]> {
247
247
  }
248
248
  }
249
249
 
250
+ export async function listAllWorktrees(): Promise<WorktreeInfo[]> {
251
+ return listWorktrees();
252
+ }
253
+
250
254
  /**
251
255
  * 追加のworktree(メインworktreeを除く)の一覧を取得
252
256
  * @returns {Promise<WorktreeInfo[]>} worktree情報の配列
@@ -411,9 +415,9 @@ async function assessStaleWorktreeDirectory(
411
415
  return { status: "stale", reason: "missing .git" };
412
416
  }
413
417
 
414
- let gitMetaStat: Awaited<ReturnType<typeof fs.lstat>>;
418
+ let gitMetaStat: Awaited<ReturnType<typeof lstat>>;
415
419
  try {
416
- gitMetaStat = await fs.lstat(gitMetaPath);
420
+ gitMetaStat = await lstat(gitMetaPath);
417
421
  } catch {
418
422
  return { status: "unknown", reason: "unable to stat .git" };
419
423
  }
@@ -428,7 +432,7 @@ async function assessStaleWorktreeDirectory(
428
432
 
429
433
  let gitMetaContents = "";
430
434
  try {
431
- gitMetaContents = await fs.readFile(gitMetaPath, "utf8");
435
+ gitMetaContents = await readFile(gitMetaPath, "utf8");
432
436
  } catch {
433
437
  return { status: "unknown", reason: "unable to read .git" };
434
438
  }
@@ -469,7 +473,7 @@ export async function createWorktree(config: WorktreeConfig): Promise<void> {
469
473
  try {
470
474
  const staleness = await assessStaleWorktreeDirectory(config.worktreePath);
471
475
  if (staleness.status === "stale") {
472
- await fs.rm(config.worktreePath, { recursive: true, force: true });
476
+ await rm(config.worktreePath, { recursive: true, force: true });
473
477
  } else if (staleness.status === "unknown") {
474
478
  const reason = staleness.reason ? ` (${staleness.reason})` : "";
475
479
  throw new WorktreeError(
@@ -480,7 +484,7 @@ export async function createWorktree(config: WorktreeConfig): Promise<void> {
480
484
  const worktreeParentDir = path.dirname(config.worktreePath);
481
485
 
482
486
  try {
483
- await fs.mkdir(worktreeParentDir, { recursive: true });
487
+ await mkdir(worktreeParentDir, { recursive: true });
484
488
  } catch (error: unknown) {
485
489
  const errorWithCode = error as { code?: unknown; message?: unknown };
486
490
  const code =
@@ -827,9 +831,11 @@ async function getWorktreesWithPRStatus(): Promise<WorktreeWithPR[]> {
827
831
  async function getOrphanedLocalBranchStatuses({
828
832
  baseBranch,
829
833
  repoRoot,
834
+ onProgress,
830
835
  }: {
831
836
  baseBranch: string;
832
837
  repoRoot: string;
838
+ onProgress?: (status: CleanupStatus) => void;
833
839
  }): Promise<CleanupStatus[]> {
834
840
  try {
835
841
  // 並列実行で高速化
@@ -886,11 +892,10 @@ async function getOrphanedLocalBranchStatuses({
886
892
  localBranch.name,
887
893
  repoRoot,
888
894
  );
889
- const comparisonBase = upstream ?? baseBranch;
890
895
 
891
896
  const hasUniqueCommits = await branchHasUniqueCommitsComparedToBase(
892
897
  localBranch.name,
893
- comparisonBase,
898
+ baseBranch,
894
899
  repoRoot,
895
900
  );
896
901
 
@@ -909,7 +914,7 @@ async function getOrphanedLocalBranchStatuses({
909
914
  );
910
915
  }
911
916
 
912
- statuses.push({
917
+ const status: CleanupStatus = {
913
918
  worktreePath: null, // worktreeは存在しない
914
919
  branch: localBranch.name,
915
920
  hasUncommittedChanges: false, // worktreeが存在しないため常にfalse
@@ -920,7 +925,9 @@ async function getOrphanedLocalBranchStatuses({
920
925
  hasUpstream,
921
926
  upstream,
922
927
  reasons,
923
- });
928
+ };
929
+ statuses.push(status);
930
+ onProgress?.(status);
924
931
  }
925
932
  }
926
933
 
@@ -940,7 +947,11 @@ async function getOrphanedLocalBranchStatuses({
940
947
  }
941
948
  }
942
949
 
943
- export async function getCleanupStatus(): Promise<CleanupStatus[]> {
950
+ export async function getCleanupStatus({
951
+ onProgress,
952
+ }: {
953
+ onProgress?: (status: CleanupStatus) => void;
954
+ } = {}): Promise<CleanupStatus[]> {
944
955
  const [config, repoRoot, worktreesWithPR] = await Promise.all([
945
956
  getConfig(),
946
957
  getRepositoryRoot(),
@@ -951,6 +962,7 @@ export async function getCleanupStatus(): Promise<CleanupStatus[]> {
951
962
  const orphanedStatuses = await getOrphanedLocalBranchStatuses({
952
963
  baseBranch,
953
964
  repoRoot,
965
+ ...(onProgress ? { onProgress } : {}),
954
966
  });
955
967
  const statuses: CleanupStatus[] = [];
956
968
 
@@ -1003,11 +1015,10 @@ export async function getCleanupStatus(): Promise<CleanupStatus[]> {
1003
1015
  worktree.branch,
1004
1016
  repoRoot,
1005
1017
  );
1006
- const comparisonBase = upstream ?? baseBranch;
1007
1018
 
1008
1019
  const hasUniqueCommits = await branchHasUniqueCommitsComparedToBase(
1009
1020
  worktree.branch,
1010
- comparisonBase,
1021
+ baseBranch,
1011
1022
  repoRoot,
1012
1023
  );
1013
1024
 
@@ -1026,7 +1037,7 @@ export async function getCleanupStatus(): Promise<CleanupStatus[]> {
1026
1037
  );
1027
1038
  }
1028
1039
 
1029
- statuses.push({
1040
+ const status: CleanupStatus = {
1030
1041
  worktreePath: worktree.worktreePath,
1031
1042
  branch: worktree.branch,
1032
1043
  hasUncommittedChanges: hasUncommitted,
@@ -1041,7 +1052,9 @@ export async function getCleanupStatus(): Promise<CleanupStatus[]> {
1041
1052
  ...(isAccessible
1042
1053
  ? {}
1043
1054
  : { invalidReason: "Path not accessible in current environment" }),
1044
- });
1055
+ };
1056
+ statuses.push(status);
1057
+ onProgress?.(status);
1045
1058
  }
1046
1059
 
1047
1060
  statuses.push(...orphanedStatuses);