Skip to content

Upgraded version with all latest changes (extends PR #1)#2

Open
andkirby wants to merge 73 commits intoTawe:mainfrom
andkirby:main
Open

Upgraded version with all latest changes (extends PR #1)#2
andkirby wants to merge 73 commits intoTawe:mainfrom
andkirby:main

Conversation

@andkirby
Copy link
Copy Markdown

Old PR: #1

Hi there,

Sorry, I decided to burn some tokens and pull your changes. I hope you haven't started working on conflict fixes.
Regarding your last fix - please check c376f11.

By the way, there is github action for building multi-platform binaries.
I'm just not sure that the release tags will be added into this repo.

Changelog copy here:

0.2.2

  • Added a Shift+S sort direction toggle in the TUI so sort order can be reversed without changing the active column
  • Fixed managed service PID validation so stop and restart only act on processes that still match the registered service
  • Fixed cross-platform builds by separating Unix and Windows process control paths

0.2.1

  • Added table sorting controls with mouse support and reverse sort in the TUI

0.2.0

  • Added multi-service start, stop, and restart commands with quoted glob pattern support so multiple managed services can be controlled in one invocation
  • Added name:port targeting for managed services so ambiguous service names can be disambiguated from the CLI
  • Extracted the Bubble Tea UI into pkg/cli/tui so the TUI logic is isolated from the main CLI package
  • Added mouse row selection, mouse wheel scrolling, and viewport-focused navigation so table and log interaction works without keyboard-only control
  • Added centered modal overlays for help and confirmation dialogs so help and destructive actions no longer replace the main table view
  • Replaced the ad hoc search field with Bubbles text input so filter editing behaves like a real input control and updates inline in the footer
  • Simplified the table chrome by moving counts into headers, bolding the active sort column, and removing redundant status text from the top of the screen
  • Fixed Enter handling so the top section opens logs and the bottom section starts the selected managed service without being swallowed by confirm bindings
  • Fixed log rendering so the header is separated from the first log line and the viewport uses the actual remaining terminal height
  • Fixed stale table layout offsets so footer spacing, viewport sizing, and mouse hit-testing stay aligned after the filter moved into the footer
  • Added shared keymap-driven help text with Bubble components so visible shortcuts and actual bindings stay in sync
  • Added clearer TUI and quickstart documentation so the current footer filter, modal help, mouse controls, batch commands, and logs header behavior are documented
  • Bumped the application version to 0.2.0 and rendered the version in the TUI header in muted gray

andkirby added 30 commits March 12, 2026 17:18
Add comprehensive state transition tests for TUI model including:
- Navigation (Tab focus switching, Escape to return)
- Mode switching (search, help)
- Key sequences (multi-step user flows)
- View rendering (table and help output)

Increases pkg/cli test coverage from 2.4% to 32.9%.

Tests verify model state transitions without requiring terminal UI.
…and name:port disambiguation

- Add batch start/stop/restart commands accepting multiple service names
- Support glob pattern matching ('service*', '*-api', '*web*')
- Add name:port format for disambiguation (web-api:3000)
- Add parser module with fallback lookup for name:port identifiers
- Update documentation with proper quoting examples

Files:
- pkg/cli/parser.go: New name:port parser with fallback logic
- pkg/cli/parser_test.go: Comprehensive parser unit tests
- pkg/cli/commands.go: Updated all commands to use parser
- cmd/devpt/main.go: Updated help text
- README.md, QUICKSTART.md: Added name:port examples

Related: DEVPT-001
Implement enhanced viewport interactions for logs viewer:
- Mouse click navigation (gutter jump, text centering)
- Keyboard shortcuts for highlight cycling (n/N keys)
- Match counter display in footer (e.g., "Match 3/15")
- Terminal resize persistence for highlight state

Changes:
- Add calculateGutterWidth() helper for viewport layout
- Add highlightMatches[] and highlightIndex state fields
- Add mouse click handling for gutter and text areas
- Add keyboard event handling for n/N highlight navigation
- Extend footer rendering with match counter
- Add comprehensive test suite (17 tests, all passing)

Test coverage:
- Mouse click navigation (gutter, text, edge cases)
- Highlight cycling (forward/backward, wrap behavior)
- Match counter display (formatting, bounds)
- Resize persistence (highlight state preservation)
- Viewport integration (updates, sizing, content flow)
…view

When switching from logs/debug mode back to table view, the viewport was
not being properly redrawn because the tableContentHash optimization was
preventing SetContent from being called. The viewport would continue to
display stale logs content instead of the table content.

The fix invalidates tableContentHash in all mode transition paths from
logs/debug mode to table mode, forcing the viewport content to be
refreshed on the next render cycle.
Cloudflared tunnels are commonly used for development to expose local
servers publicly. Without this pattern, cloudflared processes would be
filtered out during process scanning, causing managed services that use
cloudflared to rely solely on the IsRunning fallback check.

This could cause flickering (appearing/disappearing) if the process
detection was inconsistent. Now cloudflared processes are properly
detected and matched to their managed service definitions.
Previously, processes were filtered by dev patterns BEFORE matching to
managed services. This caused non-dev commands (like cloudflared, custom
scripts, etc.) to be filtered out, making their managed services rely
solely on the IsRunning fallback check - which could cause flickering.

Now the filter receives managed service PIDs upfront and always keeps
those processes regardless of whether they match dev patterns. This
ensures stable visibility for any managed service, no matter what
command it runs.

UX improvement: Users can add any process as a managed service and it
will always be visible in the TUI without flickering.
Cherry-picked 52c426a with conflict resolution.

The original fix ensures command mode (:) and search mode (/) handle
all key input at the top of the Update function, preventing keys like
'b', 'q', 's', 'n' from being intercepted by other handlers.

Conflicts resolved:
- tui.go: Combined command/search mode handlers (from origin) with
  logs/logsDebug mode handlers (from our branch) at top of Update
- tui_key_input_test.go: Updated to use pointer receiver (*topModel)
  to match our codebase convention
- tui_ui_test.go: Updated hint text from 'Esc or b' to 'Esc to back'
- Selected line in running section shows gray when managed section has focus
- Selected line in managed section shows gray when running section has focus
- Single-click changes selection without switching focus (so gray is visible)
- Double-click or Tab still switches focus and performs actions
- Add sort.go with sortMode types, cycleSort(), columnAtX(), sortServers()
- Integrate sort state into model.go
- Add sort styling to table headers (yellow/orange)
- Handle mouse clicks on column headers in helpers.go
- Add 's' key cycling in update.go
- Add unit tests for sort cycling and column detection
andkirby added 30 commits April 4, 2026 18:06
Bug 1: In command mode (opened via ^A), ^C was silently swallowed because
control chars (byte < 32) never reached the Quit handler. Add explicit
ctrl+c → cancel (return to table) and ctrl+u → clear input line.

Bug 2: The managed section's list + details panes were joined into a single
managedVP viewport, so scrolling one scrolled both. Split into two
independent viewports (managedListVP, managedDetailsVP) so each pane
scrolls only on mouse-over. Mouse wheel events are routed to the correct
viewport based on X position.
StatusCmd now accepts multiple identifiers (names, ports, or glob patterns).
Glob patterns (e.g., 'offg*') expand against discovered servers.
Backward compatible: exact name and port matching preserved.
Added 28 comprehensive unit tests.

Resolves: Status command wildcard gap in DEVPT-001
Added osc8Link() function wrapping text in OSC 8 escape sequences.
Added fixedHyperlinkCell() for clickable table cells with correct width.
Import github.com/charmbracelet/x/ansi for hyperlink support.
Bug fix: changed 'if lineWidth >= width' to 'if lineWidth > width'.

DEVPT-008 clickable ports: terminals supporting OSC 8 can click ports to open URLs.
New test TestView_CommandColumnTruncation() verifying command column uses full cmdW.
Tests at terminal widths 80, 100, 120.
Prevents regression where truncated command + padding wasted visible space.

DEVPT-002 enhanced viewport: guards against command truncation bug.
Struct field alignment (tabs to spaces indentation).
Import ordering fixes.
Removed trailing blank lines.
Fixed brace indentation in executeGroupConfirm.

Code style consistency: no functional changes.
Import block indentation standardized.
Constant declarations aligned.
Struct field formatting.

Code style consistency: no functional changes.
Prevent committing local Claude AI settings.
…action

UAT bug fix: Services starting with underscores (e.g., _mdt-api,
_offgrid-worker) were incorrectly grouped into same "-" namespace
instead of being grouped by their actual name prefix (mdt, offgrid).

The extractNamespace() function now skips leading non-alphanumeric
characters (_, ., -) before extracting the alphanumeric prefix.

Changes:
- Updated extractNamespace() to iterate through string and find first
  alphanumeric character, then extract prefix from that position
- Added test cases for leading underscore handling: _mdt-api → mdt,
  _offgrid-worker → offgrid, ___test-api → test
- Updated existing test case for leading dash to reflect new behavior:
  -gateway → gateway (skips leading separator)

All tests pass, including new cases and backward compatibility with
standard service names (api-gateway → api, redis → redis).
UAT requirement update: Services starting with underscore (e.g., _offgrid-be,
_mdt-api) should be in DIFFERENT namespaces than those without (e.g.,
offgrid-be, mdt-worker). The leading underscore is now included in the
namespace prefix.

Changes:
- Updated regex to include leading special characters: ^([^a-zA-Z0-9]*[a-zA-Z0-9]+)
- extractNamespace() now captures leading chars + alphanumerics up to separator
- Examples: _offgrid-be → "_offgrid", offgrid-be → "offgrid"
- Updated test expectations: _mdt-api → "_mdt" (was: "mdt")
- Updated test expectations: _offgrid-worker → "_offgrid" (was: "offgrid")
- Updated test expectations: ___test-api → "___test" (was: "test")

This allows users to intentionally split namespaces using underscore prefix,
creating separate groups like "_offgrid" vs "offgrid" for different
environments or service categories.

All tests pass.
Check for lsof in PATH at startup and print OS-specific install
hints (apt/dnf/pacman on Linux, xcode-select on macOS) instead
of a cryptic "executable file not found" error.
… delegate to display/process_ops/batch_executor
Implement pkg/lifecycle/ orchestration layer with identity verification
(5-evidence chain), file-based per-service locks with timeout recovery,
live state reconciliation, readiness policy (5 modes + fallback), and
structured 6-outcome results (success/noop/blocked/failed/invalid/not_found).

Wire all CLI commands (start/stop/restart/batch) through LifecycleManager.
Delete old direct process.Manager bypass paths and dead code.
Fix test process leaks with t.Cleanup().
Add versioned caching for visibleServers(), managedServices(), and displayNames(). Invalidate caches on refresh, reuse render-frame data across table helpers, avoid resetting viewport content when content is unchanged, and reduce filter-path allocations. Update TUI tests to cover cache behavior and helper signature changes.
lsof requires root to read /proc/<pid>/fd on Linux, causing a hard
fatal for non-root users. Add direct /proc filesystem fallbacks:
- ScanListeningPorts: tries lsof, falls back to /proc/net/tcp
- getCWD: reads /proc/<pid>/cwd symlink instead of lsof
- pickProcessLogFile: reads /proc/<pid>/fd/ symlinks instead of lsof
- CheckPrereqs: accepts /proc/net/tcp as alternative to lsof on Linux

macOS behavior is unchanged.
syscall.Kill does not exist on Windows. Extract process liveness
check into build-tagged files, matching the existing pattern in
pkg/process/proc_{unix,windows}.go.
Clicking the right-side details pane in the Managed Services split
view was incorrectly selecting items in the left-side list because
handleTableMouseClick only routed by Y coordinate. Add
managedClickRegion on processTable to classify clicks by X position
(list vs details vs outside), mirroring the existing scroll routing
in updateViewportForTableY.
Address 6 issues identified in code review:

- Use portCell() directly for OSC 8 hyperlinks instead of fragile
  strings.Replace on rendered lines (could match wrong port occurrence)
- Compute sort header style before rendering to avoid double-render
- Add named constant for mouse offset (+1) in helpers.go
- Remove unused lastDetailsWidth field from processTable struct
- Delete stale renderManagedSection comment
- Fix unreachable ms > 5000 check in health checker (threshold order)
- Delete dead code: Registry.Save(), Manager.GetLogs(), DetectFrameworkInfo()
- Remove duplicated tail logic: Tail() now calls tailFile()
- Replace bubble sort with sort.Strings() in pattern expansion

Total: ~330 lines removed with zero functionality loss.
A process already uniquely claimed by another service via its port
binding should not cause false ambiguity for the current service.
- Port uniquely owned by another service → not ambiguous
- Port shared across services with same CWD → ambiguous
Extract magic numbers into package constants (defaultPortBoundTimeout=20s,
defaultProcessOnlyTimeout=3s) so tests and production share a single source
of truth. The 5s default was too aggressive for services like Open WebUI
that take 10-15s to bind their port.
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