Skip to content

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

Open
andkirby wants to merge 97 commits into
Tawe:mainfrom
andkirby:main
Open

Upgraded version with all latest changes (extends PR #1)#2
andkirby wants to merge 97 commits into
Tawe: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 29, 2026 11:52
- 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.
…ged list

ctrl+r and ctrl+e always targeted the running services grid regardless
of which list had focus. Now checks m.focus and routes to managed-specific
methods when the managed services list is active.

Also adds amber row highlight (bg 178) on the target row when a confirm
dialog is open, so the user can see exactly which service the action
applies to in both the running table and managed list.
…check

isRuntimeCommand used exact match against "python3" but systems
often have versioned binaries like python3.12. Replaced with a
regex (^python\d.*) that matches any python<N> variant, so
discovered processes running via versioned interpreters are no
longer hidden from the running list.
… styling

Extract rowColorsFor() as single source of truth for row background/foreground
colors across both running table and managed list. Group confirm now shows:
- Selected row: amber (178) matching single-action confirm style
- Other group members: dimmed orange (94)
- Browsing group members: blue (61) — unchanged
…naged services

Previously, the details pane on the right only showed information for
Managed Services. When a running service was selected, the details pane
did not update to show that service's information.

Changes:
- Renamed managedDetailsVP → selectedDetailsVP to reflect universal use
- Renamed renderManagedDetails() → renderSelectedServiceDetails()
- Added focus-based logic to show appropriate details:
  * focusRunning: Shows selected running service details (PID, port, command, etc.)
  * focusManaged: Shows selected managed service details (maintains existing behavior)
- Added comprehensive running service details display

The details pane now works for whichever service is actively selected,
maintaining semantic clarity through appropriate naming.

Architecture (Option A):
- Kept details pane in managed section visually
- Made it semantically universal by showing details for currently selected item
- Updated naming to match the universal behavior
…ementation

Updated ticket artifacts to reflect the implementation of universal details
pane functionality (commit 097772f) that makes the details pane work for both
running and managed services.

Changes:
- .tickets/DEVPT-004/uat.md:
  - Marked Decision 1 as RESOLVED (discovered services show full details)
  - Added BR-11 for universal details pane requirement
  - Added Edge-9 for placeholder behavior

- .tickets/DEVPT-004/requirements.trace.md:
  - Added BR-11 requirement for universal details pane

- .tickets/DEVPT-004/tasks.md:
  - Added Task 7 for universal details pane implementation
  - Added M7 milestone
  - Updated constraint coverage to include Task 7
  - Marked Task 7 as complete in Post-Implementation

- .tickets/DEVPT-004/bdd.md:
  - Added Journey 9 for universal details pane functionality
  - Updated scenario budget (13 of 12, within tolerance)

- DEVPT-004-managed-service-state-panel-in-tui.md:
  - Added acceptance criterion for running services details

This resolves the UAT open question about what to show for discovered
(non-managed) services when selected in the running processes area.
…tails

Show ⧉ icon next to command text in the logs header and the grid
details pane. Clicking the icon copies the full command to the system
clipboard via OSC 52 (tea.SetClipboard).
…ain for shared-CWD

- Capture OS-resolved command (ps) at spawn time, store in registry
  (e.g. "bunx vite" -> "node .../vite")
- Restructured evidence chain: PID+time -> PID+path -> port -> CWD+command -> CWD -> root
- Port is primary runtime signal for services sharing the same CWD
- Stored LastPID+path takes precedence over port (prevents conflict false matches)
- Reconciler skips processes on undeclared ports (noise) (DEVPT-013)
- Restart runs full preflight including port checks, blocks on conflict (DEVPT-018)
- Added commandMatches helper for path-insensitive resolved command comparison
Managed service stop in TUI now calls StopService() (lifecycle) instead of
StopProcess(pid), which bypassed reconciliation and caused "invalid pid: 0"
when registry LastPID was nil or stale. Raw discovered processes still use
the direct PID path.
- Rewrote §1.3 with ordered evidence chain and shared-CWD guidance
- Added §4.3.1 resolved command capture
- Updated §3.4 verification algorithm and rules
- Added restart port preflight rules to §6.2
- Added three non-negotiable rules to §9
- Documented identity groups (primary/related/conflict/untracked) as target architecture
New pkg/resource package collects RSS memory via batch ps calls,
following the same async observation pattern as health checks.

- Memory shown in details pane with color-coded thresholds
  (gray <50MB, default <200MB, yellow <500MB, orange <1GB, red >1GB)
- Async collection every 2s when idle, single ps invocation
- Fixed command avalanche: async handlers return nil, not tickCmd
- copilot-instructions.md: add lifecycle package, update test inventory
  (39 test files across 8 packages), fix architecture data flow,
  update TUI section for universal details pane
- DEBUG.md: add lifecycle runtime entry, fix version example,
  update test file listings
- README.md: document universal details pane, memory display,
  copy-to-clipboard feature
- plan-fixes.md: mark Phase 0 and Phase 1 as done
- CHANGELOG.md: add 0.5.0 section with grouped entries
- .gitignore: ignore wireframe artifacts
App.RemoveCmd existed and README advertised 'devpt remove <name>' but the
main.go dispatcher had no case for it, so the command failed as unknown.
Add the case (rm alias), a handleRemove with usage, and a help line.
Move wireframe markup, renderer, and archived mockups from the repo root
into wireframes/. Promote the server-less, width-validating renderer as
the single renderer; drop the redundant root renderer.html + http-server
pair.

Add DEVPT-020 add/edit modal states (edit-modal, add-modal) to
wireframe.md. The edit form reuses the existing modal box style, with an
editable Name field covering rename.

Remove the `wireframe*.*` gitignore rule (it matched at any depth and
blocked the markup) so the mockups track. Add wireframes/README.md
documenting the pipeline and the {tag} vocabulary.
Registry:
- RenameService(old,new): single locked save, preserves all runtime/identity
  fields so a running service keeps resolving to its renamed entry
- UpsertService: overwrite editable fields + preserve runtime, else create

CLI:
- AddCmd(...,force bool); devpt add ... --force overwrites preserving runtime,
  creates when absent; no --force keeps existing reject-on-duplicate behavior
- UpdateServiceFields / RenameService App methods (fetch-mutate-preserve)
- Shared validation moved to pkg/models (breaks cli<->tui cycle, no drift)

TUI:
- Add/Edit modal form (^A add, e edit): Name/Dir/Command/Ports, Tab cycle,
  Enter submit, Esc cancel; edit of a running service shows "Applies on next
  start/restart" and carries identity fields
- Details-pane action buttons (wireframes/wireframe.md state:default):
  edit always shown for managed; restart/stop shown when running

Docs: README/QUICKSTART updated (--force, ^A add, e edit, buttons).

Gates: go build/vet/test pass; spec-trace validate --stage all (5/5).
… form

Buttons (wireframes/wireframe.md state:default):
- Each whole button (icon + label) is colored by action so the row reads as
  distinct units, not gray labels: edit=cyan, start/restart=green, stop=red
- edit is stable leftmost; then re/start; then stop (order locked by tests)
- stopped/crashed show start (was edit-only); running shows restart+stop;
  starting shows edit only
- fitLine (non-ANSI-aware) truncated the trailing label by counting escape
  bytes as width -> switched the action row to the ANSI-aware fitAnsiLine
- Buttons are now functional: render reports per-button hit regions
  (detailsActionLine + x-ranges); handleTableMouseClick hit-tests them and
  dispatches to edit/start/restart/stop (openEditForm, StartService,
  restartManaged, prepareManagedStopConfirm)

Paste:
- Route tea.PasteMsg (bracketed paste, macOS Cmd+V) to the focused form field;
  textinput already inserts+sanitizes at the cursor. No-op when no form is open.

Gates: go build/vet/test pass (13 button + 5 paste UAT tests added).
…builds

Commit 60bc8a8 added GetProcessCommand to manager.go and the Unix impl to
proc_unix.go but missed proc_windows.go, so the Windows cross-build (the last
step in the release matrix) failed with 'undefined: getProcessCommand'.
This broke the v0.5.0 and v0.5.1 releases. Implemented via wmic CommandLine.
actions/checkout@v4 and actions/setup-go@v5 target Node 20, which GitHub is
deprecating (warnings shown in v0.5.0/v0.5.1 runs). Bump to v5/v6.
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