Skip to content

Commit 1fb2e18

Browse files
committed
refactor: simplify cli conversions
1 parent 5c0d1c6 commit 1fb2e18

21 files changed

Lines changed: 24 additions & 25 deletions

File tree

packages/memory-host-sdk/src/host/backend-config.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,8 +372,9 @@ export function resolveMemoryBackendConfig(params: {
372372
const mergedExtraCollections = [
373373
...(params.cfg.agents?.defaults?.memorySearch?.qmd?.extraCollections ?? []),
374374
...(agentEntry?.memorySearch?.qmd?.extraCollections ?? []),
375-
].filter((value): value is MemoryQmdIndexPath =>
376-
Boolean(value && typeof value === "object" && typeof value.path === "string"),
375+
].filter(
376+
(value): value is MemoryQmdIndexPath =>
377+
value !== null && typeof value === "object" && typeof value.path === "string",
377378
);
378379

379380
// Combine QMD-specific paths with extraPaths and per-agent cross-agent collections.

scripts/ci-changed-scope.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ export function detectChangedScope(changedPaths) {
5050
let hasNonNativeNonDocs = false;
5151

5252
for (const rawPath of changedPaths) {
53-
const path = String(rawPath).trim();
53+
const path = rawPath.trim();
5454
if (!path) {
5555
continue;
5656
}

scripts/docs-link-audit.mjs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,7 @@ for (const abs of markdownFiles) {
110110
if (!match) {
111111
continue;
112112
}
113-
const permalink = String(match[1])
114-
.trim()
115-
.replace(/^['"]|['"]$/g, "");
113+
const permalink = match[1].trim().replace(/^['"]|['"]$/g, "");
116114
routes.add(normalizeRoute(permalink));
117115
}
118116

src/cli/config-cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ export async function runConfigSet(opts: {
11331133
if (removedGatewayAuthPaths.length > 0) {
11341134
runtime.log(
11351135
info(
1136-
`Removed inactive ${removedGatewayAuthPaths.join(", ")} for gateway.auth.mode=${String(nextConfig.gateway?.auth?.mode ?? "<unset>")}.`,
1136+
`Removed inactive ${removedGatewayAuthPaths.join(", ")} for gateway.auth.mode=${nextConfig.gateway?.auth?.mode ?? "<unset>"}.`,
11371137
),
11381138
);
11391139
}

src/cli/daemon-cli/install.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export async function runDaemonInstall(opts: DaemonInstallOptions) {
4848
fail("Invalid port");
4949
return;
5050
}
51-
const runtimeRaw = opts.runtime ? String(opts.runtime) : DEFAULT_GATEWAY_DAEMON_RUNTIME;
51+
const runtimeRaw = opts.runtime ? opts.runtime : DEFAULT_GATEWAY_DAEMON_RUNTIME;
5252
if (!isGatewayDaemonRuntime(runtimeRaw)) {
5353
fail('Invalid --runtime (use "node" or "bun")');
5454
return;

src/cli/logs-cli.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ export function registerLogsCli(program: Command) {
268268
let cursor: number | undefined;
269269
let first = true;
270270
const jsonMode = Boolean(opts.json);
271-
const pretty = !jsonMode && Boolean(process.stdout.isTTY) && !opts.plain;
271+
const pretty = !jsonMode && process.stdout.isTTY && !opts.plain;
272272
const rich = isRich() && opts.color !== false;
273273
const localTime =
274274
Boolean(opts.localTime) || (!!process.env.TZ && isValidTimeZone(process.env.TZ));

src/cli/node-cli/daemon.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export async function runNodeDaemonInstall(opts: NodeDaemonInstallOptions) {
9999
return;
100100
}
101101

102-
const runtimeRaw = opts.runtime ? String(opts.runtime) : DEFAULT_NODE_DAEMON_RUNTIME;
102+
const runtimeRaw = opts.runtime ? opts.runtime : DEFAULT_NODE_DAEMON_RUNTIME;
103103
if (!isNodeDaemonRuntime(runtimeRaw)) {
104104
fail('Invalid --runtime (use "node" or "bun")');
105105
return;

src/cli/nodes-cli/register.status.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ export function registerNodesStatusCommands(nodes: Command) {
234234
.requiredOption("--node <idOrNameOrIp>", "Node id, name, or IP")
235235
.action(async (opts: NodesRpcOpts) => {
236236
await runNodesCommand("describe", async () => {
237-
const nodeId = await resolveNodeId(opts, String(opts.node ?? ""));
237+
const nodeId = await resolveNodeId(opts, opts.node ?? "");
238238
const result = await callGatewayCli("node.describe", opts, {
239239
nodeId,
240240
});

src/cli/update-cli/shared.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ export async function tryWriteCompletionCache(root: string, jsonMode: boolean):
278278
}
279279

280280
if (result.status !== 0 && !jsonMode) {
281-
const stderr = (result.stderr ?? "").toString().trim();
281+
const stderr = (result.stderr ?? "").trim();
282282
const detail = stderr ? ` (${stderr})` : "";
283283
defaultRuntime.log(theme.warn(`Completion cache update failed${detail}.`));
284284
}

src/cli/update-cli/update-command.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ async function maybeRestartService(params: {
680680
process.env.OPENCLAW_UPDATE_IN_PROGRESS = "1";
681681
try {
682682
const interactiveDoctor =
683-
Boolean(process.stdin.isTTY) && !params.opts.json && params.opts.yes !== true;
683+
process.stdin.isTTY && !params.opts.json && params.opts.yes !== true;
684684
await doctorCommand(defaultRuntime, {
685685
nonInteractive: !interactiveDoctor,
686686
});

0 commit comments

Comments
 (0)