Skip to content

Commit 4eb3d1f

Browse files
committed
docs: document daemon install helpers
1 parent 1180601 commit 4eb3d1f

8 files changed

Lines changed: 21 additions & 0 deletions
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
// Lazy runtime facade for checking whether auth profile sources exist during daemon install.
12
export { hasAnyAuthProfileStoreSource } from "../agents/auth-profiles/source-check.js";
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
// Lazy runtime facade for loading auth profiles during daemon service environment planning.
12
export { loadAuthProfileStoreForSecretsRuntime } from "../agents/auth-profiles/store.js";

src/commands/daemon-install-helpers.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Gateway daemon install plan builder, including service env and SecretRef passthrough policy.
12
import fs from "node:fs";
23
import os from "node:os";
34
import path from "node:path";
@@ -441,6 +442,7 @@ const PRESERVED_OPENCLAW_OPERATOR_OPT_IN_ENV_KEYS = new Set([
441442
"OPENCLAW_CONTAINER_HINT",
442443
]);
443444

445+
/** Preserve safe operator-owned env vars from an existing service definition. */
444446
export function collectPreservedExistingServiceEnvVars(
445447
existingEnvironment: Record<string, string | undefined> | undefined,
446448
managedServiceEnvKeys: Set<string>,
@@ -596,6 +598,7 @@ async function buildGatewayInstallEnvironment(params: {
596598
};
597599
}
598600

601+
/** Build command, working directory, and environment for installing the Gateway service. */
599602
export async function buildGatewayInstallPlan(params: {
600603
env: Record<string, string | undefined>;
601604
port: number;
@@ -722,6 +725,7 @@ function omitEnvKey(
722725
return next;
723726
}
724727

728+
/** Return the user-facing recovery hint for failed Gateway service installation. */
725729
export function gatewayInstallErrorHint(platform = process.platform): string {
726730
return platform === "win32"
727731
? "Tip: native Windows now falls back to a per-user Startup-folder login item when Scheduled Task creation is denied; if install still fails, rerun from an elevated PowerShell or skip service install."

src/commands/daemon-install-plan.shared.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Shared daemon install runtime/path helpers for service plan generation.
12
import fs from "node:fs";
23
import path from "node:path";
34
import { resolvePreferredNodePath } from "../daemon/runtime-paths.js";
@@ -7,12 +8,14 @@ import {
78
} from "./daemon-install-runtime-warning.js";
89
import type { GatewayDaemonRuntime } from "./daemon-runtime.js";
910

11+
/** Detect source-checkout dev mode from the current CLI entrypoint. */
1012
export function resolveGatewayDevMode(argv: string[] = process.argv): boolean {
1113
const entry = argv[1];
1214
const normalizedEntry = entry?.replaceAll("\\", "/");
1315
return normalizedEntry?.includes("/src/") && normalizedEntry.endsWith(".ts");
1416
}
1517

18+
/** Resolve dev-mode and Node path inputs for daemon service install planning. */
1619
export async function resolveDaemonInstallRuntimeInputs(params: {
1720
env: Record<string, string | undefined>;
1821
runtime: GatewayDaemonRuntime;
@@ -29,6 +32,7 @@ export async function resolveDaemonInstallRuntimeInputs(params: {
2932
return { devMode, nodePath };
3033
}
3134

35+
/** Emit runtime warnings for daemon install command arguments. */
3236
export async function emitDaemonInstallRuntimeWarning(params: {
3337
env: Record<string, string | undefined>;
3438
runtime: GatewayDaemonRuntime;
@@ -45,6 +49,7 @@ export async function emitDaemonInstallRuntimeWarning(params: {
4549
});
4650
}
4751

52+
/** Return the Node binary directory that should be added to daemon PATH. */
4853
export function resolveDaemonNodeBinDir(nodePath?: string): string[] | undefined {
4954
const trimmed = nodePath?.trim();
5055
if (!trimmed || !path.isAbsolute(trimmed)) {
@@ -86,6 +91,7 @@ function addUniquePathDir(dirs: string[], dir: string | undefined): void {
8691
dirs.push(dir);
8792
}
8893

94+
/** Resolve the OpenClaw CLI binary directory from argv/PATH for daemon PATH. */
8995
export function resolveDaemonOpenClawBinDir(
9096
params: {
9197
argv?: string[];
@@ -133,6 +139,7 @@ export function resolveDaemonOpenClawBinDir(
133139
return dirs.length > 0 ? dirs : undefined;
134140
}
135141

142+
/** Merge Node and OpenClaw binary directories for the daemon service PATH. */
136143
export function resolveDaemonServicePathDirs(params: {
137144
nodePath?: string;
138145
argv?: string[];

src/commands/daemon-install-runtime-warning.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1+
// Runtime warning helpers for daemon install plans that depend on Node.
12
import { renderSystemNodeWarning, resolveSystemNodeInfo } from "../daemon/runtime-paths.js";
23

34
export type DaemonInstallWarnFn = (message: string, title?: string) => void;
45

6+
/** Warn when daemon install will use a system Node path that may be unsuitable. */
57
export async function emitNodeRuntimeWarning(params: {
68
env: Record<string, string | undefined>;
79
runtime: string;

src/commands/daemon-runtime.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Gateway daemon runtime option definitions used by install/configure flows.
12
export type GatewayDaemonRuntime = "node" | "bun";
23

34
export const DEFAULT_GATEWAY_DAEMON_RUNTIME: GatewayDaemonRuntime = "node";
@@ -14,6 +15,7 @@ export const GATEWAY_DAEMON_RUNTIME_OPTIONS: Array<{
1415
},
1516
];
1617

18+
/** Narrow arbitrary input to a supported Gateway daemon runtime id. */
1719
export function isGatewayDaemonRuntime(value: string | undefined): value is GatewayDaemonRuntime {
1820
return value === "node" || value === "bun";
1921
}

src/commands/dashboard.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Implements `openclaw dashboard` URL resolution, readiness check, clipboard, and browser launch.
12
import { readConfigFileSnapshot, resolveGatewayPort } from "../config/config.js";
23
import { resolveGatewayAuthToken } from "../gateway/auth-token-resolution.js";
34
import { copyToClipboard } from "../infra/clipboard.js";
@@ -57,6 +58,7 @@ async function resolveDashboardTarget() {
5758
};
5859
}
5960

61+
/** Open or print the Control UI dashboard URL after ensuring the Gateway is reachable. */
6062
export async function dashboardCommand(
6163
runtime: RuntimeEnv = defaultRuntime,
6264
options: DashboardOptions = {},

src/commands/docs.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// Implements docs link/search output for `openclaw docs`.
12
import { formatDocsLink } from "../../packages/terminal-core/src/links.js";
23
import { isRich, theme } from "../../packages/terminal-core/src/theme.js";
34
import { formatCliCommand } from "../cli/command-format.js";
@@ -104,6 +105,7 @@ function parseDocsSearchResults(raw: unknown): DocResult[] {
104105
return results;
105106
}
106107

108+
/** Search hosted docs, or print the docs homepage when no query is provided. */
107109
export async function docsSearchCommand(queryParts: string[], runtime: RuntimeEnv) {
108110
const query = queryParts.join(" ").trim();
109111
if (!query) {

0 commit comments

Comments
 (0)