refactor: update memory skill loader, plugin config, and add privacy docs (#4905)

This commit is contained in:
Kartik
2026-04-22 17:15:19 +05:30
committed by GitHub
parent 32b74e18b7
commit f5dc825d47
21 changed files with 1734 additions and 189 deletions
+40
View File
@@ -0,0 +1,40 @@
/**
* JSON output helpers for agent-friendly CLI commands.
*/
function writeStdout(data: Record<string, unknown>): void {
process.stdout.write(JSON.stringify(data, null, 2) + "\n");
}
export function jsonOut(
opts: { json?: boolean },
data: Record<string, unknown>,
): boolean {
if (!opts.json) return false;
writeStdout(data);
return true;
}
export function jsonErr(
opts: { json?: boolean },
error: string,
): boolean {
if (!opts.json) return false;
writeStdout({ ok: false, error });
return true;
}
export function redactSecrets(
obj: Record<string, unknown>,
secretKeys: Set<string>,
): Record<string, unknown> {
const result = { ...obj };
for (const key of secretKeys) {
const val = result[key];
if (typeof val !== "string") continue;
result[key] = val.length <= 8
? val.slice(0, 2) + "***"
: val.slice(0, 4) + "..." + val.slice(-4);
}
return result;
}