-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathMakefile
More file actions
142 lines (120 loc) · 6.22 KB
/
Makefile
File metadata and controls
142 lines (120 loc) · 6.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# ─── CyberViser — Hancock Makefile ───────────────────────────
.DEFAULT_GOAL := help
PYTHON := .venv/bin/python
PIP := .venv/bin/pip
.PHONY: help setup install dev-install finetune-install run server pipeline pipeline-v3 finetune lint test test-cov fuzz fuzz-target clean docker docker-up fly-deploy client-python client-node
help:
@echo ""
@echo " ██╗ ██╗ █████╗ ███╗ ██╗ ██████╗ ██████╗ ██████╗██╗"
@echo " ██║ ██║██╔══██╗████╗ ██║██╔════╝██╔═══██╗██╔════╝██║"
@echo " ███████║███████║██╔██╗ ██║██║ ██║ ██║██║ ██║"
@echo " ██╔══██║██╔══██║██║╚██╗██║██║ ██║ ██║██║ ██╚"
@echo " ██║ ██║██║ ██║██║ ╚████║╚██████╗╚██████╔╝╚██████╗╚═╝"
@echo " ╚═╝ ╚═╝╚═╝ ╚═╝╚═╝ ╚═══╝ ╚═════╝ ╚═════╝ ╚═════╝ "
@echo " CyberViser — Hancock AI Agent"
@echo ""
@echo " Usage: make <target>"
@echo ""
@echo " Setup:"
@echo " setup Create virtualenv and install all dependencies"
@echo " install Install runtime dependencies only"
@echo " dev-install Install runtime + dev dependencies"
@echo " finetune-install Install CPU fine-tuning dependencies"
@echo ""
@echo " Run:"
@echo " run Start Hancock CLI (interactive)"
@echo " server Start Hancock REST API server (port 5000)"
@echo " pipeline Run data collection pipeline (all phases)"
@echo " pipeline-v3 Run v3 data collection only (KEV + Atomic + GHSA)"
@echo " finetune Run LoRA fine-tuning on Mistral 7B"
@echo ""
@echo " Clients:"
@echo " client-python Run Python SDK CLI (interactive)"
@echo " client-node Run Node.js SDK CLI (interactive)"
@echo ""
@echo " Dev:"
@echo " lint Run flake8 linter"
@echo " test Run test suite"
@echo " test-cov Run test suite with HTML coverage report"
@echo " fuzz Run all fuzz targets (quick, 60s each)"
@echo " fuzz-target Run a single fuzz target: make fuzz-target TARGET=fuzz_nvd_parser"
@echo " clean Remove build artifacts and cache"
@echo ""
@echo " Docker:"
@echo " docker Build Docker image"
@echo " docker-up Start with docker-compose"
@echo ""
@echo " Deploy:"
@echo " fly-deploy Deploy to Fly.io (requires flyctl + fly auth login)"
@echo ""
# ─── Setup ───────────────────────────────────────────────────
setup:
@echo "[Hancock] Creating virtualenv..."
python3 -m venv .venv
$(PIP) install --upgrade pip
$(PIP) install -r requirements.txt
@[ -f .env ] || cp .env.example .env
@echo "[Hancock] Setup complete. Edit .env with your NVIDIA_API_KEY."
install:
$(PIP) install -r requirements.txt
dev-install:
$(PIP) install -r requirements.txt -r requirements-dev.txt
finetune-install:
$(PIP) install -r requirements-finetune.txt
# ─── Run ─────────────────────────────────────────────────────
run:
$(PYTHON) hancock_agent.py
server:
$(PYTHON) hancock_agent.py --server --port 5000
pipeline:
$(PYTHON) hancock_pipeline.py --phase all
pipeline-v3:
$(PYTHON) hancock_pipeline.py --phase 3
finetune:
$(PYTHON) hancock_finetune.py
# ─── Dev ─────────────────────────────────────────────────────
lint:
.venv/bin/flake8 . --count --select=E9,F63,F7,F82 \
--exclude=.venv,__pycache__,data,docs --show-source --statistics
test:
.venv/bin/pytest tests/ -v --tb=short
test-cov:
.venv/bin/pytest tests/ -v --tb=short --cov=. --cov-report=html --cov-report=term-missing \
--cov-omit=".venv/*,data/*,docs/*,tests/*"
@echo "[Hancock] Coverage report: htmlcov/index.html"
fuzz:
@echo "[Hancock] Running all fuzz targets (quick, 60s each)..."
@for target in fuzz/fuzz_*.py; do \
name=$$(basename $$target .py); \
corpus_name=$${name#fuzz_}; \
echo "[Hancock] Fuzzing $$name ..."; \
$(PYTHON) $$target -atheris_runs=5000 -max_total_time=60 fuzz/corpus/$$corpus_name 2>&1 | tail -5; \
done
@echo "[Hancock] Fuzzing complete."
fuzz-target:
@test -n "$(TARGET)" || (echo "Usage: make fuzz-target TARGET=fuzz_nvd_parser" && exit 1)
@echo "[Hancock] Fuzzing $(TARGET)..."
@corpus_name=$${TARGET#fuzz_}; \
$(PYTHON) fuzz/$(TARGET).py -atheris_runs=50000 -max_total_time=300 fuzz/corpus/$$corpus_name
clean:
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true
find . -name "*.pyc" -delete 2>/dev/null || true
find . -name "*.pyo" -delete 2>/dev/null || true
find . -type d -name "*.egg-info" -exec rm -rf {} + 2>/dev/null || true
@echo "[Hancock] Clean complete."
# ─── Docker ──────────────────────────────────────────────────
docker:
docker build -t cyberviser/hancock:latest .
docker-up:
docker-compose up -d
# ─── Deploy ──────────────────────────────────────────────────
fly-deploy:
@which flyctl >/dev/null 2>&1 || (echo "[Hancock] Install flyctl: curl -L https://fly.io/install.sh | sh" && exit 1)
flyctl deploy --config fly.toml
# ─── Clients ─────────────────────────────────────────────────
client-python:
@$(PIP) install openai python-dotenv -q
$(PYTHON) clients/python/hancock_cli.py
client-node:
@cd clients/nodejs && npm install --silent
node clients/nodejs/hancock.js