Skip to content

docs/Reference

Library

Run audits from your own Node.js code and render every report format.

audit.mjs
import { audit, renderMarkdown, renderHtml, renderFixPrompt, renderSarif } from 'kagicyber';const result = await audit('example.com', { browser: false, profile: 'balanced' });console.log(result.scores);// { compliance: 58, complianceCoverage: 91, complianceCore: 71, security: 88, grade: 'B', seo: 62, seoCoverage: 100, risk: 'moderate' }for (const set of result.compliance.sets) console.log(`${set.name}: ${set.score}/100`);const report = renderMarkdown(result);const html = renderHtml(result);const prompt = renderFixPrompt(result);const sarif = renderSarif(result);

#audit(target, options)

OptionSame as
browser--browser
profile--profile
country--country
include--include, as an array of codes
siteTypes--type, as an array
subdomains--subdomains
dnsfalse is the same as --no-dns
repo--repo, an absolute path
ignore--ignore, as an array
baselineA parsed earlier result, as with --baseline
maxRequests, timeoutMs--max-requests, --timeout
onStepA callback with progress messages

#The result

The same JSON as kagicyber audit --json. The fields you will use most are scores, jurisdictions, penaltyJurisdiction, stack, compliance.checks and compliance.sets (each row with maxPenalty), security.findings, seo.checks, fixFirst, fixPack, strengths and notRun.

#Other exports

ExportPurpose
scanDirectory(dir, options)The repository scan behind kagicyber scan
renderMarkdown, renderHtml, renderFixPrompt, renderSarif, renderJunitReport formats
compareBaseline, applyIgnores, fingerprintBaselines and ignore rules
ruleCatalog()Jurisdictions, site types and rule counts
scanText, SECRET_PATTERNSThe secret detector on its own
createServer, startServerThe HTTP API behind kagicyber serve
VERSION, RULES_VERSIONEngine and rule base versions