openclaw/src/cli
artale b1d5c71609 fix(cli): use standalone script for service restart after update (#17225)
The updater was previously attempting to restart the service using the
installed codebase, which could be in an inconsistent state during the
update process. This caused the service to stall when the updater
deleted its own files before the restart could complete.

Changes:
- restart-helper.ts: new module that writes a platform-specific restart
  script to os.tmpdir() before the update begins (Linux systemd, macOS
  launchctl, Windows schtasks).
- update-command.ts: prepares the restart script before installing, then
  uses it for service restart instead of the standard runDaemonRestart.
- restart-helper.test.ts: 12 tests covering all platforms, custom
  profiles, error cases, and shell injection safety.

Review feedback addressed:
- Use spawn(detached: true) + unref() so restart script survives parent
  process termination (Greptile).
- Shell-escape profile values using single-quote wrapping to prevent
  injection via OPENCLAW_PROFILE (Greptile).
- Reject unsafe batch characters on Windows.
- Self-cleanup: scripts delete themselves after execution (Copilot).
- Add tests for write failures and custom profiles (Copilot).

Fixes #17225
2026-02-17 00:00:16 +01:00
..
browser-cli-actions-input refactor(cli): share browser resize output helper 2026-02-15 18:25:47 +00:00
cron-cli Centralize date/time formatting utilities (#11831) 2026-02-08 04:53:31 -08:00
daemon-cli fix: include token drift warning in JSON response 2026-02-16 23:59:50 +01:00
gateway-cli fix: respect OPENCLAW_HOME for isolated gateway instances 2026-02-16 23:52:16 +01:00
node-cli CLI: improve command descriptions in help output (#18486) 2026-02-16 22:06:25 +01:00
nodes-cli CLI: improve command descriptions in help output (#18486) 2026-02-16 22:06:25 +01:00
program CLI: preserve message send components payload 2026-02-16 23:54:08 +01:00
shared refactor(cli): dedupe parsePort 2026-02-15 04:02:10 +00:00
update-cli fix(cli): use standalone script for service restart after update (#17225) 2026-02-17 00:00:16 +01:00
acp-cli.ts fix: ensure CLI exits after command completion (#12906) 2026-02-14 00:34:33 +01:00
argv.test.ts perf(cli): reduce read-only startup overhead 2026-02-14 01:18:44 +00:00
argv.ts perf(cli): reduce read-only startup overhead 2026-02-14 01:18:44 +00:00
banner.ts chore: Enable "curly" rule to avoid single-statement if confusion/errors. 2026-01-31 16:19:20 +09:00
browser-cli-actions-input.ts refactor(src): split oversized modules 2026-01-14 01:17:56 +00:00
browser-cli-actions-observe.ts chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts. 2026-02-01 10:03:47 +09:00
browser-cli-debug.ts Security/Browser: constrain trace and download output paths to OpenClaw temp roots (#15652) 2026-02-13 19:24:33 +00:00
browser-cli-examples.ts fix(security): harden archive extraction (#16203) 2026-02-14 14:42:08 +01:00
browser-cli-extension.test.ts perf(test): speed up suites and reduce fs churn 2026-02-15 19:29:27 +00:00
browser-cli-extension.ts perf(test): remove extra module resets in cli and message suites 2026-02-13 16:08:38 +00:00
browser-cli-inspect.test.ts chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts. 2026-02-01 10:03:47 +09:00
browser-cli-inspect.ts chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts. 2026-02-01 10:03:47 +09:00
browser-cli-manage.ts refactor(cli): dedupe browser tab listing output 2026-02-15 05:35:49 +00:00
browser-cli-resize.ts refactor(cli): share browser resize output helper 2026-02-15 18:25:47 +00:00
browser-cli-shared.ts refactor(cli): share browser resize request 2026-02-15 05:08:08 +00:00
browser-cli-state.cookies-storage.ts chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts. 2026-02-01 10:03:47 +09:00
browser-cli-state.ts refactor(cli): dedupe browser and hooks command handlers 2026-02-16 17:57:45 +00:00
browser-cli.test.ts revert: Switch back to `tsc` for compiling. 2026-01-31 18:31:49 +09:00
browser-cli.ts chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts. 2026-02-01 10:03:47 +09:00
channel-auth.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
channel-options.ts chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts. 2026-02-01 10:03:47 +09:00
channels-cli.ts CLI: improve command descriptions in help output (#18486) 2026-02-16 22:06:25 +01:00
clawbot-cli.ts CLI/Gateway: restore qr flow with --remote support (clean) (#18091) 2026-02-16 14:48:14 +00:00
cli-name.ts chore: Enable "curly" rule to avoid single-statement if confusion/errors. 2026-01-31 16:19:20 +09:00
cli-utils.test.ts perf(test): consolidate CLI utility tests 2026-02-16 00:18:27 +00:00
cli-utils.ts refactor: consolidate duplicate utility functions (#12439) 2026-02-08 23:59:43 -08:00
command-format.ts chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts. 2026-02-01 10:03:47 +09:00
command-options.ts chore: migrate to oxlint and oxfmt 2026-01-14 15:02:19 +00:00
completion-cli.ts perf(cli): speed up startup 2026-02-14 12:21:44 +00:00
config-cli.test.ts refactor(agent): dedupe harness and command workflows 2026-02-16 14:59:30 +00:00
config-cli.ts CLI: improve command descriptions in help output (#18486) 2026-02-16 22:06:25 +01:00
cron-cli.test.ts refactor(agent): dedupe harness and command workflows 2026-02-16 14:59:30 +00:00
cron-cli.ts refactor(src): split oversized modules 2026-01-14 01:17:56 +00:00
daemon-cli-compat.test.ts fix (cli): harden daemon compat shim for minimal bundle exports 2026-02-14 20:53:32 -08:00
daemon-cli-compat.ts fix (cli): harden daemon compat shim for minimal bundle exports 2026-02-14 20:53:32 -08:00
daemon-cli.coverage.e2e.test.ts test: migrate suites to e2e coverage layout 2026-02-13 14:28:22 +00:00
daemon-cli.ts refactor(cli): share gateway service subcommands 2026-02-15 04:44:23 +00:00
deps.test.ts fix: ensure CLI exits after command completion (#12906) 2026-02-14 00:34:33 +01:00
deps.ts fix: ensure CLI exits after command completion (#12906) 2026-02-14 00:34:33 +01:00
devices-cli.ts Centralize date/time formatting utilities (#11831) 2026-02-08 04:53:31 -08:00
directory-cli.ts CLI: improve command descriptions in help output (#18486) 2026-02-16 22:06:25 +01:00
dns-cli.ts chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts. 2026-02-01 10:03:47 +09:00
docs-cli.ts chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts. 2026-02-01 10:03:47 +09:00
exec-approvals-cli.test.ts perf(test): cut setup/import overhead in hot suites 2026-02-13 21:23:50 +00:00
exec-approvals-cli.ts refactor(cli): dedupe approvals allowlist actions 2026-02-15 14:14:39 +00:00
gateway-cli.coverage.e2e.test.ts refactor(agent): dedupe harness and command workflows 2026-02-16 14:59:30 +00:00
gateway-cli.ts refactor(src): split oversized modules 2026-01-14 01:17:56 +00:00
gateway-rpc.ts fix(cron): fix timeout, add timestamp validation, enable file sync 2026-02-04 01:03:59 -08:00
gateway.sigterm.e2e.test.ts test: migrate suites to e2e coverage layout 2026-02-13 14:28:22 +00:00
help-format.ts chore: Enable "curly" rule to avoid single-statement if confusion/errors. 2026-01-31 16:19:20 +09:00
hooks-cli.test.ts refactor(agent): dedupe harness and command workflows 2026-02-16 14:59:30 +00:00
hooks-cli.ts refactor(cli): dedupe browser and hooks command handlers 2026-02-16 17:57:45 +00:00
logs-cli.test.ts refactor(agent): dedupe harness and command workflows 2026-02-16 14:59:30 +00:00
logs-cli.ts refactor(logging): share local iso timestamp format 2026-02-16 02:32:59 +00:00
memory-cli.test.ts refactor(test): dedupe agent and memory cli test setup 2026-02-16 17:57:45 +00:00
memory-cli.ts CLI: improve command descriptions in help output (#18486) 2026-02-16 22:06:25 +01:00
models-cli.test.ts perf(models): lazy-load heavy deps in models list 2026-02-15 19:29:27 +00:00
models-cli.ts chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts. 2026-02-01 10:03:47 +09:00
node-cli.ts fix: resolve ci failures 2026-01-18 08:45:29 +00:00
nodes-camera.test.ts test: consolidate nodes screen helpers 2026-02-16 02:45:00 +00:00
nodes-camera.ts feat: Android companion app improvements & gateway URL camera payloads (#13541) 2026-02-13 16:49:28 +01:00
nodes-canvas.ts chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts. 2026-02-01 10:03:47 +09:00
nodes-cli.coverage.test.ts fix(gateway): bind system.run approvals to exec approvals 2026-02-14 13:27:45 +01:00
nodes-cli.ts refactor(src): split oversized modules 2026-01-14 01:17:56 +00:00
nodes-run.ts chore: Enable "curly" rule to avoid single-statement if confusion/errors. 2026-01-31 16:19:20 +09:00
nodes-screen.ts chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts. 2026-02-01 10:03:47 +09:00
outbound-send-deps.ts style: oxfmt format 2026-01-17 05:48:56 +00:00
pairing-cli.test.ts feat (cli): add account selector for pairing commands 2026-02-15 19:10:06 -08:00
pairing-cli.ts feat (cli): add account selector for pairing commands 2026-02-15 19:10:06 -08:00
parse-bytes.ts fix: unify session maintenance and cron run pruning (#13083) 2026-02-09 20:42:35 -08:00
parse-duration.ts chore: Enable "curly" rule to avoid single-statement if confusion/errors. 2026-01-31 16:19:20 +09:00
parse-timeout.ts chore: Enable "curly" rule to avoid single-statement if confusion/errors. 2026-01-31 16:19:20 +09:00
plugin-registry.ts perf(test): speed up vitest by skipping plugins + LLM slug 2026-02-12 17:15:43 +00:00
plugins-cli.ts CLI: improve command descriptions in help output (#18486) 2026-02-16 22:06:25 +01:00
ports.ts chore: We have a sleep at home. The sleep at home: 2026-02-02 21:44:02 +09:00
profile-utils.ts chore: Enable "curly" rule to avoid single-statement if confusion/errors. 2026-01-31 16:19:20 +09:00
profile.test.ts fix(paths): structurally resolve home dir to prevent Windows path bugs (#12125) 2026-02-08 20:06:29 -05:00
profile.ts fix(paths): respect OPENCLAW_HOME for all internal path resolution (#12091) 2026-02-08 16:20:13 -05:00
program.force.test.ts chore: Enable "curly" rule to avoid single-statement if confusion/errors. 2026-01-31 16:19:20 +09:00
program.nodes-basic.e2e.test.ts agents: reduce prompt token bloat from exec and context (#16539) 2026-02-14 18:32:45 -05:00
program.nodes-media.e2e.test.ts refactor(agent): dedupe harness and command workflows 2026-02-16 14:59:30 +00:00
program.smoke.e2e.test.ts fix(test): tolerate runtime exit in cli smoke 2026-02-14 22:30:21 +00:00
program.test-mocks.ts fix(ci): repair e2e mocks and tool schemas 2026-02-15 23:14:42 +00:00
program.ts refactor(src): split oversized modules 2026-01-14 01:17:56 +00:00
progress.test.ts chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts. 2026-02-01 10:03:47 +09:00
progress.ts chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts. 2026-02-01 10:03:47 +09:00
prompt.test.ts chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts. 2026-02-01 10:03:47 +09:00
prompt.ts chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts. 2026-02-01 10:03:47 +09:00
qr-cli.test.ts refactor(tests): share harnesses for cli and monitor fixtures 2026-02-16 17:06:40 +00:00
qr-cli.ts CLI: restore and harden qr --remote pairing behavior (#18166) 2026-02-16 15:38:07 +00:00
requirements-test-fixtures.ts refactor(agent): dedupe harness and command workflows 2026-02-16 14:59:30 +00:00
respawn-policy.ts perf(cli): speed up help/config paths and route config get/unset 2026-02-14 00:27:35 +00:00
route.ts perf(cli): slim route-first bootstrap with lazy route handlers 2026-02-14 00:12:23 +00:00
run-main.exit.test.ts fix: ensure CLI exits after command completion (#12906) 2026-02-14 00:34:33 +01:00
run-main.test.ts perf(cli): reduce read-only startup overhead 2026-02-14 01:18:44 +00:00
run-main.ts refactor(cli): share windows argv normalization 2026-02-14 15:39:46 +00:00
sandbox-cli.ts chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts. 2026-02-01 10:03:47 +09:00
security-cli.ts CLI: improve command descriptions in help output (#18486) 2026-02-16 22:06:25 +01:00
skills-cli.e2e.test.ts test: move skills-cli integration coverage to e2e lane 2026-02-16 06:13:46 +00:00
skills-cli.format.ts refactor(cli): reuse skill missing summary 2026-02-15 16:46:04 +00:00
skills-cli.test.ts refactor(agent): dedupe harness and command workflows 2026-02-16 14:59:30 +00:00
skills-cli.ts perf(cli): split skills formatting 2026-02-14 16:36:15 +00:00
system-cli.ts chore: Enable "experimentalSortImports" in Oxfmt and reformat all imorts. 2026-02-01 10:03:47 +09:00
tagline.ts chore: Enable "curly" rule to avoid single-statement if confusion/errors. 2026-01-31 16:19:20 +09:00
tui-cli.ts refactor: rename to openclaw 2026-01-30 03:16:21 +01:00
update-cli.test.ts refactor(agent): dedupe harness and command workflows 2026-02-16 14:59:30 +00:00
update-cli.ts CLI: improve command descriptions in help output (#18486) 2026-02-16 22:06:25 +01:00
wait.ts chore: format to 2-space and bump changelog 2025-11-26 00:53:53 +01:00
webhooks-cli.ts refactor(agent): dedupe harness and command workflows 2026-02-16 14:59:30 +00:00
windows-argv.ts refactor(cli): share windows argv normalization 2026-02-14 15:39:46 +00:00