github-issue-tower-defence-management 1.90.0 → 1.91.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 (155) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/README.md +14 -1
  3. package/bin/adapter/entry-points/cli/index.js +16 -12
  4. package/bin/adapter/entry-points/cli/index.js.map +1 -1
  5. package/bin/adapter/entry-points/cli/projectConfig.js +2 -0
  6. package/bin/adapter/entry-points/cli/projectConfig.js.map +1 -1
  7. package/bin/adapter/entry-points/console/consoleOperationApi.js +54 -27
  8. package/bin/adapter/entry-points/console/consoleOperationApi.js.map +1 -1
  9. package/bin/adapter/entry-points/console/consoleProjectResolver.js +38 -0
  10. package/bin/adapter/entry-points/console/consoleProjectResolver.js.map +1 -0
  11. package/bin/adapter/entry-points/console/consoleServer.js +3 -4
  12. package/bin/adapter/entry-points/console/consoleServer.js.map +1 -1
  13. package/bin/adapter/entry-points/console/ui-dist/assets/index-BU6p3cGU.css +1 -0
  14. package/bin/adapter/entry-points/console/ui-dist/assets/index-BvuSQN9s.js +100 -0
  15. package/bin/adapter/entry-points/console/ui-dist/index.html +2 -2
  16. package/bin/adapter/repositories/issue/ApiV3CheerioRestIssueRepository.js +16 -0
  17. package/bin/adapter/repositories/issue/ApiV3CheerioRestIssueRepository.js.map +1 -1
  18. package/jest.config.js +57 -9
  19. package/package.json +17 -13
  20. package/src/adapter/entry-points/cli/index.test.ts +12 -2
  21. package/src/adapter/entry-points/cli/index.ts +30 -12
  22. package/src/adapter/entry-points/cli/projectConfig.ts +3 -0
  23. package/src/adapter/entry-points/console/consoleOperationApi.test.ts +129 -15
  24. package/src/adapter/entry-points/console/consoleOperationApi.ts +83 -28
  25. package/src/adapter/entry-points/console/consoleProjectResolver.test.ts +96 -0
  26. package/src/adapter/entry-points/console/consoleProjectResolver.ts +50 -0
  27. package/src/adapter/entry-points/console/consoleServer.test.ts +5 -4
  28. package/src/adapter/entry-points/console/consoleServer.ts +5 -7
  29. package/src/adapter/entry-points/console/ui/jest.setup.ts +1 -0
  30. package/src/adapter/entry-points/console/ui/jest.styleMock.js +1 -0
  31. package/src/adapter/entry-points/console/ui/src/features/console/colors.test.ts +34 -0
  32. package/src/adapter/entry-points/console/ui/src/features/console/colors.ts +73 -0
  33. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleChangedFileList.stories.tsx +28 -0
  34. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleChangedFileList.test.tsx +42 -0
  35. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleChangedFileList.tsx +55 -0
  36. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleCloseButtonGroup.stories.tsx +14 -0
  37. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleCloseButtonGroup.test.tsx +23 -0
  38. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleCloseButtonGroup.tsx +26 -0
  39. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleCommentList.stories.tsx +29 -0
  40. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleCommentList.test.tsx +55 -0
  41. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleCommentList.tsx +66 -0
  42. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleCommitList.stories.tsx +25 -0
  43. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleCommitList.test.tsx +53 -0
  44. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleCommitList.tsx +53 -0
  45. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleItemDetail.stories.tsx +79 -0
  46. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleItemDetail.test.tsx +81 -0
  47. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleItemDetail.tsx +226 -0
  48. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleItemIcon.stories.tsx +82 -0
  49. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleItemIcon.test.tsx +52 -0
  50. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleItemIcon.tsx +32 -0
  51. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleListItemRow.stories.tsx +25 -0
  52. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleListItemRow.test.tsx +43 -0
  53. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleListItemRow.tsx +34 -0
  54. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleListView.stories.tsx +22 -6
  55. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleListView.test.tsx +87 -0
  56. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleListView.tsx +36 -32
  57. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleMarkdownView.stories.tsx +27 -0
  58. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleMarkdownView.test.tsx +36 -0
  59. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleMarkdownView.tsx +50 -0
  60. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleMermaidDiagram.stories.tsx +22 -0
  61. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleMermaidDiagram.test.tsx +38 -0
  62. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleMermaidDiagram.tsx +65 -0
  63. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleNextActionDateGroup.stories.tsx +20 -0
  64. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleNextActionDateGroup.test.tsx +42 -0
  65. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleNextActionDateGroup.tsx +28 -0
  66. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleOperationBar.stories.tsx +55 -0
  67. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleOperationBar.test.tsx +85 -0
  68. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleOperationBar.tsx +55 -0
  69. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsolePanel.stories.tsx +26 -0
  70. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsolePanel.test.tsx +32 -0
  71. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsolePanel.tsx +36 -0
  72. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleProjectHeader.test.tsx +14 -0
  73. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsolePullRequestReviewGroup.stories.tsx +14 -0
  74. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsolePullRequestReviewGroup.test.tsx +33 -0
  75. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsolePullRequestReviewGroup.tsx +34 -0
  76. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsolePullRequestSection.stories.tsx +31 -0
  77. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsolePullRequestSection.test.tsx +40 -0
  78. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsolePullRequestSection.tsx +88 -0
  79. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleStatusButtonGroup.stories.tsx +17 -0
  80. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleStatusButtonGroup.test.tsx +49 -0
  81. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleStatusButtonGroup.tsx +63 -0
  82. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleStoryButtonGroup.stories.tsx +17 -0
  83. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleStoryButtonGroup.test.tsx +45 -0
  84. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleStoryButtonGroup.tsx +42 -0
  85. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleStoryGroupHeader.stories.tsx +27 -0
  86. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleStoryGroupHeader.test.tsx +24 -0
  87. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleStoryGroupHeader.tsx +28 -0
  88. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleTabBar.stories.tsx +41 -5
  89. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleTabBar.test.tsx +59 -0
  90. package/src/adapter/entry-points/console/ui/src/features/console/components/ConsoleTabBar.tsx +28 -19
  91. package/src/adapter/entry-points/console/ui/src/features/console/fileStatus.test.ts +35 -0
  92. package/src/adapter/entry-points/console/ui/src/features/console/fileStatus.ts +21 -0
  93. package/src/adapter/entry-points/console/ui/src/features/console/fixtures.ts +206 -9
  94. package/src/adapter/entry-points/console/ui/src/features/console/grouping.test.ts +91 -0
  95. package/src/adapter/entry-points/console/ui/src/features/console/grouping.ts +79 -0
  96. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleCaches.test.ts +22 -0
  97. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleCaches.ts +42 -0
  98. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleItemDetailData.test.ts +126 -0
  99. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleItemDetailData.ts +167 -0
  100. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleOperations.test.ts +198 -0
  101. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleOperations.ts +243 -0
  102. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleOverlay.test.ts +40 -0
  103. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleOverlay.ts +71 -0
  104. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleResource.test.ts +41 -0
  105. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleResource.ts +57 -0
  106. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleTabData.test.ts +63 -0
  107. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleTabData.ts +129 -0
  108. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleToken.test.ts +41 -0
  109. package/src/adapter/entry-points/console/ui/src/features/console/itemIcons.test.ts +97 -0
  110. package/src/adapter/entry-points/console/ui/src/features/console/itemIcons.ts +95 -0
  111. package/src/adapter/entry-points/console/ui/src/features/console/lib/consoleApi.test.ts +155 -0
  112. package/src/adapter/entry-points/console/ui/src/features/console/lib/consoleApi.ts +187 -0
  113. package/src/adapter/entry-points/console/ui/src/features/console/lib/markdown.test.ts +76 -0
  114. package/src/adapter/entry-points/console/ui/src/features/console/lib/markdown.ts +73 -0
  115. package/src/adapter/entry-points/console/ui/src/features/console/lib/mermaidLoader.test.ts +27 -0
  116. package/src/adapter/entry-points/console/ui/src/features/console/lib/mermaidLoader.ts +71 -0
  117. package/src/adapter/entry-points/console/ui/src/features/console/lib/resourceCache.test.ts +56 -0
  118. package/src/adapter/entry-points/console/ui/src/features/console/lib/resourceCache.ts +51 -0
  119. package/src/adapter/entry-points/console/ui/src/features/console/operations.test.ts +37 -0
  120. package/src/adapter/entry-points/console/ui/src/features/console/operations.ts +35 -0
  121. package/src/adapter/entry-points/console/ui/src/features/console/overlay.test.ts +124 -0
  122. package/src/adapter/entry-points/console/ui/src/features/console/overlay.ts +101 -0
  123. package/src/adapter/entry-points/console/ui/src/features/console/pages/ConsoleItemDetailContainer.test.tsx +79 -0
  124. package/src/adapter/entry-points/console/ui/src/features/console/pages/ConsoleItemDetailContainer.tsx +109 -0
  125. package/src/adapter/entry-points/console/ui/src/features/console/pages/ConsolePage.test.tsx +74 -0
  126. package/src/adapter/entry-points/console/ui/src/features/console/pages/ConsolePage.tsx +133 -7
  127. package/src/adapter/entry-points/console/ui/src/features/console/relativeTime.test.ts +52 -0
  128. package/src/adapter/entry-points/console/ui/src/features/console/relativeTime.ts +51 -0
  129. package/src/adapter/entry-points/console/ui/src/features/console/types.ts +73 -1
  130. package/src/adapter/entry-points/console/ui/src/index.css +352 -2
  131. package/src/adapter/entry-points/console/ui/tsconfig.json +1 -0
  132. package/src/adapter/entry-points/console/ui/vite.config.ts +5 -0
  133. package/src/adapter/entry-points/console/ui-dist/assets/index-BU6p3cGU.css +1 -0
  134. package/src/adapter/entry-points/console/ui-dist/assets/index-BvuSQN9s.js +100 -0
  135. package/src/adapter/entry-points/console/ui-dist/index.html +2 -2
  136. package/src/adapter/repositories/issue/ApiV3CheerioRestIssueRepository.ts +25 -0
  137. package/src/domain/usecases/adapter-interfaces/IssueRepository.ts +4 -0
  138. package/types/adapter/entry-points/cli/index.d.ts.map +1 -1
  139. package/types/adapter/entry-points/cli/projectConfig.d.ts +1 -0
  140. package/types/adapter/entry-points/cli/projectConfig.d.ts.map +1 -1
  141. package/types/adapter/entry-points/console/consoleOperationApi.d.ts +6 -2
  142. package/types/adapter/entry-points/console/consoleOperationApi.d.ts.map +1 -1
  143. package/types/adapter/entry-points/console/consoleProjectResolver.d.ts +6 -0
  144. package/types/adapter/entry-points/console/consoleProjectResolver.d.ts.map +1 -0
  145. package/types/adapter/entry-points/console/consoleServer.d.ts +2 -3
  146. package/types/adapter/entry-points/console/consoleServer.d.ts.map +1 -1
  147. package/types/adapter/repositories/issue/ApiV3CheerioRestIssueRepository.d.ts +1 -0
  148. package/types/adapter/repositories/issue/ApiV3CheerioRestIssueRepository.d.ts.map +1 -1
  149. package/types/domain/usecases/adapter-interfaces/IssueRepository.d.ts +1 -0
  150. package/types/domain/usecases/adapter-interfaces/IssueRepository.d.ts.map +1 -1
  151. package/bin/adapter/entry-points/console/ui-dist/assets/index-DDjYPXRT.js +0 -49
  152. package/bin/adapter/entry-points/console/ui-dist/assets/index-DHlBLm7d.css +0 -1
  153. package/src/adapter/entry-points/console/ui/src/features/console/hooks/useConsoleList.ts +0 -78
  154. package/src/adapter/entry-points/console/ui-dist/assets/index-DDjYPXRT.js +0 -49
  155. package/src/adapter/entry-points/console/ui-dist/assets/index-DHlBLm7d.css +0 -1
@@ -0,0 +1,66 @@
1
+ import { useState } from 'react';
2
+ import { formatRelativeTime } from '../relativeTime';
3
+ import type { ConsoleComment } from '../types';
4
+ import { ConsoleMarkdownView } from './ConsoleMarkdownView';
5
+
6
+ export type ConsoleCommentListProps = {
7
+ comments: ConsoleComment[];
8
+ isLoading: boolean;
9
+ error: string | null;
10
+ now: number;
11
+ };
12
+
13
+ export const ConsoleCommentList = ({
14
+ comments,
15
+ isLoading,
16
+ error,
17
+ now,
18
+ }: ConsoleCommentListProps) => {
19
+ const [showAll, setShowAll] = useState<boolean>(false);
20
+
21
+ if (error !== null) {
22
+ return (
23
+ <p role="alert" className="console-comment-error">
24
+ Failed to load comments: {error}
25
+ </p>
26
+ );
27
+ }
28
+
29
+ if (isLoading) {
30
+ return <p className="console-comment-loading">Loading comments...</p>;
31
+ }
32
+
33
+ if (comments.length === 0) {
34
+ return <p className="console-comment-empty">No comments.</p>;
35
+ }
36
+
37
+ const visible = showAll ? comments : comments.slice(-1);
38
+
39
+ return (
40
+ <div className="console-comment-list">
41
+ {!showAll && comments.length > 1 && (
42
+ <button
43
+ type="button"
44
+ className="console-comment-show-all"
45
+ onClick={() => setShowAll(true)}
46
+ >
47
+ Show all {comments.length}
48
+ </button>
49
+ )}
50
+ {visible.map((comment) => (
51
+ <article
52
+ key={`${comment.author}:${comment.createdAt}:${comment.body}`}
53
+ className="console-comment"
54
+ >
55
+ <header className="console-comment-header">
56
+ <span className="console-comment-author">{comment.author}</span>
57
+ <span className="console-comment-time">
58
+ {formatRelativeTime(comment.createdAt, now)}
59
+ </span>
60
+ </header>
61
+ <ConsoleMarkdownView body={comment.body} />
62
+ </article>
63
+ ))}
64
+ </div>
65
+ );
66
+ };
@@ -0,0 +1,25 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { consoleCommitsFixture } from '../fixtures';
3
+ import { ConsoleCommitList } from './ConsoleCommitList';
4
+
5
+ const meta: Meta<typeof ConsoleCommitList> = {
6
+ title: 'Console/ConsoleCommitList',
7
+ component: ConsoleCommitList,
8
+ args: { now: Date.parse('2026-06-19T12:00:00.000Z') },
9
+ };
10
+
11
+ export default meta;
12
+
13
+ type Story = StoryObj<typeof ConsoleCommitList>;
14
+
15
+ export const WithCommits: Story = {
16
+ args: { commits: consoleCommitsFixture, isLoading: false, error: null },
17
+ };
18
+
19
+ export const Loading: Story = {
20
+ args: { commits: [], isLoading: true, error: null },
21
+ };
22
+
23
+ export const Empty: Story = {
24
+ args: { commits: [], isLoading: false, error: null },
25
+ };
@@ -0,0 +1,53 @@
1
+ import { render } from '@testing-library/react';
2
+ import { consoleCommitsFixture } from '../fixtures';
3
+ import { ConsoleCommitList } from './ConsoleCommitList';
4
+
5
+ const now = Date.parse('2026-06-19T12:00:00.000Z');
6
+
7
+ describe('ConsoleCommitList', () => {
8
+ it('renders the first message line, short sha and author', () => {
9
+ const { getByText } = render(
10
+ <ConsoleCommitList
11
+ commits={consoleCommitsFixture}
12
+ isLoading={false}
13
+ error={null}
14
+ now={now}
15
+ />,
16
+ );
17
+ expect(
18
+ getByText('feat(console): add serveConsole subcommand and HTTP server'),
19
+ ).toBeInTheDocument();
20
+ expect(getByText('4f9c2a1')).toBeInTheDocument();
21
+ });
22
+
23
+ it('shows the loading state', () => {
24
+ const { getByText } = render(
25
+ <ConsoleCommitList commits={[]} isLoading error={null} now={now} />,
26
+ );
27
+ expect(getByText('Loading commits...')).toBeInTheDocument();
28
+ });
29
+
30
+ it('shows the empty state', () => {
31
+ const { getByText } = render(
32
+ <ConsoleCommitList
33
+ commits={[]}
34
+ isLoading={false}
35
+ error={null}
36
+ now={now}
37
+ />,
38
+ );
39
+ expect(getByText('No commits.')).toBeInTheDocument();
40
+ });
41
+
42
+ it('shows the error state', () => {
43
+ const { getByRole } = render(
44
+ <ConsoleCommitList
45
+ commits={[]}
46
+ isLoading={false}
47
+ error="HTTP 500"
48
+ now={now}
49
+ />,
50
+ );
51
+ expect(getByRole('alert')).toHaveTextContent('HTTP 500');
52
+ });
53
+ });
@@ -0,0 +1,53 @@
1
+ import { formatRelativeTime } from '../relativeTime';
2
+ import type { ConsoleCommit } from '../types';
3
+
4
+ export type ConsoleCommitListProps = {
5
+ commits: ConsoleCommit[];
6
+ isLoading: boolean;
7
+ error: string | null;
8
+ now: number;
9
+ };
10
+
11
+ const shortSha = (sha: string): string => sha.slice(0, 7);
12
+
13
+ const firstLine = (message: string): string => message.split('\n')[0];
14
+
15
+ export const ConsoleCommitList = ({
16
+ commits,
17
+ isLoading,
18
+ error,
19
+ now,
20
+ }: ConsoleCommitListProps) => {
21
+ if (error !== null) {
22
+ return (
23
+ <p role="alert" className="console-commits-error">
24
+ Failed to load commits: {error}
25
+ </p>
26
+ );
27
+ }
28
+
29
+ if (isLoading) {
30
+ return <p className="console-commits-loading">Loading commits...</p>;
31
+ }
32
+
33
+ if (commits.length === 0) {
34
+ return <p className="console-commits-empty">No commits.</p>;
35
+ }
36
+
37
+ return (
38
+ <ul className="console-commits">
39
+ {commits.map((commit) => (
40
+ <li key={commit.sha} className="console-commit">
41
+ <span className="console-commit-message">
42
+ {firstLine(commit.message)}
43
+ </span>
44
+ <span className="console-commit-sha">{shortSha(commit.sha)}</span>
45
+ <span className="console-commit-author">{commit.author}</span>
46
+ <span className="console-commit-time">
47
+ {formatRelativeTime(commit.authoredAt, now)}
48
+ </span>
49
+ </li>
50
+ ))}
51
+ </ul>
52
+ );
53
+ };
@@ -0,0 +1,79 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import {
3
+ consoleChangedFilesFixture,
4
+ consoleCommentsFixture,
5
+ consoleCommitsFixture,
6
+ consoleListItemsFixture,
7
+ consoleMermaidBodyFixture,
8
+ consoleRelatedPullRequestsFixture,
9
+ } from '../fixtures';
10
+ import { ConsoleItemDetail } from './ConsoleItemDetail';
11
+
12
+ const meta: Meta<typeof ConsoleItemDetail> = {
13
+ title: 'Console/ConsoleItemDetail',
14
+ component: ConsoleItemDetail,
15
+ args: {
16
+ now: Date.parse('2026-06-19T12:00:00.000Z'),
17
+ operationBar: null,
18
+ },
19
+ };
20
+
21
+ export default meta;
22
+
23
+ type Story = StoryObj<typeof ConsoleItemDetail>;
24
+
25
+ export const PullRequestItem: Story = {
26
+ args: {
27
+ item: consoleListItemsFixture[0],
28
+ storyName: 'TDPM Console port',
29
+ storyColorEnum: 'BLUE',
30
+ overlayStatus: null,
31
+ state: { state: 'open', merged: false, isPullRequest: true },
32
+ body: consoleMermaidBodyFixture,
33
+ bodyIsLoading: false,
34
+ bodyError: null,
35
+ comments: consoleCommentsFixture,
36
+ commentsAreLoading: false,
37
+ commentsError: null,
38
+ files: consoleChangedFilesFixture,
39
+ filesAreLoading: false,
40
+ filesError: null,
41
+ commits: consoleCommitsFixture,
42
+ commitsAreLoading: false,
43
+ commitsError: null,
44
+ relatedPullRequests: [],
45
+ },
46
+ };
47
+
48
+ export const IssueWithLinkedPullRequest: Story = {
49
+ args: {
50
+ item: consoleListItemsFixture[2],
51
+ storyName: 'TDPM Console port',
52
+ storyColorEnum: 'BLUE',
53
+ overlayStatus: null,
54
+ state: { state: 'open', merged: false, isPullRequest: false },
55
+ body: '## Issue body\n\nThis issue has a linked pull request.',
56
+ bodyIsLoading: false,
57
+ bodyError: null,
58
+ comments: consoleCommentsFixture,
59
+ commentsAreLoading: false,
60
+ commentsError: null,
61
+ files: [],
62
+ filesAreLoading: false,
63
+ filesError: null,
64
+ commits: [],
65
+ commitsAreLoading: false,
66
+ commitsError: null,
67
+ relatedPullRequests: [
68
+ {
69
+ pullRequest: consoleRelatedPullRequestsFixture[0],
70
+ files: consoleChangedFilesFixture,
71
+ filesAreLoading: false,
72
+ filesError: null,
73
+ commits: consoleCommitsFixture,
74
+ commitsAreLoading: false,
75
+ commitsError: null,
76
+ },
77
+ ],
78
+ },
79
+ };
@@ -0,0 +1,81 @@
1
+ import { render } from '@testing-library/react';
2
+ import {
3
+ consoleChangedFilesFixture,
4
+ consoleCommentsFixture,
5
+ consoleCommitsFixture,
6
+ consoleListItemsFixture,
7
+ } from '../fixtures';
8
+ import { ConsoleItemDetail } from './ConsoleItemDetail';
9
+
10
+ jest.mock('../lib/mermaidLoader', () => ({
11
+ renderMermaidToSvg: jest.fn(async () => '<svg></svg>'),
12
+ }));
13
+
14
+ const now = Date.parse('2026-06-19T12:00:00.000Z');
15
+ const prItem = consoleListItemsFixture[0];
16
+ const issueItem = consoleListItemsFixture[2];
17
+
18
+ const baseProps = {
19
+ storyName: 'TDPM Console port',
20
+ storyColorEnum: 'BLUE' as const,
21
+ overlayStatus: null,
22
+ state: { state: 'open', merged: false, isPullRequest: true },
23
+ body: '## Body heading',
24
+ bodyIsLoading: false,
25
+ bodyError: null,
26
+ comments: consoleCommentsFixture,
27
+ commentsAreLoading: false,
28
+ commentsError: null,
29
+ files: consoleChangedFilesFixture,
30
+ filesAreLoading: false,
31
+ filesError: null,
32
+ commits: consoleCommitsFixture,
33
+ commitsAreLoading: false,
34
+ commitsError: null,
35
+ relatedPullRequests: [],
36
+ now,
37
+ operationBar: <div>operation-bar</div>,
38
+ };
39
+
40
+ describe('ConsoleItemDetail', () => {
41
+ it('renders the PR title with the PR number, sub bar and changed files panel', () => {
42
+ const { getByText, getAllByText } = render(
43
+ <ConsoleItemDetail item={prItem} {...baseProps} />,
44
+ );
45
+ expect(getAllByText(`PR #${prItem.number}`).length).toBeGreaterThan(0);
46
+ expect(getByText('Changed files')).toBeInTheDocument();
47
+ expect(getByText('Commits')).toBeInTheDocument();
48
+ expect(getByText('operation-bar')).toBeInTheDocument();
49
+ });
50
+
51
+ it('renders the story tag and opened relative time', () => {
52
+ const { getByText } = render(
53
+ <ConsoleItemDetail item={prItem} {...baseProps} />,
54
+ );
55
+ expect(getByText('TDPM Console port')).toBeInTheDocument();
56
+ expect(getByText(/opened/)).toBeInTheDocument();
57
+ });
58
+
59
+ it('renders an issue without the changed files or commits panels', () => {
60
+ const { queryByText } = render(
61
+ <ConsoleItemDetail
62
+ item={issueItem}
63
+ {...baseProps}
64
+ state={{ state: 'open', merged: false, isPullRequest: false }}
65
+ />,
66
+ );
67
+ expect(queryByText('Changed files')).toBeNull();
68
+ expect(queryByText('Commits')).toBeNull();
69
+ });
70
+
71
+ it('renders the overlay status chip when set', () => {
72
+ const { getByText } = render(
73
+ <ConsoleItemDetail
74
+ item={issueItem}
75
+ {...baseProps}
76
+ overlayStatus={{ name: 'Awaiting Workspace', color: 'BLUE' }}
77
+ />,
78
+ );
79
+ expect(getByText('Awaiting Workspace')).toBeInTheDocument();
80
+ });
81
+ });
@@ -0,0 +1,226 @@
1
+ import type { ReactNode } from 'react';
2
+ import { colorFromEnum } from '../colors';
3
+ import { formatFullTimestamp, formatRelativeTime } from '../relativeTime';
4
+ import type {
5
+ ConsoleChangedFile,
6
+ ConsoleColor,
7
+ ConsoleComment,
8
+ ConsoleCommit,
9
+ ConsoleIssueState,
10
+ ConsoleListItem,
11
+ ConsoleOverlayStatus,
12
+ ConsoleRelatedPullRequest,
13
+ } from '../types';
14
+ import { ConsoleChangedFileList } from './ConsoleChangedFileList';
15
+ import { ConsoleCommentList } from './ConsoleCommentList';
16
+ import { ConsoleCommitList } from './ConsoleCommitList';
17
+ import { ConsoleItemIcon } from './ConsoleItemIcon';
18
+ import { ConsoleMarkdownView } from './ConsoleMarkdownView';
19
+ import { ConsolePanel } from './ConsolePanel';
20
+ import { ConsolePullRequestSection } from './ConsolePullRequestSection';
21
+
22
+ export type ConsoleRelatedPullRequestView = {
23
+ pullRequest: ConsoleRelatedPullRequest;
24
+ files: ConsoleChangedFile[];
25
+ filesAreLoading: boolean;
26
+ filesError: string | null;
27
+ commits: ConsoleCommit[];
28
+ commitsAreLoading: boolean;
29
+ commitsError: string | null;
30
+ };
31
+
32
+ export type ConsoleItemDetailProps = {
33
+ item: ConsoleListItem;
34
+ storyName: string | null;
35
+ storyColorEnum: ConsoleColor | null;
36
+ overlayStatus: ConsoleOverlayStatus | null;
37
+ state: ConsoleIssueState | null;
38
+ body: string;
39
+ bodyIsLoading: boolean;
40
+ bodyError: string | null;
41
+ comments: ConsoleComment[];
42
+ commentsAreLoading: boolean;
43
+ commentsError: string | null;
44
+ files: ConsoleChangedFile[];
45
+ filesAreLoading: boolean;
46
+ filesError: string | null;
47
+ commits: ConsoleCommit[];
48
+ commitsAreLoading: boolean;
49
+ commitsError: string | null;
50
+ relatedPullRequests: ConsoleRelatedPullRequestView[];
51
+ now: number;
52
+ operationBar: ReactNode;
53
+ };
54
+
55
+ export const ConsoleItemDetail = ({
56
+ item,
57
+ storyName,
58
+ storyColorEnum,
59
+ overlayStatus,
60
+ state,
61
+ body,
62
+ bodyIsLoading,
63
+ bodyError,
64
+ comments,
65
+ commentsAreLoading,
66
+ commentsError,
67
+ files,
68
+ filesAreLoading,
69
+ filesError,
70
+ commits,
71
+ commitsAreLoading,
72
+ commitsError,
73
+ relatedPullRequests,
74
+ now,
75
+ operationBar,
76
+ }: ConsoleItemDetailProps) => {
77
+ const resolvedState = state?.state ?? 'open';
78
+ const merged = state?.merged ?? false;
79
+ const closedStateLabel =
80
+ !item.isPr && resolvedState === 'closed' ? 'Closed' : null;
81
+ const storyPalette = colorFromEnum(storyColorEnum);
82
+ const statusPalette = overlayStatus
83
+ ? colorFromEnum(overlayStatus.color)
84
+ : null;
85
+
86
+ return (
87
+ <article className="console-detail">
88
+ {storyName !== null && (
89
+ <div className="console-detail-story">
90
+ <span className="console-storytag">
91
+ <span
92
+ className="console-story-dot"
93
+ style={{ backgroundColor: storyPalette.dot }}
94
+ />
95
+ {storyName}
96
+ </span>
97
+ </div>
98
+ )}
99
+
100
+ {overlayStatus !== null && statusPalette !== null && (
101
+ <span
102
+ className="console-detail-status-chip"
103
+ style={{
104
+ color: statusPalette.fg,
105
+ borderColor: statusPalette.border,
106
+ backgroundColor: statusPalette.bg,
107
+ }}
108
+ >
109
+ {overlayStatus.name}
110
+ </span>
111
+ )}
112
+
113
+ <h2 className="console-detail-title">
114
+ <ConsoleItemIcon
115
+ isPr={item.isPr}
116
+ state={resolvedState}
117
+ merged={merged}
118
+ isDraft={false}
119
+ stateReason=""
120
+ />
121
+ <span className="console-detail-title-text">{item.title}</span>
122
+ <span className="console-detail-number">
123
+ {item.isPr ? `PR #${item.number}` : `#${item.number}`}
124
+ </span>
125
+ {closedStateLabel !== null && (
126
+ <span className="console-detail-closed-label">
127
+ {closedStateLabel}
128
+ </span>
129
+ )}
130
+ </h2>
131
+
132
+ <div className="console-detail-subbar">
133
+ <a
134
+ href={item.url}
135
+ className="console-detail-link"
136
+ target="_blank"
137
+ rel="noopener noreferrer"
138
+ >
139
+ {item.isPr ? `PR #${item.number}` : `Issue #${item.number}`}
140
+ </a>
141
+ <span className="console-detail-repo">{item.repo}</span>
142
+ <span className="console-detail-pill">
143
+ {item.isPr ? 'PR' : 'Issue'}
144
+ </span>
145
+ </div>
146
+
147
+ {item.labels.length > 0 && (
148
+ <div className="console-detail-labels">
149
+ {item.labels.map((label) => (
150
+ <span key={label} className="console-label-chip">
151
+ {label}
152
+ </span>
153
+ ))}
154
+ </div>
155
+ )}
156
+
157
+ <div
158
+ className="console-detail-createdat"
159
+ title={formatFullTimestamp(item.createdAt)}
160
+ >
161
+ opened {formatRelativeTime(item.createdAt, now)}
162
+ </div>
163
+
164
+ <ConsolePanel title="Description">
165
+ {bodyError !== null ? (
166
+ <p role="alert" className="console-detail-body-error">
167
+ Failed to load description: {bodyError}
168
+ </p>
169
+ ) : bodyIsLoading ? (
170
+ <p className="console-detail-body-loading">Loading description...</p>
171
+ ) : (
172
+ <ConsoleMarkdownView body={body} />
173
+ )}
174
+ </ConsolePanel>
175
+
176
+ {item.isPr && (
177
+ <ConsolePanel title="Changed files">
178
+ <ConsoleChangedFileList
179
+ files={files}
180
+ isLoading={filesAreLoading}
181
+ error={filesError}
182
+ />
183
+ </ConsolePanel>
184
+ )}
185
+
186
+ <ConsolePanel title="Comments" defaultCollapsed={item.isPr}>
187
+ <ConsoleCommentList
188
+ comments={comments}
189
+ isLoading={commentsAreLoading}
190
+ error={commentsError}
191
+ now={now}
192
+ />
193
+ </ConsolePanel>
194
+
195
+ {item.isPr && (
196
+ <ConsolePanel title="Commits" defaultCollapsed>
197
+ <ConsoleCommitList
198
+ commits={commits}
199
+ isLoading={commitsAreLoading}
200
+ error={commitsError}
201
+ now={now}
202
+ />
203
+ </ConsolePanel>
204
+ )}
205
+
206
+ {!item.isPr &&
207
+ relatedPullRequests.map((related) => (
208
+ <ConsolePullRequestSection
209
+ key={related.pullRequest.url}
210
+ pullRequest={related.pullRequest}
211
+ body={related.pullRequest.summary?.body ?? ''}
212
+ bodyIsLoading={false}
213
+ files={related.files}
214
+ filesAreLoading={related.filesAreLoading}
215
+ filesError={related.filesError}
216
+ commits={related.commits}
217
+ commitsAreLoading={related.commitsAreLoading}
218
+ commitsError={related.commitsError}
219
+ now={now}
220
+ />
221
+ ))}
222
+
223
+ <div className="console-detail-operations">{operationBar}</div>
224
+ </article>
225
+ );
226
+ };
@@ -0,0 +1,82 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-vite';
2
+ import { ConsoleItemIcon } from './ConsoleItemIcon';
3
+
4
+ const meta: Meta<typeof ConsoleItemIcon> = {
5
+ title: 'Console/ConsoleItemIcon',
6
+ component: ConsoleItemIcon,
7
+ args: { size: 20 },
8
+ };
9
+
10
+ export default meta;
11
+
12
+ type Story = StoryObj<typeof ConsoleItemIcon>;
13
+
14
+ export const PullRequestOpen: Story = {
15
+ args: {
16
+ isPr: true,
17
+ state: 'open',
18
+ merged: false,
19
+ isDraft: false,
20
+ stateReason: '',
21
+ },
22
+ };
23
+
24
+ export const PullRequestMerged: Story = {
25
+ args: {
26
+ isPr: true,
27
+ state: 'closed',
28
+ merged: true,
29
+ isDraft: false,
30
+ stateReason: '',
31
+ },
32
+ };
33
+
34
+ export const PullRequestClosed: Story = {
35
+ args: {
36
+ isPr: true,
37
+ state: 'closed',
38
+ merged: false,
39
+ isDraft: false,
40
+ stateReason: '',
41
+ },
42
+ };
43
+
44
+ export const PullRequestDraft: Story = {
45
+ args: {
46
+ isPr: true,
47
+ state: 'open',
48
+ merged: false,
49
+ isDraft: true,
50
+ stateReason: '',
51
+ },
52
+ };
53
+
54
+ export const IssueOpen: Story = {
55
+ args: {
56
+ isPr: false,
57
+ state: 'open',
58
+ merged: false,
59
+ isDraft: false,
60
+ stateReason: '',
61
+ },
62
+ };
63
+
64
+ export const IssueClosedCompleted: Story = {
65
+ args: {
66
+ isPr: false,
67
+ state: 'closed',
68
+ merged: false,
69
+ isDraft: false,
70
+ stateReason: 'completed',
71
+ },
72
+ };
73
+
74
+ export const IssueClosedNotPlanned: Story = {
75
+ args: {
76
+ isPr: false,
77
+ state: 'closed',
78
+ merged: false,
79
+ isDraft: false,
80
+ stateReason: 'not_planned',
81
+ },
82
+ };