Skip to content

Commit 592bfbd

Browse files
committed
fix(cli): resolve circular dependency by extracting types
- Create cli/src/types/store.ts for type definitions previously in chat-store.ts - Update 25+ files to import types from new location instead of state/chat-store.ts - Fixes circular dependency: chat-store → utils → chat-store - Dependency graph now flows: types/store (leaf) → utils → state/chat-store
1 parent e28dc4c commit 592bfbd

30 files changed

+201
-130
lines changed

cli/src/__tests__/bash-mode.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describe, test, expect, mock } from 'bun:test'
22

3-
import type { InputValue } from '../state/chat-store'
3+
import type { InputValue } from '../types/store'
44
import type { InputMode } from '../utils/input-modes'
55

66
/**

cli/src/app.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@ import { useTerminalFocus } from './hooks/use-terminal-focus'
1616
import { useTheme } from './hooks/use-theme'
1717
import { getProjectRoot } from './project-files'
1818
import { useChatHistoryStore } from './state/chat-history-store'
19-
import { useChatStore, type TopBannerType } from './state/chat-store'
19+
import { useChatStore } from './state/chat-store'
20+
import type { TopBannerType } from './types/store'
2021
import { findGitRoot } from './utils/git'
2122
import { openFileAtPath } from './utils/open-file'
2223
import { formatCwd } from './utils/path-helpers'

cli/src/commands/command-registry.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import { capturePendingAttachments } from '../utils/pending-attachments'
1818
import { getSkillByName } from '../utils/skill-registry'
1919

2020
import type { MultilineInputHandle } from '../components/multiline-input'
21-
import type { InputValue, PendingAttachment } from '../state/chat-store'
21+
import type { InputValue, PendingAttachment } from '../types/store'
2222
import type { ChatMessage } from '../types/chat'
2323
import type { SendMessageFn } from '../types/contracts/send-message'
2424
import type { User } from '../utils/auth'

cli/src/components/ask-user/components/accordion-question.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import { OptionsList } from './options-list'
99
import { QuestionHeader } from './question-header'
1010
import { getOptionLabel } from '../constants'
1111

12-
import type { AskUserQuestion } from '../../../state/chat-store'
12+
import type { AskUserQuestion } from '../../../types/store'
1313

1414
/** Answer state for a single question */
1515
export interface AccordionAnswer {

cli/src/components/ask-user/components/options-list.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { Button } from '../../button'
1212
import { CUSTOM_OPTION_INDEX, SYMBOLS } from '../constants'
1313

1414
import type { AccordionAnswer } from './accordion-question'
15-
import type { AskUserQuestion } from '../../../state/chat-store'
15+
import type { AskUserQuestion } from '../../../types/store'
1616

1717
export interface OptionsListProps {
1818
question: AskUserQuestion

cli/src/components/ask-user/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ import { useChatStore } from '../../state/chat-store'
1919
import { BORDER_CHARS } from '../../utils/ui-constants'
2020
import { Button } from '../button'
2121

22-
import type { AskUserQuestion } from '../../state/chat-store'
22+
import type { AskUserQuestion } from '../../types/store'
2323
import type { KeyEvent } from '@opentui/core'
2424

2525
export interface MultipleChoiceFormProps {

cli/src/components/chat-input-bar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { getInputModeConfig } from '../utils/input-modes'
1515
import { BORDER_CHARS } from '../utils/ui-constants'
1616

1717
import type { useTheme } from '../hooks/use-theme'
18-
import type { InputValue } from '../state/chat-store'
18+
import type { InputValue } from '../types/store'
1919
import type { AgentMode } from '../utils/constants'
2020

2121
type Theme = ReturnType<typeof useTheme>

cli/src/components/multiline-input.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import { clamp } from '../utils/math'
1717
import { supportsTruecolor } from '../utils/theme-system'
1818
import { calculateNewCursorPosition } from '../utils/word-wrap-utils'
1919

20-
import type { InputValue } from '../state/chat-store'
20+
import type { InputValue } from '../types/store'
2121
import type {
2222
KeyEvent,
2323
MouseEvent,

cli/src/components/pending-attachments-banner.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { TextAttachmentCard } from './text-attachment-card'
44
import { useTheme } from '../hooks/use-theme'
55
import { useChatStore } from '../state/chat-store'
66

7-
import type { PendingImageAttachment, PendingTextAttachment } from '../state/chat-store'
7+
import type { PendingImageAttachment, PendingTextAttachment } from '../types/store'
88

99
/**
1010
* Combined banner for both image and text attachments.

cli/src/components/pending-bash-message.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { TerminalCommandDisplay } from './terminal-command-display'
44
import { useTheme } from '../hooks/use-theme'
55
import { DASHED_BORDER_CHARS } from '../utils/ui-constants'
66

7-
import type { PendingBashMessage as PendingBashMessageType } from '../state/chat-store'
7+
import type { PendingBashMessage as PendingBashMessageType } from '../types/store'
88

99
interface PendingBashMessageProps {
1010
message: PendingBashMessageType

0 commit comments

Comments
 (0)