Skip to content

Commit 853e218

Browse files
committed
refactor: complete package-level import refactoring
Continue refactoring imports to use package-level paths in client components, hooks, and e2e tests. Update test imports to use shared apiClient instead of removed helper. Apply prettier formatting fixes. This ensures consistent imports across the codebase.
1 parent 7c7c2a1 commit 853e218

7 files changed

Lines changed: 17 additions & 14 deletions

File tree

src/web/client/components/App.tsx

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useState, useEffect, useCallback } from 'react'
2-
import type { PTYSessionInfo } from 'opencode-pty/shared/types'
2+
import type { PTYSessionInfo } from 'opencode-pty/web/shared/types'
33

44
import { useWebSocket } from '../hooks/useWebSocket.ts'
55
import { useSessionManager } from '../hooks/useSessionManager.ts'
@@ -37,11 +37,14 @@ export function App() {
3737
return
3838
}
3939
setActiveSession(autoSelected)
40-
api.session.buffer.raw({ id: autoSelected.id }).then((data) => {
41-
setRawOutput(data.raw)
42-
}).catch((error) => {
43-
console.error('Failed to fetch initial raw buffer for auto-selected session', error)
44-
})
40+
api.session.buffer
41+
.raw({ id: autoSelected.id })
42+
.then((data) => {
43+
setRawOutput(data.raw)
44+
})
45+
.catch((error) => {
46+
console.error('Failed to fetch initial raw buffer for auto-selected session', error)
47+
})
4548
},
4649
[]
4750
),

src/web/client/components/Sidebar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import type { PTYSessionInfo } from 'opencode-pty/shared/types'
1+
import type { PTYSessionInfo } from 'opencode-pty/web/shared/types'
22

33
interface SidebarProps {
44
sessions: PTYSessionInfo[]

src/web/client/hooks/useSessionManager.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { useCallback } from 'react'
2-
import type { PTYSessionInfo } from 'opencode-pty/shared/types'
2+
import type { PTYSessionInfo } from 'opencode-pty/web/shared/types'
33

44
import { api } from '../../shared/apiClient'
55

src/web/shared/apiClient.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Type-safe API client for making HTTP requests with compile-time validation
22
// Uses the structured routes to ensure correct methods and parameters
33

4-
import type { HealthResponse, PTYSessionInfo } from 'opencode-pty/shared/types'
4+
import type { HealthResponse, PTYSessionInfo } from 'opencode-pty/web/shared/types'
55
import { routes } from './routes'
66

77
// Extract path parameters from route pattern at compile time
@@ -147,8 +147,8 @@ export function createApiClient(baseUrl: string) {
147147
health: () =>
148148
apiFetchJson<typeof routes.health, 'GET', HealthResponse>(routes.health, {
149149
method: 'GET',
150-
baseUrl
151-
})
150+
baseUrl,
151+
}),
152152
} as const
153153
}
154154

src/web/shared/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,4 +112,4 @@ interface HealthResponse {
112112
websocket: { connections: number }
113113
memory?: { rss: number; heapUsed: number; heapTotal: number }
114114
responseTime?: number
115-
}
115+
}

test/e2e/buffer-extension.pw.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { test as extendedTest, expect } from './fixtures'
22
import type { Page } from '@playwright/test'
3-
import { createApiClient } from './helpers/apiClient'
3+
import { createApiClient } from 'opencode-pty/web/shared/apiClient'
44

55
/**
66
* Session and Terminal Helpers for E2E buffer extension tests

test/e2e/pty-buffer-readraw.pw.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import {
55
getSerializedContentByXtermSerializeAddon,
66
waitForTerminalRegex,
77
} from './xterm-test-helpers'
8-
import { createApiClient } from './helpers/apiClient'
8+
import { createApiClient } from 'opencode-pty/web/shared/apiClient'
99

1010
async function createSession(
1111
api: ReturnType<typeof createApiClient>,

0 commit comments

Comments
 (0)