Commit 6f54296
feat: add daemon mode and --json output (#448)
* feat: add daemon mode and --json output for agent-friendly usage
- 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 #446
Co-Authored-By: Claude <noreply@anthropic.com>
* feat: add node stop command
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>
* ci: fix formatting, windows test paths, and add changeset
- 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>
* chore: change changeset level from minor to patch
Co-Authored-By: Claude <noreply@anthropic.com>
* fix(node): harden daemon lifecycle per test team review
- 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>
* test(node): make daemon lifecycle tests platform-aware for Windows CI
- 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>
---------
Co-authored-by: Claude <noreply@anthropic.com>1 parent b5b41e7 commit 6f54296
7 files changed
Lines changed: 883 additions & 10 deletions
File tree
- .changeset
- src
- cmd
- util
- tests
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
70 | 70 | | |
71 | 71 | | |
72 | 72 | | |
| 73 | + | |
73 | 74 | | |
74 | 75 | | |
75 | 76 | | |
| |||
118 | 119 | | |
119 | 120 | | |
120 | 121 | | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
121 | 156 | | |
122 | 157 | | |
123 | 158 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
32 | 40 | | |
33 | 41 | | |
34 | 42 | | |
35 | 43 | | |
36 | 44 | | |
37 | 45 | | |
38 | 46 | | |
39 | | - | |
40 | | - | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
41 | 50 | | |
42 | 51 | | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
43 | 57 | | |
44 | 58 | | |
45 | 59 | | |
| |||
0 commit comments