#!/usr/bin/env python3 """ Generate per-source-file Strix instruction markdowns for Z/src and a simple runner. Run this script from the repo root to (re)generate instruction files. """ import os from pathlib import Path ROOT = Path(__file__).resolve().parents[2] SRC_DIR = ROOT / 'Z' / 'src' OUT_DIR = ROOT / 'tests' / 'strix' / 'Z' OUT_DIR.mkdir(parents=True, exist_ok=True) TEMPLATE = """# Strix instruction for {rel_path} Please perform a focused White-box security assessment of the repository area containing the file `{rel_path}`. Scope: - Focus analysis on the code in: `{rel_path}` - Treat this as a white-box scan: use source code to prioritize findings and generate PoCs - If applicable, attempt to reproduce vulnerabilities (in PoC) and provide remediation guidance Notes for Strix: - Use `--scan-mode quick` for fast checks or `--scan-mode standard` for deeper analysis - Use `--instruction-file` with this file when invoking strix CLI Do NOT run active exploitation against third-party services. Only analyze code in-repo. """ count = 0 for path in sorted(SRC_DIR.rglob('*.cpp')): rel = path.relative_to(ROOT) out = OUT_DIR / (str(path.relative_to(SRC_DIR)).replace(os.sep, '__') + '.md') out.write_text(TEMPLATE.format(rel_path=str(rel))) count += 1 print(f"Wrote {count} instruction files to {OUT_DIR}")