refactor: consolidate agent/editor plugins under integrations/ (#5491)

Co-authored-by: Claude <noreply@anthropic.com>
This commit is contained in:
Kartik
2026-06-12 10:31:35 +05:30
committed by GitHub
co-authored by Claude
parent c676c2c458
commit 2c796d144f
295 changed files with 94 additions and 81 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;
}