Skip to content

Add git task web subcommand (start/stop/status) - #7

Merged
imohsenb merged 2 commits into
mainfrom
web-subcommand
Aug 7, 2026
Merged

Add git task web subcommand (start/stop/status)#7
imohsenb merged 2 commits into
mainfrom
web-subcommand

Conversation

@imohsenb

@imohsenb imohsenb commented Aug 7, 2026

Copy link
Copy Markdown
Owner

Summary

  • New git task web start/stop/status manages the companion git-task-web server as a detached background process.
  • First start installs git-task-web via npm install --prefix ~/.local/share/git-task/web git-task-web@latest if missing — prompts interactively, or pass --yes for non-interactive/CI use. Requires node/npm on PATH.
  • State (pid/host/port) tracked in ~/.local/share/git-task/web.state; combined stdout+stderr logged to web.log.
  • Liveness/stop use real Unix signals (libc::kill, SIGTERM then SIGKILL after 5s) — new libc dependency.
  • Spawn uses setsid() (via pre_exec) so the server survives the invoking shell exiting — verified this was necessary: a plain Command::spawn() leaves the child in the same session, and it died when that session tore down.

Known limitation

git-task-web isn't published to npm yet, so git task web start will currently fail with an ordinary npm 404 until it is. Verified that failure path is clean (proper error, exit 1, no crash).

Test plan

  • cargo build — clean
  • cargo test — all unit + integration tests pass (98 lib tests incl. new web::process tests, all integration suites)
  • Manual end-to-end: packed git-task-web into a local tarball, installed it into the expected layout, then verified start → spawns, confirms readiness, prints URL; status while running; duplicate start correctly detects already-running; stop sends SIGTERM and the process actually exits (confirmed via ps); status after stop reports not running
  • Confirmed via ps -o pid,ppid that the spawned server reparents to ppid=1 and keeps serving (curl 200) across separate CLI invocations, seconds apart

Manages the companion git-task-web server as a detached background
process. First `start` installs it via npm if missing (prompts unless
--yes), then spawns it with a real setsid detach so it survives the
invoking shell exiting — a plain spawn left it in the same session and
it died when that session tore down. State (pid/host/port) lives under
a new machine-local data dir (~/.local/share/git-task), liveness/stop
use libc kill signals.
CI rejects a PR whose Cargo.toml version isn't above the latest
release tag.
@imohsenb
imohsenb merged commit a55ee98 into main Aug 7, 2026
5 checks passed
@imohsenb
imohsenb deleted the web-subcommand branch August 7, 2026 17:05
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