Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/treebeard/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
},
"dependencies": {
"@dnd-kit/core": "^6.3.1",
"@dnd-kit/sortable": "^10.0.0",
"@dnd-kit/utilities": "^3.2.2",
"@mantine/core": "^7.17.0",
"@mantine/hooks": "^7.17.0",
Expand Down
1 change: 0 additions & 1 deletion packages/treebeard/src/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ describe('App', () => {
setPollInterval: vi.fn(async () => {}),
setAutoUpdateEnabled: vi.fn(async () => {}),
setUpdateCheckInterval: vi.fn(async () => {}),
reorderRepos: vi.fn(async () => {}),
setDefaultIde: vi.fn(async () => {})
})
})
Expand Down
27 changes: 5 additions & 22 deletions packages/treebeard/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import {
useSensor,
useSensors
} from '@dnd-kit/core'
import { arrayMove } from '@dnd-kit/sortable'
import { RepoDashboard } from './components/RepoDashboard'
import { WorkspaceDashboard } from './components/WorkspaceDashboard'
import { SettingsModal } from './components/SettingsModal'
Expand All @@ -34,7 +33,7 @@ import { useJiraDrag } from './hooks/useJiraDrag'
import { rpc } from './rpc'
import { WORKTREE_DRAG_PREFIX, WORKSPACE_TARGET_PREFIX } from './shared/workspace-dnd'
import type { DragEndEvent } from '@dnd-kit/core'
import type { DependencyStatus, RepoConfig } from './shared/types'
import type { DependencyStatus } from './shared/types'
import type { JiraIssueDragData } from './components/JiraIssueCard'

// Neon-blue palette tuned for dark backgrounds
Expand Down Expand Up @@ -80,7 +79,6 @@ export default function App() {
setPollInterval,
setAutoUpdateEnabled,
setUpdateCheckInterval,
reorderRepos,
setDefaultIde,
setRepoSetupCommands,
setJiraPanelOpen,
Expand All @@ -90,7 +88,6 @@ export default function App() {
const [search, setSearch] = useState('')
const [dependencyStatus, setDependencyStatus] = useState<DependencyStatus | null>(null)
const [jiraDropTargets, setJiraDropTargets] = useState<Record<string, string | null>>({})
const [orderedRepos, setOrderedRepos] = useState<RepoConfig[]>([])
const [panelWidth, setPanelWidth] = useState<number>(260)
const [workspaceAttachError, setWorkspaceAttachError] = useState<string | null>(null)

Expand All @@ -104,11 +101,6 @@ export default function App() {

const { issues: jiraIssues, loading: jiraLoading, refresh: refreshJira } = useMyJiraIssues(pollIntervalSec)

// Keep ordered repos in sync with config
useEffect(() => {
if (config) setOrderedRepos(config.repositories)
}, [config])

// Native mouse drag for Jira issues — works across AppShell panels
const handleJiraDrop = useCallback((repoId: string, data: JiraIssueDragData) => {
setJiraDropTargets((prev) => ({ ...prev, [repoId]: `${data.issueKey}-` }))
Expand All @@ -122,7 +114,7 @@ export default function App() {
const { isDragging: isDraggingJira, draggingKey, overRepoId, onMouseDown: onIssueMouseDown } =
useJiraDrag(handleJiraDrop)

// @dnd-kit coordinates repository reordering and worktree-to-workspace links.
// @dnd-kit coordinates worktree-to-workspace links.
const sensors = useSensors(useSensor(PointerSensor, { activationConstraint: { distance: 8 } }))

const handleWorkspaceAttach = useCallback(async (workspaceId: string, repoId: string, worktreePath: string) => {
Expand Down Expand Up @@ -154,16 +146,8 @@ export default function App() {
source.slice(separator + 1)
)
}
return
}
if (active.id === over.id) return
const oldIndex = orderedRepos.findIndex((r) => r.id === active.id)
const newIndex = orderedRepos.findIndex((r) => r.id === over.id)
if (oldIndex === -1 || newIndex === -1) return
const reordered = arrayMove(orderedRepos, oldIndex, newIndex)
setOrderedRepos(reordered)
void reorderRepos(reordered)
}, [handleWorkspaceAttach, orderedRepos, reorderRepos])
}, [handleWorkspaceAttach])

const loadDependencies = useCallback(async () => {
try {
Expand Down Expand Up @@ -308,7 +292,7 @@ export default function App() {
<Stack gap="xl">
<WorkspaceDashboard
workspaces={config.workspaces}
repositories={orderedRepos}
repositories={config.repositories}
pollIntervalSec={config.pollIntervalSec}
defaultIde={config.defaultIde}
search={search}
Expand All @@ -321,12 +305,11 @@ export default function App() {
<Text size="sm" c="dimmed">Manage worktrees across all configured repositories.</Text>
</div>
<RepoDashboard
repos={orderedRepos}
repos={config.repositories}
pollIntervalSec={config.pollIntervalSec}
fetchIntervalSec={config.fetchIntervalSec}
search={search}
defaultIde={config.defaultIde}
onReorder={(repos) => { setOrderedRepos(repos); void reorderRepos(repos) }}
isDraggingJira={isDraggingJira}
overRepoId={overRepoId}
jiraDropTargets={jiraDropTargets}
Expand Down
35 changes: 3 additions & 32 deletions packages/treebeard/src/components/RepoDashboard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,6 @@ vi.mock('@dnd-kit/core', () => ({
DragOverlay: ({ children }: { children: ReactNode }) => <div>{children}</div>
}))

vi.mock('@dnd-kit/sortable', () => ({
SortableContext: ({ children }: { children: ReactNode }) => <div>{children}</div>,
useSortable: () => ({
attributes: {},
listeners: {},
setNodeRef: () => {},
transform: null,
transition: null,
isDragging: false
}),
verticalListSortingStrategy: {},
arrayMove: <T,>(array: T[], from: number, to: number) => {
const copy = [...array]
const [item] = copy.splice(from, 1)
copy.splice(to, 0, item)
return copy
}
}))

vi.mock('@dnd-kit/utilities', () => ({
CSS: {
Transform: {
Expand Down Expand Up @@ -157,7 +138,6 @@ describe('RepoDashboard', () => {
fetchIntervalSec={300}
search={''}
defaultIde="vscode"
onReorder={() => {}}
isDraggingJira={false}
overRepoId={null}
jiraDropTargets={{}}
Expand Down Expand Up @@ -197,7 +177,6 @@ describe('RepoDashboard', () => {
fetchIntervalSec={300}
search={'feat'}
defaultIde="vscode"
onReorder={() => {}}
isDraggingJira={false}
overRepoId={null}
jiraDropTargets={{}}
Expand All @@ -216,7 +195,6 @@ describe('RepoDashboard', () => {
fetchIntervalSec={300}
search={'missing'}
defaultIde="vscode"
onReorder={() => {}}
isDraggingJira={false}
overRepoId={null}
jiraDropTargets={{}}
Expand All @@ -227,7 +205,7 @@ describe('RepoDashboard', () => {
expect(screen.queryByText('treebeard')).toBeNull()
})

it('renders active repositories before inactive repositories without showing main worktrees by default', async () => {
it('renders repositories alphabetically regardless of activity without showing main worktrees by default', async () => {
const repos: RepoConfig[] = [
{ id: 'repo-1', name: 'repo-one', path: '/repo-one' },
{ id: 'repo-2', name: 'repo-two', path: '/repo-two' },
Expand Down Expand Up @@ -270,7 +248,6 @@ describe('RepoDashboard', () => {
fetchIntervalSec={300}
search={''}
defaultIde="vscode"
onReorder={() => {}}
isDraggingJira={false}
overRepoId={null}
jiraDropTargets={{}}
Expand All @@ -280,10 +257,10 @@ describe('RepoDashboard', () => {

await waitFor(() => {
const names = screen.getAllByRole('heading', { level: 4 }).map((heading) => heading.textContent)
expect(names).toEqual(['repo-two', 'repo-three', 'repo-one', 'repo-four'])
expect(names).toEqual(['repo-four', 'repo-one', 'repo-three', 'repo-two'])
})

expect(screen.getAllByTestId('worktree-card').map((card) => card.textContent)).toEqual(['feat/two', 'feat/three'])
expect(screen.getAllByTestId('worktree-card').map((card) => card.textContent)).toEqual(['feat/three', 'feat/two'])
})

it('shows main status and action controls for inactive repositories without rendering a main card body', () => {
Expand Down Expand Up @@ -314,7 +291,6 @@ describe('RepoDashboard', () => {
fetchIntervalSec={300}
search={''}
defaultIde="vscode"
onReorder={() => {}}
isDraggingJira={false}
overRepoId={null}
jiraDropTargets={{}}
Expand Down Expand Up @@ -357,7 +333,6 @@ describe('RepoDashboard', () => {
fetchIntervalSec={300}
search=""
defaultIde="vscode"
onReorder={() => {}}
isDraggingJira={false}
overRepoId={null}
jiraDropTargets={{}}
Expand All @@ -379,7 +354,6 @@ describe('RepoDashboard', () => {
fetchIntervalSec={300}
search=""
defaultIde="vscode"
onReorder={() => {}}
isDraggingJira={false}
overRepoId={null}
jiraDropTargets={{}}
Expand Down Expand Up @@ -424,7 +398,6 @@ describe('RepoDashboard', () => {
fetchIntervalSec={300}
search=""
defaultIde="vscode"
onReorder={() => {}}
isDraggingJira={false}
overRepoId={null}
jiraDropTargets={{}}
Expand Down Expand Up @@ -471,7 +444,6 @@ describe('RepoDashboard', () => {
fetchIntervalSec={300}
search={''}
defaultIde="intellij"
onReorder={() => {}}
isDraggingJira={false}
overRepoId={null}
jiraDropTargets={{}}
Expand Down Expand Up @@ -512,7 +484,6 @@ describe('RepoDashboard', () => {
fetchIntervalSec={300}
search={'main'}
defaultIde="vscode"
onReorder={() => {}}
isDraggingJira={false}
overRepoId={null}
jiraDropTargets={{}}
Expand Down
Loading
Loading