import { loadDenylist, resolveConfigDir, saveDenylist } from "../lib/graph-prune.js";
import { withWriteEvent } from "../lib/log-ingest.js";
export async function graphPruneDenylistAdd(values) {
    return withWriteEvent({ tool: "graph-prune-denylist-add" }, () => Promise.resolve(graphPruneDenylistAddImpl(values)));
}
function graphPruneDenylistAddImpl(values) {
    const configDir = resolveConfigDir();
    const list = loadDenylist(configDir);
    const before = new Set(list.values);
    const added = [];
    const skipped = [];
    for (const raw of values) {
        const v = raw.trim();
        if (!v)
            continue;
        if (before.has(v)) {
            skipped.push(v);
        }
        else {
            before.add(v);
            added.push(v);
        }
    }
    if (added.length > 0) {
        saveDenylist(configDir, {
            values: [...before].sort(),
            updatedAt: new Date().toISOString(),
        });
    }
    return { added, skipped, totalAfter: before.size };
}
//# sourceMappingURL=graph-prune-denylist-add.js.map