mirror of
https://github.com/moltbot/moltbot.git
synced 2026-05-13 15:47:28 +00:00
chore: Enable no-unnecessary-template-expression lint rule.
This commit is contained in:
@@ -15,7 +15,6 @@
|
|||||||
"oxc/no-async-endpoint-handlers": "off",
|
"oxc/no-async-endpoint-handlers": "off",
|
||||||
"oxc/no-map-spread": "off",
|
"oxc/no-map-spread": "off",
|
||||||
"typescript/no-extraneous-class": "off",
|
"typescript/no-extraneous-class": "off",
|
||||||
"typescript/no-unnecessary-template-expression": "off",
|
|
||||||
"typescript/no-unsafe-type-assertion": "off",
|
"typescript/no-unsafe-type-assertion": "off",
|
||||||
"unicorn/consistent-function-scoping": "off",
|
"unicorn/consistent-function-scoping": "off",
|
||||||
"unicorn/require-post-message-target-origin": "off"
|
"unicorn/require-post-message-target-origin": "off"
|
||||||
|
|||||||
@@ -119,22 +119,22 @@ export class TwitchClientManager {
|
|||||||
log: (level, message) => {
|
log: (level, message) => {
|
||||||
switch (level) {
|
switch (level) {
|
||||||
case LogLevel.CRITICAL:
|
case LogLevel.CRITICAL:
|
||||||
this.logger.error(`${message}`);
|
this.logger.error(message);
|
||||||
break;
|
break;
|
||||||
case LogLevel.ERROR:
|
case LogLevel.ERROR:
|
||||||
this.logger.error(`${message}`);
|
this.logger.error(message);
|
||||||
break;
|
break;
|
||||||
case LogLevel.WARNING:
|
case LogLevel.WARNING:
|
||||||
this.logger.warn(`${message}`);
|
this.logger.warn(message);
|
||||||
break;
|
break;
|
||||||
case LogLevel.INFO:
|
case LogLevel.INFO:
|
||||||
this.logger.info(`${message}`);
|
this.logger.info(message);
|
||||||
break;
|
break;
|
||||||
case LogLevel.DEBUG:
|
case LogLevel.DEBUG:
|
||||||
this.logger.debug?.(`${message}`);
|
this.logger.debug?.(message);
|
||||||
break;
|
break;
|
||||||
case LogLevel.TRACE:
|
case LogLevel.TRACE:
|
||||||
this.logger.debug?.(`${message}`);
|
this.logger.debug?.(message);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -1458,8 +1458,7 @@ export function createExecTool(
|
|||||||
{
|
{
|
||||||
type: "text",
|
type: "text",
|
||||||
text:
|
text:
|
||||||
`${warningText}` +
|
`${warningText}Approval required (id ${approvalSlug}). ` +
|
||||||
`Approval required (id ${approvalSlug}). ` +
|
|
||||||
"Approve to run; updates will arrive after completion.",
|
"Approve to run; updates will arrive after completion.",
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@@ -1541,12 +1540,9 @@ export function createExecTool(
|
|||||||
content: [
|
content: [
|
||||||
{
|
{
|
||||||
type: "text",
|
type: "text",
|
||||||
text:
|
text: `${getWarningText()}Command still running (session ${run.session.id}, pid ${
|
||||||
`${getWarningText()}` +
|
run.session.pid ?? "n/a"
|
||||||
`Command still running (session ${run.session.id}, pid ${
|
}). Use process (list/poll/log/write/kill/clear/remove) for follow-up.`,
|
||||||
run.session.pid ?? "n/a"
|
|
||||||
}). ` +
|
|
||||||
"Use process (list/poll/log/write/kill/clear/remove) for follow-up.",
|
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
details: {
|
details: {
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ export function registerDirectoryCli(program: Command) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const tableWidth = Math.max(60, (process.stdout.columns ?? 120) - 1);
|
const tableWidth = Math.max(60, (process.stdout.columns ?? 120) - 1);
|
||||||
defaultRuntime.log(`${theme.heading("Self")}`);
|
defaultRuntime.log(theme.heading("Self"));
|
||||||
defaultRuntime.log(
|
defaultRuntime.log(
|
||||||
renderTable({
|
renderTable({
|
||||||
width: tableWidth,
|
width: tableWidth,
|
||||||
|
|||||||
@@ -71,7 +71,7 @@ export async function appendStatusAllDiagnosis(params: {
|
|||||||
};
|
};
|
||||||
|
|
||||||
lines.push("");
|
lines.push("");
|
||||||
lines.push(`${muted("Gateway connection details:")}`);
|
lines.push(muted("Gateway connection details:"));
|
||||||
for (const line of redactSecrets(params.connectionDetailsForReport)
|
for (const line of redactSecrets(params.connectionDetailsForReport)
|
||||||
.split("\n")
|
.split("\n")
|
||||||
.map((l) => l.trimEnd())) {
|
.map((l) => l.trimEnd())) {
|
||||||
@@ -116,7 +116,7 @@ export async function appendStatusAllDiagnosis(params: {
|
|||||||
const isTrivialLastErr = lastErrClean.length < 8 || lastErrClean === "}" || lastErrClean === "{";
|
const isTrivialLastErr = lastErrClean.length < 8 || lastErrClean === "}" || lastErrClean === "{";
|
||||||
if (lastErrClean && !isTrivialLastErr) {
|
if (lastErrClean && !isTrivialLastErr) {
|
||||||
lines.push("");
|
lines.push("");
|
||||||
lines.push(`${muted("Gateway last log line:")}`);
|
lines.push(muted("Gateway last log line:"));
|
||||||
lines.push(` ${muted(redactSecrets(lastErrClean))}`);
|
lines.push(` ${muted(redactSecrets(lastErrClean))}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,7 +179,7 @@ export async function appendStatusAllDiagnosis(params: {
|
|||||||
]);
|
]);
|
||||||
if (stderrTail.length > 0 || stdoutTail.length > 0) {
|
if (stderrTail.length > 0 || stdoutTail.length > 0) {
|
||||||
lines.push("");
|
lines.push("");
|
||||||
lines.push(`${muted(`Gateway logs (tail, summarized): ${logPaths.logDir}`)}`);
|
lines.push(muted(`Gateway logs (tail, summarized): ${logPaths.logDir}`));
|
||||||
lines.push(` ${muted(`# stderr: ${logPaths.stderrPath}`)}`);
|
lines.push(` ${muted(`# stderr: ${logPaths.stderrPath}`)}`);
|
||||||
for (const line of summarizeLogTail(stderrTail, { maxLines: 22 }).map(redactSecrets)) {
|
for (const line of summarizeLogTail(stderrTail, { maxLines: 22 }).map(redactSecrets)) {
|
||||||
lines.push(` ${muted(line)}`);
|
lines.push(` ${muted(line)}`);
|
||||||
@@ -236,7 +236,7 @@ export async function appendStatusAllDiagnosis(params: {
|
|||||||
})();
|
})();
|
||||||
if (healthErr) {
|
if (healthErr) {
|
||||||
lines.push("");
|
lines.push("");
|
||||||
lines.push(`${muted("Gateway health:")}`);
|
lines.push(muted("Gateway health:"));
|
||||||
lines.push(` ${muted(redactSecrets(healthErr))}`);
|
lines.push(` ${muted(redactSecrets(healthErr))}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -265,8 +265,7 @@ export async function runCronIsolatedAgentTurn(params: {
|
|||||||
if (suspiciousPatterns.length > 0) {
|
if (suspiciousPatterns.length > 0) {
|
||||||
logWarn(
|
logWarn(
|
||||||
`[security] Suspicious patterns detected in external hook content ` +
|
`[security] Suspicious patterns detected in external hook content ` +
|
||||||
`(session=${baseSessionKey}, patterns=${suspiciousPatterns.length}): ` +
|
`(session=${baseSessionKey}, patterns=${suspiciousPatterns.length}): ${suspiciousPatterns.slice(0, 3).join(", ")}`,
|
||||||
`${suspiciousPatterns.slice(0, 3).join(", ")}`,
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -355,7 +355,7 @@ export async function uninstallLaunchAgent({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isLaunchctlNotLoaded(res: { stdout: string; stderr: string; code: number }): boolean {
|
function isLaunchctlNotLoaded(res: { stdout: string; stderr: string; code: number }): boolean {
|
||||||
const detail = `${res.stderr || res.stdout}`.toLowerCase();
|
const detail = (res.stderr || res.stdout).toLowerCase();
|
||||||
return (
|
return (
|
||||||
detail.includes("no such process") ||
|
detail.includes("no such process") ||
|
||||||
detail.includes("could not find service") ||
|
detail.includes("could not find service") ||
|
||||||
|
|||||||
@@ -327,7 +327,7 @@ export async function uninstallScheduledTask({
|
|||||||
}
|
}
|
||||||
|
|
||||||
function isTaskNotRunning(res: { stdout: string; stderr: string; code: number }): boolean {
|
function isTaskNotRunning(res: { stdout: string; stderr: string; code: number }): boolean {
|
||||||
const detail = `${res.stderr || res.stdout}`.toLowerCase();
|
const detail = (res.stderr || res.stdout).toLowerCase();
|
||||||
return detail.includes("not running");
|
return detail.includes("not running");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -387,7 +387,7 @@ async function isSystemctlAvailable(): Promise<boolean> {
|
|||||||
if (res.code === 0) {
|
if (res.code === 0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
const detail = `${res.stderr || res.stdout}`.toLowerCase();
|
const detail = (res.stderr || res.stdout).toLowerCase();
|
||||||
return !detail.includes("not found");
|
return !detail.includes("not found");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -255,7 +255,7 @@ export function describeReplyTarget(msg: TelegramMessage): TelegramReplyTarget |
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const sender = reply ? buildSenderName(reply) : undefined;
|
const sender = reply ? buildSenderName(reply) : undefined;
|
||||||
const senderLabel = sender ? `${sender}` : "unknown sender";
|
const senderLabel = sender ?? "unknown sender";
|
||||||
|
|
||||||
return {
|
return {
|
||||||
id: reply?.message_id ? String(reply.message_id) : undefined,
|
id: reply?.message_id ? String(reply.message_id) : undefined,
|
||||||
|
|||||||
Reference in New Issue
Block a user