<!-- Copyright (c) 2026 defconxt. All rights reserved. -->
<!-- Licensed under AGPL-3.0 — see LICENSE file for details. -->
<!-- NERF is a trademark of defconxt. -->
# Implementing Threat Library Management — API Reference

## agent.js CLI

```bash
# Init action
node scripts/agent.js --action init

# Import action
node scripts/agent.js --action import

# Add action
node scripts/agent.js --action add

# Search action
node scripts/agent.js --action search

# Export action
node scripts/agent.js --action export
```

## Threat Library Entry Schema

```json
{
  "id": "TL-001",
  "name": "SQL Injection",
  "category": "Tampering",
  "capec": "CAPEC-66",
  "cwe": "CWE-89",
  "applicability": ["web-api", "database-backed"],
  "mitigations": [
    {"control": "Parameterized queries", "effectiveness": "high"},
    {"control": "Input validation", "effectiveness": "medium"}
  ],
  "confidence": "confirmed"
}
```

## Library Search Output

```json
{
  "query": "injection",
  "results": [
    {"id": "TL-C001", "name": "SQL Injection", "category": "Tampering"},
    {"id": "TL-C004", "name": "Command Injection", "category": "Elevation of Privilege"}
  ],
  "count": 2
}
```
