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
2 changes: 1 addition & 1 deletion scripts/test-work-context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
import {
resetWorktreeBadgeColorAssignmentsForTest,
worktreeBadgeColor,
} from '../src/renderer/src/workspace/work-context/colors'
} from '../src/renderer/src/workspace/tile-tree/TileLeaf/worktreeBadgeColor'
import type { WorktreeIdentity } from '../src/shared/types/git'
import type { WorktreeActivityState } from '../src/shared/work-context/types'

Expand Down
93 changes: 0 additions & 93 deletions src/main/tmux/verify-tmux.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/renderer/src/features/debug/saveDebugBundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
recordHtmlTraceSnapshot,
recordScreenTailSnapshot,
} from '@renderer/features/debug/renderTrace'
import { summarizeWorktreeActivity } from '@renderer/workspace/work-context/debug'
import { summarizeWorktreeActivity } from '@shared/work-context/debug'

// saveDebugBundle — assemble-and-ship side of the "Save Debug Logs"
// command. Runs in the renderer because every data source the
Expand Down
23 changes: 0 additions & 23 deletions src/renderer/src/features/settings/commands/dangerousActions.ts

This file was deleted.

21 changes: 19 additions & 2 deletions src/renderer/src/features/settings/commands/dangerousCommands.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,22 @@
import type { CommandDef } from '@renderer/features/command-palette/types'
import { toggleDangerousAgents } from '@renderer/features/settings/commands/dangerousActions'
import type { CommandContext, CommandDef } from '@renderer/features/command-palette/types'

// WHY this lives in dangerousCommands.ts and not in a sibling
// dangerousActions module: there used to be a `dangerousActions` file
// that exported three runners (enable / disable / toggle) plus a shared
// helper, but only `toggleDangerousAgents` was ever wired into a
// CommandDef. Keeping the toggle next to its sole consumer collapses
// two files into one without losing the non-obvious sequencing
// constraint below: we MUST flip the flag, close the palette, then
// await reloadAgentSessions in that exact order. Reversing them races
// a still-visible palette against the reload and the new flag value
// never reaches the next-spawned agent session.
async function toggleDangerousAgents(ctx: CommandContext): Promise<void> {
const next = !ctx.flags.dangerousAgentsEnabled
if (ctx.flags.dangerousAgentsEnabled === next) return
ctx.ui.setDangerousAgentsEnabled(next)
ctx.ui.closePalette()
await ctx.workspace.reloadAgentSessions(next)
}

export const dangerousCommands: CommandDef[] = [
{
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/src/workspace/hook/actions/history.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import {
import {
deriveAgentWorkContext,
ingestWorktreeRawEvent,
} from '@renderer/workspace/work-context/tracker'
} from '@shared/work-context/tracker'

import type { WorkspaceSetRuntimes } from '@renderer/workspace/hook/context'
import type { WorkspaceRefs } from '@renderer/workspace/hook/refs'
Expand Down
2 changes: 1 addition & 1 deletion src/renderer/src/workspace/hook/actions/initialHistory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import {
import {
deriveAgentWorkContext,
ingestWorktreeRawEvent,
} from '@renderer/workspace/work-context/tracker'
} from '@shared/work-context/tracker'

import type { WorkspaceSetRuntimes } from '@renderer/workspace/hook/context'
import type { WorkspaceRefs } from '@renderer/workspace/hook/refs'
Expand Down
6 changes: 3 additions & 3 deletions src/renderer/src/workspace/hook/ipc/useIpcSubscriptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ import {
} from '@renderer/workspace/ghosts'
import type { StreamPhase } from '@renderer/workspace/workspaceState'
import type { ProviderConditionSnapshot } from '@shared/types/providerConditions'
import type { WorktreeIdentity } from '@renderer/workspace/work-context/types'
import type { WorktreeIdentity } from '@shared/work-context/types'
import {
canonicalizeWorktreeActivity,
deriveAgentWorkContext,
ingestWorktreeRawEvent,
withFallbackWorktreeActivity,
} from '@renderer/workspace/work-context/tracker'
import { summarizeWorktreeActivity } from '@renderer/workspace/work-context/debug'
} from '@shared/work-context/tracker'
import { summarizeWorktreeActivity } from '@shared/work-context/debug'

import type {
WorkspaceSetRuntimes,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import type { SessionKind } from '@renderer/workspace/types'
import type {
AgentWorkContext,
WorktreeActivityState,
} from '@renderer/workspace/work-context/types'
} from '@shared/work-context/types'

// Scroll position indicator — sits just above the composer,
// right-aligned. Shows which entry you're looking at out of the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import type { SessionKind } from '@renderer/workspace/types'
import type {
AgentWorkContext,
WorktreeActivityState,
} from '@renderer/workspace/work-context/types'
import { worktreeBadgeColor } from '@renderer/workspace/work-context/colors'
} from '@shared/work-context/types'
import { worktreeBadgeColor } from '@renderer/workspace/tile-tree/TileLeaf/worktreeBadgeColor'

export function WorktreeBadge({
context,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
import type { AgentWorkContext } from '@renderer/workspace/work-context/types'
import type { AgentWorkContext } from '@shared/work-context/types'

// WHY this helper lives next to SessionBadges and not in a generic
// "colors" module under work-context: the consumer is the worktree
// badge rendered inside the tile-tree leaf — it has no relationship to
// the work-context machinery (matching, scoring, tracking) beyond
// reading the AgentWorkContext type. Keeping it colocated with the
// only UI that paints it makes future palette tweaks discoverable
// without grepping across the workspace tree.
//
// The two MAIN_BRANCH overrides exist so the most common case ("I am
// on main / master, not a worktree") does NOT consume a slot in the
// rotating palette. Otherwise the first user who opens main on a fresh
// install paints it teal forever, and every new worktree shifts the
// palette by one — confusing once you have several worktrees because
// the colors silently re-deal.

const MAIN_BRANCH_COLORS: Record<string, string> = {
main: '#2563eb',
Expand Down Expand Up @@ -38,6 +53,11 @@ const WORKTREE_PALETTE = [
'#075985',
] as const

// WHY a module-scoped Map and not a render-time computation: the same
// worktree path must keep the same color for the lifetime of the
// session. Recomputing on every render would shuffle the palette as
// dispatch order changes, which destroys the "blue means feature/foo"
// muscle memory the badge is supposed to enable.
const assignedPaletteIndexByWorktreePath = new Map<string, number>()

export function worktreeBadgeColor(
Expand Down
1 change: 0 additions & 1 deletion src/renderer/src/workspace/work-context/debug.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/renderer/src/workspace/work-context/extractors.ts

This file was deleted.

6 changes: 0 additions & 6 deletions src/renderer/src/workspace/work-context/index.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/renderer/src/workspace/work-context/matching.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/renderer/src/workspace/work-context/reducer.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/renderer/src/workspace/work-context/scoring.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/renderer/src/workspace/work-context/tracker.ts

This file was deleted.

1 change: 0 additions & 1 deletion src/renderer/src/workspace/work-context/types.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/renderer/src/workspace/workspaceState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import type { GhostEntry } from 'agent-transcript-parser/ghost'
import type {
AgentWorkContext,
WorktreeActivityState,
} from '@renderer/workspace/work-context/types'
} from '@shared/work-context/types'
import type { ProviderConditionSnapshot } from '@shared/types/providerConditions'

export type PickerItem = {
Expand Down