Commit 1e333c2
refactor(cli): port start-services.sh to TypeScript (NVIDIA#1307)
## Summary
Closes NVIDIA#1297. Part of NVIDIA#924 shell consolidation (PR 2 scope).
Ports the PID-managed service lifecycle (start/stop/status for
telegram-bridge and cloudflared) from `scripts/start-services.sh` to
`nemoclaw/src/lib/services.ts`:
- Uses `execa` with `detached: true` + `unref()` for background service
spawning (replaces `nohup`)
- Native `process.kill(pid, 0)` for liveness checks (replaces `kill -0`)
- File-based PID management preserved
(`/tmp/nemoclaw-services-{sandbox}/`)
- `bin/nemoclaw.js` start/stop/status now call the TS module directly
instead of `bash scripts/start-services.sh`
- `scripts/start-services.sh` kept — still used by remote deploy (`ssh
... bash scripts/start-services.sh`) and `uninstall.sh`
Pattern:
1. TS source in `nemoclaw/src/lib/services.ts` with flat
`ServiceOptions` interface
2. Thin CJS shim in `bin/lib/services.js`
3. Tests in `src/lib/services.test.ts` importing from
`../../dist/lib/services` for coverage
## Test plan
- [x] `npx vitest run --project plugin` — 201 tests pass (includes new
services tests)
- [x] `npx vitest run --project cli` — 336 tests pass
- [x] `npx vitest run test/service-env.test.js` — 11 tests pass (bash
script still works)
- [x] `npx eslint nemoclaw/src/lib/services.ts` — clean
- [x] Pre-commit hooks pass (prettier, eslint, gitleaks, tsc, vitest)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit
* **New Features**
* Service management to start, stop, monitor background services and
report statuses, including public connectivity URLs when available
* Installer now detects when the user’s shell needs reloading and shows
a conditional reload hint
* CLI start/stop/status commands now use the integrated service manager
for in-process control
* **Bug Fixes**
* More robust handling of stale/invalid PID files and safer service
shutdown behavior
* **Tests**
* Added comprehensive tests for service behaviors and installer reload
hint detection
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
---------
Co-authored-by: Prekshi Vyas <prekshivyas@nvidia.com>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Carlos Villela <cvillela@nvidia.com>1 parent 02ea637 commit 1e333c2
File tree
5 files changed
+561
-5
lines changed- bin
- lib
- src/lib
- test
5 files changed
+561
-5
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
782 | 782 | | |
783 | 783 | | |
784 | 784 | | |
| 785 | + | |
785 | 786 | | |
786 | 787 | | |
787 | 788 | | |
788 | | - | |
789 | | - | |
| 789 | + | |
790 | 790 | | |
791 | 791 | | |
792 | 792 | | |
793 | | - | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
794 | 798 | | |
795 | 799 | | |
796 | 800 | | |
| |||
865 | 869 | | |
866 | 870 | | |
867 | 871 | | |
868 | | - | |
| 872 | + | |
| 873 | + | |
869 | 874 | | |
870 | 875 | | |
871 | 876 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 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 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
0 commit comments