Skip to content

Crates#54

Merged
matej21 merged 34 commits intomainfrom
crates
Mar 23, 2026
Merged

Crates#54
matej21 merged 34 commits intomainfrom
crates

Conversation

@matej21
Copy link
Copy Markdown
Member

@matej21 matej21 commented Mar 21, 2026

No description provided.

matej21 and others added 10 commits March 22, 2026 00:21
The RemoteDiffProvider was sending the full prefixed project ID
(remote:connection_id:actual_id) to the remote server, which only
knows local project IDs, causing a 400 "not found" error.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Replace per-service port detection polling with a single centralized
  poller that calls ss/lsof/netstat once per cycle and distributes
  results to all services (N calls → 1)
- Replace recursive pgrep -P (macOS) and per-PID wmic (Windows) with
  single-call process tree building (ps -eo pid,ppid / wmic CSV)
- Only notify UI in docker status poller when state actually changes

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move terminal emulation, PTY management, shell config, session backends,
and input handling into a standalone crate (crates/okena-terminal/).

Key changes:
- Replace PtyBroadcaster dependency with PtyOutputSink trait
- Make input.rs framework-agnostic (own KeyEvent/KeyModifiers types)
- Add thin GPUI adapter (gpui_key_to_bytes) in main app
- Re-export from src/terminal/mod.rs for backward compatibility

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Consolidate command() and safe_output() into okena-core so they can be
shared by okena-terminal, okena-git (future), and the main app without
duplication. Make log a non-optional dependency of okena-core.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move repository operations, diff parsing, branch name generation, and
git data types into a standalone crate (crates/okena-git/).

Key changes:
- Theme-dependent color() methods moved to extension traits
  (PrStateColor, CiStatusColor) in main app
- pub(crate) functions made pub for cross-crate access
- watcher.rs stays in main app (GPUI + Workspace dependency)
- Re-export from src/git/mod.rs for backward compatibility

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move three types out of views/ so workspace no longer imports from views:
- TerminalsRegistry type alias → okena-terminal crate
- DropZone enum → workspace/state.rs
- Toast/ToastLevel data types → workspace/toast.rs

This eliminates the circular dependency between workspace and views,
enabling workspace to be extracted as a standalone crate.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Broadcasting is now handled by PtyOutputSink in reader threads.
The event loop was still calling broadcaster.publish() directly,
causing remote clients to receive every byte twice.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…global

Pass global_hooks as explicit parameter instead of reading from GPUI
global settings(cx). This removes the last crate::settings dependency
from workspace/ (except actions/execute.rs which bridges remote API).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move workspace state, persistence, hooks, settings, focus, requests,
sessions, toast, and layout/project/folder/terminal actions into
a standalone crate (crates/okena-workspace/).

Key changes:
- FolderColor/ThemeMode imports → okena_core::theme
- Terminal imports → okena_terminal
- LayoutNode API conversion methods moved from remote/types.rs to crate
- ToastLevel UI methods converted to extension trait in views
- actions/execute.rs stays in main app (remote + settings dependency)
- Re-export from src/workspace/mod.rs for backward compatibility

222 crate tests pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
matej21 and others added 19 commits March 22, 2026 15:02
Move syntax highlighting, code view, file tree, and selection state
into a standalone crate (crates/okena-files/). These are shared
utilities used by both file_viewer and diff_viewer overlays.

Modules extracted:
- syntax.rs — syntect wrapper for syntax highlighting
- code_view.rs — styled text rendering with selection support
- file_tree.rs — file tree builder and renderer
- selection.rs — generic SelectionState<P> with normalization

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move FileSearchDialog and ListOverlay into okena-files crate.
Add theme accessor (GlobalThemeProvider) for crate-level theme access.
Define Cancel action locally in the crate.

okena-files now contains: syntax highlighting, code view, file tree,
selection state, list overlay, and file search dialog (~2k LOC).

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move markdown parsing and GPUI rendering into a standalone crate
(crates/okena-markdown/). Uses pulldown-cmark for parsing, renders
to GPUI elements with syntax-highlighted code blocks.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move FileViewer (4 files, ~1.3k LOC) into okena-files. Replace
settings_entity/theme_entity GPUI globals with explicit font_size
and is_dark constructor parameters.

Also:
- Move SelectionState/Selectable to okena-core (shared by files + markdown)
- Remove stale re-exports (markdown_renderer, fullscreen_overlay, etc.)
- Clean up unused component re-exports

okena-files now at ~3.3k LOC with 19 tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move the 7-file diff viewer overlay (~2.7k LOC) into okena-git,
creating a domain crate with both git operations and git UI.

Key changes:
- DiffViewMode enum moved to okena-core::types (breaks dep cycle)
- DiffViewer constructor takes config params instead of GPUI globals
- Theme/settings observation set up at call site (overlay_manager)
- Clean up stale re-exports in views/components and ui/

okena-git now at ~5.3k LOC with 55 tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move diff_viewer from okena-git and worktree/close_worktree dialogs
from main app into a new okena-views-git crate. This separates git
UI from git operations, allowing proper dependency flow:

  okena-git (operations) → okena-workspace → okena-views-git (UI)

okena-git reverts to pure git operations (2.5k LOC).
okena-views-git contains all git-related UI (5.7k LOC).

Dialog constructors now take config params instead of GPUI globals.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move elements/ (terminal rendering) and views/layout/ (terminal pane,
tabs, split pane, layout container) into a standalone crate (~6.7k LOC).

Key architectural changes:
- ActionDispatch trait abstracts local/remote action dispatching
- TerminalViewSettings replaces direct settings() global access
- LayoutContainer<D> and TerminalPane<D> are generic over dispatcher
- Terminal keybinding actions defined locally in the crate
- ClickDetector, tint_color, header_buttons moved to okena-ui

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move service config, Docker Compose integration, port detection,
and service lifecycle manager into a standalone crate (2.5k LOC).

Clean extraction — services only depends on okena-core (process)
and okena-terminal (backend, shell config). 33 tests pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Move service rendering (sidebar items, panel header, overview, indicator)
into pure render functions in a standalone crate (~1k LOC).

Pattern: functions take data + theme + callbacks, return GPUI elements.
State management and event handling stay in main app entities.

ServiceSnapshot moved from project_column.rs to crate as shared type.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Extract git status, diff stats, PR/CI badges, commit graph rendering,
and diff file list from project_column.rs into pure render functions
in okena-views-git/project_header.rs (~665 LOC).

Move PrStateColor/CiStatusColor traits to the crate, re-export
from src/git/mod.rs for backward compatibility.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…lumn

project_column.rs reduced from 2094 to 772 LOC (-63%).

New GPUI entities:
- GitHeader (928 LOC) in okena-views-git — owns diff popover,
  commit log, branch picker state
- ServicePanel<D> (598 LOC) in okena-views-services — owns service
  panel state, terminal pane, action dispatch

ProjectColumn now just composes child entities.
Also moved open_url() to okena-core::process.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Wire DiffViewer view_mode and ignore_whitespace back to settings
when the overlay closes. Removes the dead_code TODO annotations.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace SettingsSaver callback with a GPUI Global that DiffViewer
reads/writes directly. Main app syncs to/from persistent settings.

Flow: startup loads settings → global, DiffViewer toggles → global,
close syncs global → settings → auto-save to disk.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Register the terminal view settings GPUI global and sync it with
app settings changes. Fixes panic on TerminalPane creation.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Replace per-crate settings globals (GlobalTerminalViewSettings,
GlobalGitViewSettings) with reads/writes through ExtensionSettingsStore.

View crates call store.get("terminal"/git", cx) and store.set() —
no knowledge of AppSettings. The store's namespace-aware getter/setter
maps "terminal" and "git" namespaces to/from individual AppSettings
fields for backward compatibility.

Eliminates manual sync observers in main.rs. Settings panel UI
continues to work unchanged — it modifies AppSettings fields which
flow through the store getter on next read.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Terminal-specific actions (Copy, Paste, Split*, Focus*, Search*, Zoom*,
etc.) are now defined in okena-views-terminal and re-exported in
keybindings/mod.rs. Previously they were defined locally in both places,
creating duplicate types that GPUI treated as different actions.

This caused keybindings to not reach terminal pane handlers.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Each view crate defines its own Cancel action type. GPUI treats
them as different types, so each needs explicit keybinding registration.

Added missing bindings for:
- TerminalRename → okena_views_terminal::Cancel
- DiffViewer → okena_views_git::diff_viewer::Cancel
- FileViewer → okena_files::file_search::Cancel

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…watcher

Terminal overlays (detached terminal, context menus, overlay utils)
moved to okena-views-terminal. Total ~760 LOC.

simple_input.rs deduplicated — canonical copy in okena-ui, 3 copies
replaced with re-exports. Also extracted text_utils (find_word_boundaries)
and moved GlobalThemeProvider from okena-files to okena-ui.

Git watcher moved to okena-views-git (depends on okena-git + okena-workspace).

Main app: 68k → 27k LOC (-61%)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Remove unused re-exports left from crate extraction (elements,
components, layout, theme, chrome). Fix missing fields in
okena-core client/state.rs test fixtures.

Zero warnings, 403 tests pass.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
matej21 and others added 5 commits March 23, 2026 13:29
Verify that all GPUI globals (theme, settings store, workspace)
initialize correctly and that view crates can read settings.

Tests:
- terminal_view_settings readable after init
- git_view_settings readable after init
- theme provider returns colors
- workspace entity creates
- keybinding registration succeeds

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Add flex_1 + min_w_0 to the project name div so it takes available
space and pushes the terminal count badge to the right edge.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use text_primary instead of text_secondary for the terminal count
badge in sidebar project items.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Change folder name color from text_muted to text_secondary for
better visibility in file viewer and diff viewer sidebars.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Use text_secondary instead of text_muted for folder names, folder
icons, and the "Files" header in the file viewer sidebar tree.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@matej21 matej21 merged commit e386139 into main Mar 23, 2026
8 checks passed
@matej21 matej21 deleted the crates branch March 23, 2026 13:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant