-
Notifications
You must be signed in to change notification settings - Fork 0
feat(daemon): add types and lifecycle management #83
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
Open
galligan
wants to merge
2
commits into
p3-20/index/fts5-impl
Choose a base branch
from
p3-21/daemon/types-lifecycle
base: p3-20/index/fts5-impl
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+621
−0
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This was referenced Jan 23, 2026
Contributor
Author
This was referenced Jan 23, 2026
b50f9a7 to
aff813d
Compare
08412d8 to
8754855
Compare
This was referenced Jan 23, 2026
097c3aa to
608a423
Compare
8754855 to
2c791c5
Compare
This was referenced Jan 23, 2026
2c791c5 to
dfbbb85
Compare
608a423 to
b8d09c1
Compare
This was referenced Jan 23, 2026
Greptile Summary
|
| Filename | Overview |
|---|---|
| packages/daemon/src/lifecycle.ts | New daemon implementation with PID file management, signal handling, and graceful shutdown with timeout protection |
| packages/daemon/src/types.ts | New comprehensive type definitions including DaemonError, DaemonState enum, and daemon interfaces |
Confidence score: 4/5
- This PR introduces well-structured daemon lifecycle management with proper error handling and follows established repository patterns
- Score reflects solid implementation but potential complexity in concurrent shutdown scenarios and signal handler cleanup timing
- Pay close attention to
packages/daemon/src/lifecycle.tsfor shutdown re-entry logic and signal handler management
Sequence Diagram
sequenceDiagram
participant User
participant Daemon
participant PIDFile as "PID File System"
participant SignalHandler as "Signal Handler"
participant ShutdownHandler as "Shutdown Handler"
User->>Daemon: "start()"
Daemon->>Daemon: "Check if already running"
Daemon->>PIDFile: "Check if PID file exists"
PIDFile-->>Daemon: "File status"
Daemon->>PIDFile: "Write PID file"
PIDFile-->>Daemon: "Success"
Daemon->>SignalHandler: "Register SIGTERM/SIGINT handlers"
SignalHandler-->>Daemon: "Handlers registered"
Daemon-->>User: "Result.ok()"
Note over Daemon: Daemon is now running
User->>Daemon: "onShutdown(handler)"
Daemon->>Daemon: "Add to shutdown handlers list"
SignalHandler->>Daemon: "SIGTERM/SIGINT received"
Daemon->>Daemon: "Set state to stopping"
Daemon->>ShutdownHandler: "Run all registered handlers"
ShutdownHandler-->>Daemon: "Handlers completed"
Daemon->>SignalHandler: "Remove signal handlers"
Daemon->>PIDFile: "Remove PID file"
PIDFile-->>Daemon: "File removed"
Daemon->>Daemon: "Set state to stopped"
User->>Daemon: "stop()"
Daemon->>Daemon: "Check if running"
Daemon->>ShutdownHandler: "Run all registered handlers"
ShutdownHandler-->>Daemon: "Handlers completed"
Daemon->>SignalHandler: "Remove signal handlers"
Daemon->>PIDFile: "Remove PID file"
PIDFile-->>Daemon: "File removed"
Daemon-->>User: "Result.ok()"
b8d09c1 to
86b969f
Compare
dfbbb85 to
2f370ee
Compare
Contributor
Author
|
Added a root entrypoint for @outfitter/daemon (exports types + createDaemon) and a basic smoke test so bun test no longer fails on empty suites. Also resolved the restack conflict to keep the IPC/health exports in index.ts. |
Add daemon process management infrastructure: - DaemonError: TaggedError for daemon failures - DaemonState: running, stopped, starting, stopping - DaemonOptions: PID file, signal handlers, cleanup hooks - Daemon interface: start, stop, status, isRunning - createDaemon() factory with PID file management - Graceful signal handling (SIGTERM, SIGINT) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2f370ee to
a1e44c2
Compare
86b969f to
c319824
Compare
Contributor
Author
|
Restacked after downstack update (formatRelative test stabilization); no additional changes in this PR. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.

Add daemon process management infrastructure:
Co-Authored-By: Claude Opus 4.5 noreply@anthropic.com
Contributes to #56