chore: fix redaction lint
This commit is contained in:
@@ -330,7 +330,9 @@ export const ClawdbotSchema = z.object({
|
||||
consoleStyle: z
|
||||
.union([z.literal("pretty"), z.literal("compact"), z.literal("json")])
|
||||
.optional(),
|
||||
redactSensitive: z.union([z.literal("off"), z.literal("tools")]).optional(),
|
||||
redactSensitive: z
|
||||
.union([z.literal("off"), z.literal("tools")])
|
||||
.optional(),
|
||||
redactPatterns: z.array(z.string()).optional(),
|
||||
})
|
||||
.optional(),
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import { loadConfig } from "../config/config.js";
|
||||
import type { LoggingConfig } from "../config/types.js";
|
||||
|
||||
export type RedactSensitiveMode = "off" | "tools";
|
||||
|
||||
@@ -88,10 +87,8 @@ function redactMatch(match: string, groups: string[]): string {
|
||||
function redactText(text: string, patterns: RegExp[]): string {
|
||||
let next = text;
|
||||
for (const pattern of patterns) {
|
||||
next = next.replace(
|
||||
pattern,
|
||||
(...args: string[]) =>
|
||||
redactMatch(args[0], args.slice(1, args.length - 2)),
|
||||
next = next.replace(pattern, (...args: string[]) =>
|
||||
redactMatch(args[0], args.slice(1, args.length - 2)),
|
||||
);
|
||||
}
|
||||
return next;
|
||||
|
||||
Reference in New Issue
Block a user