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)
| Option | Same as |
|---|---|
browser | --browser |
profile | --profile |
country | --country |
include | --include, as an array of codes |
siteTypes | --type, as an array |
subdomains | --subdomains |
dns | false is the same as --no-dns |
repo | --repo, an absolute path |
ignore | --ignore, as an array |
baseline | A parsed earlier result, as with --baseline |
maxRequests, timeoutMs | --max-requests, --timeout |
onStep | A 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
| Export | Purpose |
|---|---|
scanDirectory(dir, options) | The repository scan behind kagicyber scan |
renderMarkdown, renderHtml, renderFixPrompt, renderSarif, renderJunit | Report formats |
compareBaseline, applyIgnores, fingerprint | Baselines and ignore rules |
ruleCatalog() | Jurisdictions, site types and rule counts |
scanText, SECRET_PATTERNS | The secret detector on its own |
createServer, startServer | The HTTP API behind kagicyber serve |
VERSION, RULES_VERSION | Engine and rule base versions |