feat: add daemon mode and --json output#448
Merged
RetricSu merged 6 commits intoJul 8, 2026
Merged
Conversation
- Add --daemon flag to offckb node to run the devnet in the background - Add global --json flag for structured JSON log output - Write daemon PID and logs to devnet data folder - Add tests for logger JSON mode and node daemon spawning - Update README with daemon and --json usage Fixes ckb-devrel#446 Co-Authored-By: Claude <noreply@anthropic.com>
Add offckb node stop to terminate the devnet daemon started by offckb node --daemon. It reads the PID file, sends SIGTERM, waits for graceful shutdown, falls back to SIGKILL if needed, and removes the PID file. Also add tests and update README to mention node stop instead of manual kill. Co-Authored-By: Claude <noreply@anthropic.com>
- Run prettier so lint job's git diff --exit-code passes - Use path.join in node-command tests so Windows path assertions pass - Add changeset for daemon mode, --json output, and node stop command Co-Authored-By: Claude <noreply@anthropic.com>
Co-Authored-By: Claude <noreply@anthropic.com>
- Reject duplicate daemon starts when PID file points to a live process. - Verify target process identity before stopNode sends signals. - Harden CLI entry resolution with OFFCKB_CLI_PATH fallback and file validation. - Fix stopNode race condition between existsSync/readFileSync by reading once. - Always clean up PID file even when signal delivery fails. - Handle spawn sync exceptions, missing child.pid, and log dir creation failures. - Use taskkill on Windows to terminate the daemon process tree. - Distinguish EPERM vs ESRCH and surface clear error messages. Co-Authored-By: Claude <noreply@anthropic.com>
- Assert the resolved script path so Windows backslash normalization passes. - Mock WMIC output with the CommandLine= prefix required by the parser. - Normalize process.platform to linux in stop tests for deterministic POSIX signal assertions; the Windows taskkill path is covered by the daemon spawn tests and integration tests. Co-Authored-By: Claude <noreply@anthropic.com>
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
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.
This PR adds daemon mode and agent-friendly JSON output as requested in #446.
Changes
offckb node --daemonstarts the CKB devnet (node + miner + RPC proxy) as a detached background process. It writes a PID file and logs to the devnet data folder.offckb --json [command]emits every log line as a structured JSON object, making the CLI easier to consume programmatically or from agents.Usage
Fixes #446
🤖 Generated with Claude Code