emergent-security/tools/export_knowledge.py
tegwick a835c11ae7 Implement source-backed NetKingdom agent security knowledge pilot
Assistant: codex
Assistant-Model: gpt-6-astra
Assistant-Session: 01a101af-e240-7882-a1e3-e37720cbdbea
2026-10-03 15:25:04 +02:00

26 lines
915 B
Python

#!/usr/bin/env python3
"""Export a self-contained orientation bundle into a new directory (no overwrite)."""
from pathlib import Path
import argparse
import shutil
import sys
sys.path.insert(0, str(Path(__file__).resolve().parents[1] / "src"))
from emergent_security.knowledge import Knowledge, confined
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("destination", type=Path)
args = parser.parse_args()
package = Knowledge()
args.destination.mkdir(parents=True, exist_ok=False)
for name in ["release.yaml", *package.release["files"]]:
target = confined(args.destination, name)
target.parent.mkdir(parents=True, exist_ok=True)
shutil.copyfile(confined(package.root, name), target)
print(f"Exported orientation-only package {package.catalog['version']} ({package.package_digest})")
if __name__ == "__main__":
main()