-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
96 lines (82 loc) · 5.9 KB
/
Copy pathMakefile
File metadata and controls
96 lines (82 loc) · 5.9 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
# Makefile for JobMap
.PHONY: help db-up db-down db-status docs-check scaffold-status preflight db-migrate db-repair-020 test-unit test-integration
help: ## Show currently supported commands
@printf '%s\n' 'JobMap'
@printf '%s\n' ' make preflight Verify DATABASE_URL and PostGIS preflight'
@printf '%s\n' ' make db-up Start the local PostGIS database'
@printf '%s\n' ' make db-migrate Apply pending SQL migrations (requires DATABASE_URL)'
@printf '%s\n' ' make db-repair-020 Retarget cross-company position sites (ENV_ONLY; run before 020 on dirty DBs)'
@printf '%s\n' ' make test-unit Run importer unit tests (no database required)'
@printf '%s\n' ' make crawl-official Dry-run polite GET of official careerUrl pages (no write)'
@printf '%s\n' ' make refresh-radar Download reviewed radar snapshot and remap drops'
@printf '%s\n' ' make geocode-sites Apply real office coords to city-list drops, city-scoped (needs AMAP_WEB_KEY + BAIDU/TENCENT fallback keys; --dry-run prints the plan)'
@printf '%s\n' ' make test-integration Run database integration tests (SKIP/BLOCKED if unavailable)'
@printf '%s\n' ' make docs-check Reject stale canonical documentation references'
@printf '%s\n' ' make scaffold-status Show implementation prerequisites present/planned'
db-up: ## Start local PostGIS database
docker compose up -d db
db-down: ## Stop local PostGIS database
docker compose down
db-status: ## Show database service status
docker compose ps db
preflight: ## Verify DATABASE_URL and PostGIS availability
db/scripts/preflight.sh
db-migrate: ## Apply pending SQL migrations (requires DATABASE_URL)
db/scripts/apply.sh
db-repair-020: ## Retarget cross-company position sites so migration 020 can install (ENV_ONLY)
db/scripts/repair-020-position-site-company.sh
test-unit: ## Run importer unit tests (Python 3.12; uv when available)
@if command -v uv >/dev/null 2>&1; then \
cd crawler && PYTHONPATH=app uv run --python 3.12 python -m unittest discover -s tests -v; \
else \
python3 -c 'import sys; raise SystemExit(0 if sys.version_info[:2] == (3, 12) else 1)' \
|| { echo "crawler requires Python 3.12; install uv or put 3.12 on PATH"; exit 1; }; \
cd crawler && PYTHONPATH=app python3 -m unittest discover -s tests -v; \
fi
crawl-official: ## Dry-run polite GET of curated official career pages (no file write)
@if command -v uv >/dev/null 2>&1; then \
cd crawler && PYTHONPATH=app uv run --python 3.12 python -m domain_map_importer.cli official --dir ../server/data/recruitment/official-career --limit 5 --interval 2; \
else \
python3 -c 'import sys; raise SystemExit(0 if sys.version_info[:2] == (3, 12) else 1)' \
|| { echo "crawler requires Python 3.12; install uv or put 3.12 on PATH"; exit 1; }; \
cd crawler && PYTHONPATH=app python3 -m domain_map_importer.cli official --dir ../server/data/recruitment/official-career --limit 5 --interval 2; \
fi
refresh-radar: ## Download the reviewed radar snapshot, remap drops, and validate the import plan
@mkdir -p /tmp/domain-map-radar
@curl -sL --max-time 90 -o /tmp/domain-map-radar/jobs.json "https://raw.githubusercontent.com/jiabaobei/xiaozhao-radar/main/jobs.json"
@shasum -a 256 /tmp/domain-map-radar/jobs.json
@if command -v uv >/dev/null 2>&1; then \
cd crawler && PYTHONPATH=app uv run --python 3.12 python -m domain_map_importer.cli radar \
--input /tmp/domain-map-radar/jobs.json \
--out-dir ../server/data/recruitment/radar; \
else \
python3 -c 'import sys; raise SystemExit(0 if sys.version_info[:2] == (3, 12) else 1)' \
|| { echo "crawler requires Python 3.12; install uv or put 3.12 on PATH"; exit 1; }; \
cd crawler && PYTHONPATH=app python3 -m domain_map_importer.cli radar \
--input /tmp/domain-map-radar/jobs.json \
--out-dir ../server/data/recruitment/radar; \
fi
@rm -f server/data/recruitment/radar/_radar-fixture.json
@if command -v uv >/dev/null 2>&1; then \
cd crawler && PYTHONPATH=app uv run --python 3.12 python -m unittest discover -s tests -q >/dev/null && echo "crawler tests OK"; \
else \
python3 -c 'import sys; raise SystemExit(0 if sys.version_info[:2] == (3, 12) else 1)' \
|| { echo "crawler requires Python 3.12; install uv or put 3.12 on PATH"; exit 1; }; \
cd crawler && PYTHONPATH=app python3 -m unittest discover -s tests -q >/dev/null && echo "crawler tests OK"; \
fi
@cd server && node --experimental-strip-types --no-warnings scripts/plan-seed-import.mjs 2>/dev/null | python3 -c "import json,sys; d=json.load(sys.stdin); print(f'import plan: {d[\"companies\"]} companies / {d[\"positions\"]} positions, {len(d[\"issues\"])} issues, {d[\"dropped\"]} dropped'); sys.exit(1 if (not d[\"complete\"] or d[\"dropped\"] or d[\"issues\"]) else 0)" && echo "import plan OK"
@echo "Refresh done. Record the source SHA-256 in server/data/recruitment/radar/README.md."
geocode-sites: ## Real office coords for city-list drops, city-scoped (AMAP_WEB_KEY + BAIDU/TENCENT fallback keys; --dry-run prints the plan)
cd server && node --no-warnings scripts/geocode-sites-apply.mjs $(filter-out $@,$(MAKECMDGOALS))
test-integration: ## Run database integration tests (SKIP/BLOCKED if unavailable)
tests/integration/db/test_migrations.sh
docs-check: ## Check repository documentation path and policy drift
@! grep -R -nE 'docs/roles/|docs/zh-cn/|预计发布时间.*2026-02-10|BOSS.*MVP.*爬|小红书.*MVP.*爬' --include='*.md' \
--exclude-dir=.git --exclude-dir=.claude --exclude-dir=.Codex \
--exclude-dir=node_modules --exclude-dir=.next --exclude-dir=.playwright-mcp \
--exclude-dir=parallel-sessions .
@printf '%s\n' 'Documentation policy check passed.'
scaffold-status: ## Show implementation prerequisites present/planned
@for path in server/package.json crawler/pyproject.toml db/migrations/001_extensions_and_identity.sql db/scripts/apply.sh tests; do \
if [ -e "$$path" ]; then printf 'present: %s\n' "$$path"; else printf 'planned: %s\n' "$$path"; fi; \
done