feat: implement runCommand wrapper and refactor command executions across modules

This commit is contained in:
Lauren ten Hoor
2026-02-13 10:50:35 +08:00
parent e55b7fa555
commit 83f1f1adf0
24 changed files with 209 additions and 178 deletions

View File

@@ -7,12 +7,9 @@
* - workerStart: Worker spawned/resumed for a task (→ project group)
* - workerComplete: Worker completed task (→ project group)
*/
import { execFile } from "node:child_process";
import { promisify } from "node:util";
import { log as auditLog } from "./audit.js";
import type { TickAction } from "./services/tick.js";
const execFileAsync = promisify(execFile);
import { runCommand } from "./run-command.js";
/** Per-event-type toggle. All default to true — set to false to suppress. */
export type NotificationConfig = Partial<Record<NotifyEvent["type"], boolean>>;
@@ -95,9 +92,9 @@ async function sendMessage(
workspaceDir: string,
): Promise<boolean> {
try {
await execFileAsync(
"openclaw",
await runCommand(
[
"openclaw",
"message",
"send",
"--channel",
@@ -108,7 +105,7 @@ async function sendMessage(
message,
"--json",
],
{ timeout: 30_000 },
{ timeoutMs: 30_000 },
);
return true;
} catch (err) {