@akiojin/gwt 2.14.0 → 3.1.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 (64) hide show
  1. package/README.ja.md +10 -2
  2. package/README.md +9 -2
  3. package/dist/cli/ui/components/App.d.ts.map +1 -1
  4. package/dist/cli/ui/components/App.js +19 -4
  5. package/dist/cli/ui/components/App.js.map +1 -1
  6. package/dist/cli/ui/components/parts/Header.d.ts +8 -0
  7. package/dist/cli/ui/components/parts/Header.d.ts.map +1 -1
  8. package/dist/cli/ui/components/parts/Header.js +7 -2
  9. package/dist/cli/ui/components/parts/Header.js.map +1 -1
  10. package/dist/cli/ui/components/screens/BranchListScreen.d.ts +3 -1
  11. package/dist/cli/ui/components/screens/BranchListScreen.d.ts.map +1 -1
  12. package/dist/cli/ui/components/screens/BranchListScreen.js +9 -17
  13. package/dist/cli/ui/components/screens/BranchListScreen.js.map +1 -1
  14. package/dist/cli/ui/components/screens/EnvironmentProfileScreen.d.ts +16 -0
  15. package/dist/cli/ui/components/screens/EnvironmentProfileScreen.d.ts.map +1 -0
  16. package/dist/cli/ui/components/screens/EnvironmentProfileScreen.js +576 -0
  17. package/dist/cli/ui/components/screens/EnvironmentProfileScreen.js.map +1 -0
  18. package/dist/cli/ui/hooks/useProfiles.d.ts +41 -0
  19. package/dist/cli/ui/hooks/useProfiles.d.ts.map +1 -0
  20. package/dist/cli/ui/hooks/useProfiles.js +136 -0
  21. package/dist/cli/ui/hooks/useProfiles.js.map +1 -0
  22. package/dist/cli/ui/types.d.ts +1 -1
  23. package/dist/cli/ui/types.d.ts.map +1 -1
  24. package/dist/client/assets/{index-DPWWHorC.js → index-f5D2XwDh.js} +12 -12
  25. package/dist/client/index.html +1 -1
  26. package/dist/config/profiles.d.ts +94 -0
  27. package/dist/config/profiles.d.ts.map +1 -0
  28. package/dist/config/profiles.js +287 -0
  29. package/dist/config/profiles.js.map +1 -0
  30. package/dist/config/tools.d.ts +10 -0
  31. package/dist/config/tools.d.ts.map +1 -1
  32. package/dist/config/tools.js +19 -2
  33. package/dist/config/tools.js.map +1 -1
  34. package/dist/index.d.ts.map +1 -1
  35. package/dist/index.js +7 -44
  36. package/dist/index.js.map +1 -1
  37. package/dist/types/profiles.d.ts +54 -0
  38. package/dist/types/profiles.d.ts.map +1 -0
  39. package/dist/types/profiles.js +33 -0
  40. package/dist/types/profiles.js.map +1 -0
  41. package/dist/web/client/src/components/ui/alert.d.ts +1 -1
  42. package/dist/web/client/src/components/ui/badge.d.ts +1 -1
  43. package/dist/web/client/src/pages/BranchDetailPage.d.ts.map +1 -1
  44. package/dist/web/client/src/pages/BranchDetailPage.js +49 -52
  45. package/dist/web/client/src/pages/BranchDetailPage.js.map +1 -1
  46. package/dist/web/server/tray.d.ts +1 -0
  47. package/dist/web/server/tray.d.ts.map +1 -1
  48. package/dist/web/server/tray.js +27 -8
  49. package/dist/web/server/tray.js.map +1 -1
  50. package/package.json +4 -3
  51. package/src/cli/ui/__tests__/components/App.protected-branch.test.tsx +1 -1
  52. package/src/cli/ui/__tests__/components/screens/BranchListScreen.test.tsx +0 -14
  53. package/src/cli/ui/components/App.tsx +49 -36
  54. package/src/cli/ui/components/parts/Header.tsx +16 -1
  55. package/src/cli/ui/components/screens/BranchListScreen.tsx +11 -16
  56. package/src/cli/ui/components/screens/EnvironmentProfileScreen.tsx +924 -0
  57. package/src/cli/ui/hooks/useProfiles.ts +211 -0
  58. package/src/cli/ui/types.ts +2 -1
  59. package/src/config/profiles.ts +362 -0
  60. package/src/config/tools.ts +20 -2
  61. package/src/index.ts +7 -49
  62. package/src/types/profiles.ts +64 -0
  63. package/src/web/client/src/pages/BranchDetailPage.tsx +60 -64
  64. package/src/web/server/tray.ts +43 -16
@@ -7,7 +7,10 @@ import React, {
7
7
  } from "react";
8
8
  import { useApp } from "ink";
9
9
  import { ErrorBoundary } from "./common/ErrorBoundary.js";
10
- import { BranchListScreen } from "./screens/BranchListScreen.js";
10
+ import {
11
+ BranchListScreen,
12
+ type BranchListScreenProps,
13
+ } from "./screens/BranchListScreen.js";
11
14
  import { BranchCreatorScreen } from "./screens/BranchCreatorScreen.js";
12
15
  import { BranchActionSelectorScreen } from "../screens/BranchActionSelectorScreen.js";
13
16
  import { AIToolSelectorScreen } from "./screens/AIToolSelectorScreen.js";
@@ -19,7 +22,9 @@ import {
19
22
  ModelSelectorScreen,
20
23
  type ModelSelectionResult,
21
24
  } from "./screens/ModelSelectorScreen.js";
25
+ import { EnvironmentProfileScreen } from "./screens/EnvironmentProfileScreen.js";
22
26
  import { useGitData } from "../hooks/useGitData.js";
27
+ import { useProfiles } from "../hooks/useProfiles.js";
23
28
  import { useScreenState } from "../hooks/useScreenState.js";
24
29
  import { formatBranchItems } from "../utils/branchFormatter.js";
25
30
  import { calculateStatistics } from "../utils/statisticsCalculator.js";
@@ -108,6 +113,9 @@ export function App({ onExit, loadingIndicatorDelay = 300 }: AppProps) {
108
113
  });
109
114
  const { currentScreen, navigateTo, goBack } = useScreenState();
110
115
 
116
+ // Profile state
117
+ const { activeProfileName, refresh: refreshProfiles } = useProfiles();
118
+
111
119
  // Version state
112
120
  const [version, setVersion] = useState<string | null>(null);
113
121
  const [repoRoot, setRepoRoot] = useState<string | null>(null);
@@ -1153,31 +1161,39 @@ export function App({ onExit, loadingIndicatorDelay = 300 }: AppProps) {
1153
1161
 
1154
1162
  // Render screen based on currentScreen
1155
1163
  const renderScreen = () => {
1164
+ const renderBranchListScreen = (
1165
+ additionalProps?: Partial<BranchListScreenProps>,
1166
+ ) => (
1167
+ <BranchListScreen
1168
+ branches={branchItems}
1169
+ stats={stats}
1170
+ onSelect={handleSelect}
1171
+ onQuit={handleQuit}
1172
+ onRefresh={refresh}
1173
+ loading={loading}
1174
+ error={error}
1175
+ lastUpdated={lastUpdated}
1176
+ loadingIndicatorDelay={loadingIndicatorDelay}
1177
+ version={version}
1178
+ workingDirectory={workingDirectory}
1179
+ activeProfile={activeProfileName}
1180
+ onOpenProfiles={() => navigateTo("environment-profile")}
1181
+ {...additionalProps}
1182
+ />
1183
+ );
1184
+
1156
1185
  switch (currentScreen) {
1157
1186
  case "branch-list":
1158
- return (
1159
- <BranchListScreen
1160
- branches={branchItems}
1161
- stats={stats}
1162
- onSelect={handleSelect}
1163
- onQuit={handleQuit}
1164
- onCleanupCommand={handleCleanupCommand}
1165
- onRefresh={refresh}
1166
- loading={loading}
1167
- error={error}
1168
- lastUpdated={lastUpdated}
1169
- loadingIndicatorDelay={loadingIndicatorDelay}
1170
- cleanupUI={{
1171
- indicators: cleanupIndicators,
1172
- footerMessage: cleanupFooterMessage,
1173
- inputLocked: cleanupInputLocked,
1174
- }}
1175
- version={version}
1176
- workingDirectory={workingDirectory}
1177
- selectedBranches={selectedBranches}
1178
- onToggleSelect={toggleBranchSelection}
1179
- />
1180
- );
1187
+ return renderBranchListScreen({
1188
+ onCleanupCommand: handleCleanupCommand,
1189
+ cleanupUI: {
1190
+ indicators: cleanupIndicators,
1191
+ footerMessage: cleanupFooterMessage,
1192
+ inputLocked: cleanupInputLocked,
1193
+ },
1194
+ selectedBranches,
1195
+ onToggleSelect: toggleBranchSelection,
1196
+ });
1181
1197
 
1182
1198
  case "branch-creator":
1183
1199
  return (
@@ -1268,22 +1284,19 @@ export function App({ onExit, loadingIndicatorDelay = 300 }: AppProps) {
1268
1284
  />
1269
1285
  );
1270
1286
 
1271
- default:
1287
+ case "environment-profile":
1272
1288
  return (
1273
- <BranchListScreen
1274
- branches={branchItems}
1275
- stats={stats}
1276
- onSelect={handleSelect}
1277
- onQuit={handleQuit}
1278
- onRefresh={refresh}
1279
- loading={loading}
1280
- error={error}
1281
- lastUpdated={lastUpdated}
1282
- loadingIndicatorDelay={loadingIndicatorDelay}
1289
+ <EnvironmentProfileScreen
1290
+ onBack={() => {
1291
+ void refreshProfiles();
1292
+ goBack();
1293
+ }}
1283
1294
  version={version}
1284
- workingDirectory={workingDirectory}
1285
1295
  />
1286
1296
  );
1297
+
1298
+ default:
1299
+ return renderBranchListScreen();
1287
1300
  }
1288
1301
  };
1289
1302
 
@@ -22,6 +22,14 @@ export interface HeaderProps {
22
22
  * @default undefined
23
23
  */
24
24
  workingDirectory?: string;
25
+ /**
26
+ * 現在アクティブなプロファイル名
27
+ * - string: プロファイル名が利用可能(例: "development")
28
+ * - null: プロファイルが選択されていない
29
+ * - undefined: プロファイル情報未提供
30
+ * @default undefined
31
+ */
32
+ activeProfile?: string | null | undefined;
25
33
  }
26
34
 
27
35
  /**
@@ -36,9 +44,16 @@ export const Header = React.memo(function Header({
36
44
  width = 80,
37
45
  version,
38
46
  workingDirectory,
47
+ activeProfile,
39
48
  }: HeaderProps) {
40
49
  const divider = dividerChar.repeat(width);
41
- const displayTitle = version ? `${title} v${version}` : title;
50
+
51
+ // タイトル構築: "gwt v2.14 | Profile: development" または "gwt v2.14 | Profile: (none)"
52
+ let displayTitle = version ? `${title} v${version}` : title;
53
+ if (activeProfile !== undefined) {
54
+ const profileLabel = activeProfile ?? "(none)";
55
+ displayTitle = `${displayTitle} | Profile: ${profileLabel}`;
56
+ }
42
57
 
43
58
  return (
44
59
  <Box flexDirection="column">
@@ -11,7 +11,6 @@ import type { BranchItem, Statistics } from "../../types.js";
11
11
  import stringWidth from "string-width";
12
12
  import stripAnsi from "strip-ansi";
13
13
  import chalk from "chalk";
14
- import { resolveWebUiPort } from "../../../../utils/webui.js";
15
14
 
16
15
  // Emoji 幅は端末によって 1 または 2 になることがあるため、最小幅を上書きして
17
16
  // 実測より小さくならないようにする(過小評価=折り返しの原因を防ぐ)
@@ -85,6 +84,7 @@ export interface BranchListScreenProps {
85
84
  onQuit?: () => void;
86
85
  onCleanupCommand?: () => void;
87
86
  onRefresh?: () => void;
87
+ onOpenProfiles?: () => void;
88
88
  loading?: boolean;
89
89
  error?: Error | null;
90
90
  lastUpdated?: Date | null;
@@ -92,6 +92,7 @@ export interface BranchListScreenProps {
92
92
  cleanupUI?: CleanupUIState;
93
93
  version?: string | null;
94
94
  workingDirectory?: string;
95
+ activeProfile?: string | null;
95
96
  // Test support: allow external control of filter mode and query
96
97
  testFilterMode?: boolean;
97
98
  testOnFilterModeChange?: (mode: boolean) => void;
@@ -111,6 +112,7 @@ export function BranchListScreen({
111
112
  onSelect,
112
113
  onCleanupCommand,
113
114
  onRefresh,
115
+ onOpenProfiles,
114
116
  loading = false,
115
117
  error = null,
116
118
  lastUpdated = null,
@@ -118,6 +120,7 @@ export function BranchListScreen({
118
120
  cleanupUI,
119
121
  version,
120
122
  workingDirectory,
123
+ activeProfile,
121
124
  testFilterMode,
122
125
  testOnFilterModeChange,
123
126
  testFilterQuery,
@@ -207,6 +210,8 @@ export function BranchListScreen({
207
210
  onCleanupCommand?.();
208
211
  } else if (input === "r" && onRefresh) {
209
212
  onRefresh();
213
+ } else if (input === "p" && onOpenProfiles) {
214
+ onOpenProfiles();
210
215
  }
211
216
  });
212
217
 
@@ -246,22 +251,15 @@ export function BranchListScreen({
246
251
  // Filter input: 1 line
247
252
  // Stats: 1 line
248
253
  // Empty line: 1 line
249
- // Web UI URL: 1 line
250
254
  // Footer: 1 line
251
- // Total fixed: 7 lines
255
+ // Total fixed: 6 lines
252
256
  const headerLines = 2;
253
257
  const filterLines = 1;
254
258
  const statsLines = 1;
255
259
  const emptyLine = 1;
256
- const webUiLines = 1;
257
260
  const footerLines = 1;
258
261
  const fixedLines =
259
- headerLines +
260
- filterLines +
261
- statsLines +
262
- emptyLine +
263
- webUiLines +
264
- footerLines;
262
+ headerLines + filterLines + statsLines + emptyLine + footerLines;
265
263
  const contentHeight = rows - fixedLines;
266
264
  const limit = Math.max(5, contentHeight); // Minimum 5 items visible
267
265
 
@@ -270,7 +268,8 @@ export function BranchListScreen({
270
268
  { key: "enter", description: "Select" },
271
269
  { key: "f", description: "Filter" },
272
270
  { key: "r", description: "Refresh" },
273
- { key: "c", description: "Cleanup branches" },
271
+ { key: "c", description: "Cleanup" },
272
+ { key: "p", description: "Profiles" },
274
273
  ];
275
274
 
276
275
  const formatLatestCommit = useCallback((timestamp?: number) => {
@@ -522,6 +521,7 @@ export function BranchListScreen({
522
521
  titleColor="cyan"
523
522
  version={version}
524
523
  {...(workingDirectory !== undefined && { workingDirectory })}
524
+ activeProfile={activeProfile}
525
525
  />
526
526
 
527
527
  {/* Filter Input - Always visible */}
@@ -623,11 +623,6 @@ export function BranchListScreen({
623
623
  </Box>
624
624
  )}
625
625
 
626
- {/* Web UI URL */}
627
- <Box>
628
- <Text dimColor>Web UI: http://localhost:{resolveWebUiPort()}</Text>
629
- </Box>
630
-
631
626
  {/* Footer */}
632
627
  <Footer actions={footerActions} />
633
628
  </Box>