Skip to content

Latest commit

 

History

History
67 lines (47 loc) · 2.33 KB

File metadata and controls

67 lines (47 loc) · 2.33 KB

AGENTS.md

Project Overview

lifecycle is a Go library for robust infrastructure signaling and interactive I/O. It allows applications to differentiate between "User Interrupts" and "System Terminations" while enforcing leak-free shutdowns.

For a detailed breakdown of the problems we solve (Zombie Processes, Blocking I/O, Dual Signals), see PRODUCT.md.

It is designed to be the foundational entry point for modern Go Applications (Services, Agents, CLIs).

Key Dependencies

  • procio v0.1.2: Process hygiene (PDeathSig, Job Objects) and interactive I/O (CONIN$ on Windows).
  • introspection v0.1.3: Generic visualization primitives (Mermaid diagram generation).

Project Structure & Documentation

Key Commands

Ensure dependencies are synced:

go mod tidy

Running Tests

go test -timeout 90s -race -v ./...
# or
make test

Running Coverage

Poweshell needs double quotes for file paths

go test -race -v -timeout 90s -coverprofile="coverage.out" ./...
go tool cover -func="coverage.out"
# or
make coverage

Running Examples

go run ./examples/hooks/main.go

Development Philosophy

  • Managed Global State: We abstract the inevitable global state (OS Signals) into clean, context-aware usage. Prefer Context propagation, but enjoy DefaultRouter convenience.
  • Leak-Free: Every resource (goroutine, file handle) must close on shutdown.
  • Platform Agnostic: Windows CONIN$ handling is a first-class citizen, not an afterthought.
  • Observability: Internal state changes must be visible via pkg/metrics interfaces.