Skip to content

Feature/node sites proxy commands - #151

Merged
lukas-frey merged 31 commits into
mainfrom
feature/node-sites-proxy-commands
Nov 12, 2026
Merged

lukas-frey merged 31 commits into
mainfrom
feature/node-sites-proxy-commands

Conversation

@lukas-frey

Copy link
Copy Markdown
Member

Closes #97
Closes #108

A site now has a type, PHP or Node.js. A folder with a package.json that has a dev script, and nothing of PHP's, is a Node.js site: Flock runs npm run dev with the project's Node.js version on a port of its own, starts it on the first visit and stops it after 30 minutes without one. Existing sites stay PHP.

Proxies are for servers that aren't projects. They can now get commands, so Flock can start and stop the server and show its output; a server that runs in the background gets a stop command too.

  • Node.js sites: a waiting page while the dev server starts, which says why when it stops. Worktrees get a dev server of their own, and Share works with them. flock type php|node switches a site.
  • Proxies: flock proxy <name> <upstream> --command … [--stop-command …], flock proxy start|stop <name>.
  • Apps: the site's type, the dev server's or command's state with Start and Stop, and their output. Sites and proxies show a dot for what Flock runs, and problems as an icon.
  • flock logs <name> finds a site's or proxy's log by its name.

Launchers like sh and npm leave the port to a child, so stopping only the launcher keeps the port taken. Spec.Tree stops the process group on unix and a job object of its own on Windows.
Sites are php or node. Sites stored before types existed are read as php and saved with it; parked folders and new sites get the type their folder suggests.
A proxy can have a command, its folder and a stop command for servers that run in the background. Flock runs it only when the proxy is started (API, CLI, MCP), shows its state and keeps its output in the proxy's log.
…st request

A node site runs npm run dev on a port Flock picks from its name. The first request starts it and gets a page that waits for it; the page says why when it exits.
A dev server stops after 30 minutes without requests or open connections, so a tab with hot reload keeps it running, and so does a share. The next request starts it again; the API and MCP can stop one right away.
A share of a Node.js app goes to its dev server with the site's own Host and Origin, so the dev server's host checks take the tunnel's requests. Dotfiles stay blocked, except the folders dev servers serve from.
A site's type, a Node.js app's dev server with Start, Stop and its output, and a proxy's start command with Start and Stop.
A site's type, a Node.js app's dev server with Start, Stop and its output, and a proxy's start command with Start and Stop.
A site's type, a Node.js app's dev server with Start, Stop and its output, and a proxy's start command with Start and Stop.
When to use a site and when a proxy, how Flock runs a Node.js app's dev server, and starting a proxy's server with its command.
Node.js apps are sites now, and a proxy's server can be started from Flock, so the comments and the proxy's waiting page say so.
Its Parent didn't name the old detail's section, so adding it to the new one crashed the app.
Node.js sites get their dev server's state as a dot in Sites and the panel, and a proxy's dot follows its command. Problems show as an icon instead of a line, and the details now follow a dev server's or command's state.
Node.js sites get their dev server's state as a dot in Sites and the panel, and a proxy's dot follows its command. Problems show as an icon instead of a line.
Node.js sites get their dev server's state as a dot in Sites, a proxy's dot follows its command, and the tray names a proxy command's state.
…s name

flock logs <name> also finds the log of a site's FrankenPHP or dev server, or of a proxy's command.
Add Proxy has an optional Commands section, so a proxy and the commands that start and stop its server are added at once. The proxy's section is called Commands, with Start, Stop and Folder.
Add Proxy has an optional Commands section, and the proxy's section is called Commands, with Start, Stop and Folder.
Start, Stop and Folder labelled like the other fields, Folder in one row with Choose, and the help in a line under Stop.
Name and Upstream side by side, the placeholders instead of the intro, and the form scrolls when the window leaves it too little room.
Name and Upstream side by side, the placeholders instead of the intro, and the form scrolls with the buttons outside it.
No body text, hints as tooltips, and the form scrolls with the buttons outside it.
A stopping daemon read the idle time the next test set, and 300 ms was too short for a dev server to start on macOS.
macOS answers EPERM for a group whose processes are exiting, which counted as empty, so a stop could return while a child still held its port.
A build started by hand gets a dev- version, which put it in the release environment, so it was refused on any branch but main. Only the merge queue and releases use the environment now.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved defects allow Next.js dev servers to bypass loopback and share restrictions, while concurrent proxy starts can launch duplicate commands.

10 open issues
What changed in this PR

Adds managed Node.js sites and optional proxy start/stop commands to Flock’s local development environment, addressing #97 and #108.

Changes:

  • Adds site-type detection, on-demand dev servers, idle shutdown, worktree support, and Node.js sharing.
  • Exposes server controls, status, and output through desktop interfaces, APIs, CLI, and MCP tools, with supporting tests and documentation.
  • Allows dev- builds to bypass release-signing requirements on macOS and Windows.
File Description
windows/​Flock.Tray/​ViewModels/​SitesViewModel.cs Tracks server state and detail refreshes.
windows/​Flock.Tray/​ViewModels/​PanelViewModel.cs Adds Node.js labels and state indicators.
windows/​Flock.Tray/​Ui.cs Adds state dots and scrollable dialog forms.
windows/​Flock.Tray/​Settings/​SitesPane.xaml.cs Integrates site types, commands, and output.
windows/​Flock.Tray/​Settings/​SitesPane.xaml Displays state dots and problem icons.
windows/​Flock.Tray/​Settings/​SitesPane.Worktrees.xaml.cs Shows Node.js worktree controls.
windows/​Flock.Tray/​Settings/​SitesPane.Node.xaml.cs Adds dev-server controls and command editing.
windows/​Flock.Tray/​Settings/​OutputPanel.cs Adds reusable, polling server output.
windows/​Flock.Tray/​Settings/​AiPane.xaml.cs Adds the state-tone brush converter.
windows/​Flock.Tray/​PanelWindow.xaml Updates panel status indicators.
windows/​Flock.Tray/​Features/​Sites/​SitesService.cs Adds server actions and log operations.
windows/​Flock.Tray.Tests/​SitesWorkflowTests.cs Tests state indicators and refresh behavior.
windows/​Flock.Kit/​Settings.cs Adds site-type and proxy-command changes.
windows/​Flock.Kit/​Models.cs Models Node.js servers and proxy commands.
windows/​Flock.Kit/​FlockClient.cs Adds server-control and log-clearing requests.
windows/​Flock.Kit.Tests/​DecodingTests.cs Tests new status models and compatibility.
windows/​Flock.Kit.Tests/​ClientTests.cs Tests server endpoints and request bodies.
macos/​Tests/​FlockKitTests/​DecodingTests.swift Tests Node.js and proxy-command decoding.
macos/​Tests/​FlockKitTests/​ClientTests.swift Tests command, site, and log endpoints.
macos/​Sources/​FlockUI/​Settings/​WorktreesSection.swift Adds Node.js worktree details.
macos/​Sources/​FlockUI/​PanelView.swift Displays runtime labels and state indicators.
macos/​Sources/​FlockKit/​Settings.swift Adds site-type and proxy-change payloads.
macos/​Sources/​FlockKit/​Models.swift Adds runtime status models.
macos/​Sources/​FlockKit/​Client.swift Adds proxy controls and log clearing.
linux/​src/​tray.rs Displays proxy command states.
linux/​src/​panes/​common.rs Adds multistate server dots.
internal/​web/​web.go Routes Node.js requests through wake handling.
internal/​web/​wake.go Adds request-aware dev-server wake middleware.
internal/​web/​share.go Adds Node.js share routing and path filtering.
internal/​web/​pages/​unlinked.html Adds startup and failure explanations.
internal/​web/​nodeshare_test.go Tests share headers and blocked paths.
internal/​supervisor/​tree_test.go Tests launcher-child cleanup.
internal/​supervisor/​supervisor.go Adds shell commands and process-tree supervision.
internal/​supervisor/​proc_windows.go Adds Windows shell and job-object handling.
internal/​supervisor/​proc_unix.go Adds shell and process-group handling.
internal/​mcpserver/​tools_write.go Exposes site types and proxy controls.
internal/​mcpserver/​server.go Extends the daemon interface.
internal/​mcpserver/​mcpserver_test.go Tests new MCP actions.
internal/​daemon/​share.go Starts Node.js servers for sharing.
internal/​daemon/​proxyprobe.go Adds probe invalidation and connection checks.
internal/​daemon/​proxycommand.go Manages proxy command execution and status.
internal/​daemon/​proxycommand_test.go Tests foreground and background commands.
internal/​daemon/​nodesite.go Manages dev-server ports, wake, and sleep.
internal/​daemon/​nodesite_test.go Tests Node.js lifecycle and worktrees.
internal/​daemon/​frankenphp.go Extends site restart to Node.js.
internal/​daemon/​daemon.go Integrates runtime management and routing.
internal/​daemon/​daemon_test.go Adds subprocess test dispatch.
internal/​config/​worktrees.go Inherits the parent site’s type.
internal/​config/​worktrees_test.go Tests worktree type inheritance.
internal/​config/​types.go Adds site-type detection and switching.
internal/​config/​types_test.go Tests detection and legacy compatibility.
internal/​config/​proxies.go Stores and validates command settings.
internal/​config/​proxies_test.go Tests command persistence and validation.
internal/​config/​config.go Integrates types into site configuration.
internal/​cli/​status.go Displays Node.js site versions.
internal/​cli/​sitetype.go Adds flock type.
internal/​cli/​sites.go Preserves types when relinking sites.
internal/​cli/​root.go Registers the type command.
internal/​cli/​proxy.go Adds command flags and start/stop actions.
internal/​cli/​proxy_test.go Tests flags and subcommand routing.
internal/​cli/​logs.go Resolves logs by site or proxy name.
internal/​cli/​logs_test.go Tests named server-log lookup.
internal/​api/​frankenphpapi.go Adds the site-stop endpoint and client.
internal/​api/​content.go Adds service-log clearing.
internal/​api/​configapi.go Adds type changes and proxy controls.
internal/​api/​api.go Defines runtime states and backend operations.
internal/​api/​api_test.go Tests configuration, controls, and log clearing.
docs/​sites.md Documents proxy commands and controls.
docs/​sharing.md Explains Node.js dev-server sharing.
docs/​node.md Documents managed Node.js sites.
docs/​cli.md Lists new commands and log behavior.
docs/​ai.md Documents expanded MCP tools.
.github/​workflows/​ci-windows.yml Exempts dev builds from required release signing.
.github/​workflows/​ci-macos.yml Exempts dev builds from release credentials.

Review effort: Balanced

Comment thread internal/daemon/nodesite.go Resolved
Comment thread internal/daemon/proxycommand.go Resolved
Comment thread internal/cli/proxy.go Resolved
Comment thread internal/cli/proxy.go Resolved
Comment thread internal/daemon/nodesite.go Resolved
Comment thread internal/daemon/proxycommand.go Resolved
Comment thread internal/daemon/proxycommand.go Resolved
Comment thread internal/web/share.go Resolved
Comment thread internal/web/web.go Resolved

@onairmarc onairmarc left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copilot changes

next dev listens on loopback only, a new Node.js version restarts the dev server, Vite gets only the site's own domain (older Vite takes one name), share visitors wake a stopped dev server, and the waiting page shows a failure without a reload.
…d CLI waits

A second start can't run a background command twice, a command past its time limit is killed with what it started, and flock proxy start|stop wait for the outcome and give up when the proxy is gone.
@lukas-frey
lukas-frey added this pull request to the merge queue Nov 12, 2026
Merged via the queue into main with commit 6ad4a61 Nov 12, 2026
27 checks passed
@lukas-frey
lukas-frey deleted the feature/node-sites-proxy-commands branch November 12, 2026 17:40
lukas-frey added a commit that referenced this pull request Nov 13, 2026
Also translates the Node.js site and proxy command texts from #151.
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.

Start/stop proxy via UI Feature request: serve a Node.js app (Next.js, Nuxt, Vite) as a site, with Flock running its dev server

3 participants