Skip to content

Language-Agnostic Local Dev Process Manager #2697

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft

Conversation

rossnelson
Copy link
Collaborator

@rossnelson rossnelson commented Apr 28, 2025

This PR introduces a clean, extensible process manager CLI for local development.

Define various modes by simply adding:

  1. Procfile.<mode>
  2. (Optional) .env.<mode>
  3. (Optional) healthcheck.<mode>.yaml

Start the dev mode easily with:

pnpm dev
With TUI Without TUI
CleanShot 2025-04-28 at 10 41 35 CleanShot 2025-04-28 at 13 03 05

If you don't want a TUI pass the --no-tui flag


Why

Improving Visibility and Control

Currently, services like the ui-server must often be started manually outside of Vite to properly view logs. When enabling internal logs, outputs from multiple processes are mixed and hard to follow.

This new process manager cleanly separates logs per process, supports log focusing (only see one process) or log muting (hide noisy services), and provides a unified way to start all needed services from a single command.

Developers can easily run focused workflows like:

  • pnpm dev:with-auth
  • pnpm dev:local-temporal
  • pnpm dev:with-codec

and add new modes without manually editing Node scripts or Vite plugins.


Simpler, Safer Scaling

Granted, how often are we really going to add a module, but....

Adding new local services or workflows today requires:

  • Creating a new Vite plugin.
  • Adding conditional flags like shouldSkip.
  • Manually managing plugin execution order.

This introduces hidden coupling and complexity.

With this new model, adding a new service mode is as easy as:

configs/
├── Procfile.new-mode
├── .env.new-mode # optional
└── healthcheck.new-mode.yaml # optional

No Go, Node, or Vite code changes required.


A Monorepo Dev Experience (in practice)

While our runtime systems are separate, our local development already resembles a monorepo:

  • SvelteKit UI
  • UI Server (Go)
  • Codec Server (Node)
  • Temporal Server (CLI)
  • OIDC Provider (Node)

A common, language-agnostic process manager better matches our reality. It makes development across all modules easier, faster, and more reliable.


Summary

This PR replaces per-plugin service management with:

  • A declarative mode system (Procfiles + optional env + optional healthchecks)
  • Dynamic process launching
  • Scoped log viewing
  • Cleaner service separation
  • Easier scaling for future dev needs

This commit introduces a new CLI tool, `devctl`, designed to manage
development services. It includes the following features:

- Service orchestration with health checks and environment loading.
- Interactive TUI for monitoring service statuses and logs.
- Configurable focus and mute options for service output.
- Support for Procfile-based service definitions and health checks.

The implementation includes:
- Core application logic in `app` package.
- CLI entry point in `cmd` package.
- Config parsing for `.env`, Procfile, and healthcheck files.
- Unit tests for key components.

This tool aims to streamline development workflows by providing a
centralized interface for managing services.
Add unit tests for various utility packages including app, colors,
config, contexts, runner, service, tui, and cmd. These tests cover
functionality such as environment file loading, Procfile handling,
health checks, service execution, and TUI interactions.

- Ensure proper error handling and edge case coverage.
- Validate default configurations and custom options.
- Improve test coverage and maintainability.

This change enhances the reliability and robustness of the utilities.
- Replaced `tui` flag with `noTUI` for better clarity.
- Updated `Handler` to handle `noTUI` flag and adjusted logic in `Run`.
- Enhanced TUI model to apply focus and mute filters for logs and statuses.
- Added tests for focus and mute filtering in TUI model.
- Removed unused development configuration files.

BREAKING CHANGE: The `--tui` flag is replaced with `--no-tui` to disable
the interactive TUI. Update CLI usage accordingly.
- Introduced `.env.dev` for environment-specific variables.
- Added `Procfile.dev` to define development process commands.
- Created `healthcheck.dev.yaml` for service health monitoring.
- Implemented TUI keybindings and viewport handling in `keys.go`.
- Enhanced TUI model with sidebar and content focus in `model.go`.
- Updated `run.go` to enable alternate screen for TUI.
- Upgraded dependencies in `go.mod` and `go.sum` for compatibility.
- Introduced `Left` and `Right` key bindings for horizontal scrolling.
- Updated `keyMap` to include new bindings with help descriptions.
- Modified `ShortHelp` and `FullHelp` to reflect the new keys.
- Enabled horizontal scrolling in the main viewport with a step of 1.
- Implemented `ScrollLeft` and `ScrollRight` actions in the `Update` method.

This enhances navigation by allowing users to scroll content horizontally.
Copy link

vercel bot commented Apr 28, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
holocene ✅ Ready (Inspect) Visit Preview 💬 Add feedback Apr 28, 2025 8:01pm

- Updated `.gitignore` to include `/bin/cli` instead of `/bin`.
- Added `bin/devctl.sh` script to build and run `devctl` with configs.
- Modified `configs/Procfile.dev` to open the browser on `vite dev`.
- Updated `package.json` to use `bin/devctl.sh` for the `dev` command.
@rossnelson rossnelson changed the title add proc manager Language-Agnostic Local Dev Process Manager Apr 28, 2025
Updated the devctl script to forward any additional arguments
to the devctl executable. This allows for more flexible usage
of the script by supporting custom parameters.
@rossnelson rossnelson marked this pull request as ready for review April 28, 2025 17:09
@rossnelson rossnelson requested a review from a team as a code owner April 28, 2025 17:09
@rossnelson rossnelson requested review from stevekinney and removed request for a team April 28, 2025 17:09
@rossnelson rossnelson marked this pull request as draft April 28, 2025 19:10
- Replace `tui` flag with `noTUI` in test cases to align with updated
  functionality.
- Adjust test assertions to reflect changes in model behavior, including
  focus, mute, and log handling.
- Update `makeContext` helper to support `--no-tui` flag.
- Ensure test coverage for new behavior, including service-runner path
  and help text in `View()` output.
- Refactored `captureOutput` to `captureStderr` for improved clarity.
- Added `TestRun_Warnings` to verify warnings for missing env and health files.
- Introduced `TestRun_SetsEnvVars` to ensure environment variables are set.
- Added `TestRun_ErrorOnBadEnvFile` to handle malformed env files.
- Included `TestRun_ErrorOnMissingProcfile` to test missing Procfile errors.
- Created new TUI test `TestRun_ProcfileMissing` for Procfile absence handling.
- Added utility functions `errorsUnwrapped`, `unwrap`, and `contains` for error
  handling and string checks in TUI tests.
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