-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
79 lines (66 loc) · 3.02 KB
/
Copy pathMakefile
File metadata and controls
79 lines (66 loc) · 3.02 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
.PHONY: install test lint mypy fmt check manifest check-manifest check-agents build clean
PYTHON := .venv/bin/python
PYTEST := .venv/bin/pytest
RUFF := .venv/bin/ruff
MYPY := .venv/bin/mypy
# Sources that drive dist/mcp-tools.json. Only server.py introspection
# feeds the manifest, but bumping the package version invalidates the
# header too — list both so `make manifest` re-runs on any version bump.
MANIFEST_SOURCES := src/m_dev_tools_mcp/server.py src/m_dev_tools_mcp/__init__.py
install:
@test -d .venv || python3 -m venv .venv
$(PYTHON) -m pip install --upgrade pip
$(PYTHON) -m pip install -e ".[dev]"
test:
$(PYTEST) tests/
lint:
$(RUFF) check src/ tests/ scripts/
fmt:
$(RUFF) format src/ tests/ scripts/
$(RUFF) check --fix src/ tests/ scripts/
mypy:
$(MYPY) src/m_dev_tools_mcp
# `make check` is what CI runs. Mirrors the m-cli convention:
# format-check, lint, mypy, tests, plus the two drift gates that keep
# the dist/ manifests honest.
check: lint mypy test check-manifest check-agents
# Regenerate dist/mcp-tools.json by introspecting server.py's
# @mcp.tool decorators. Idempotent — running twice produces byte-
# identical output.
manifest:
$(PYTHON) scripts/gen-mcp-tools-manifest.py --write dist/mcp-tools.json
# Drift gate: regenerate, then `git diff --exit-code`. Same pattern
# every tier-1 / tier-2 / tier-3 repo uses. Fails fast if a contributor
# hand-edited dist/mcp-tools.json or forgot to run `make manifest`
# after editing server.py.
check-manifest: manifest
@git diff --exit-code dist/mcp-tools.json \
|| { echo "ERROR: dist/mcp-tools.json drift — run 'make manifest' and commit." >&2; exit 1; }
@echo "check-manifest: clean"
# Cross-repo guardrail: AGENTS.md exists, and CLAUDE.md is a symlink
# to it (single-source-of-truth for agent instructions). Same shape as
# every other m-dev-tools repo's check-agents target.
check-agents:
@test -f AGENTS.md || { echo "ERROR: AGENTS.md missing" >&2; exit 1; }
@test -L CLAUDE.md || { echo "ERROR: CLAUDE.md must be a symlink to AGENTS.md" >&2; exit 1; }
@target=$$(readlink CLAUDE.md); \
if [ "$$target" != "AGENTS.md" ]; then \
echo "ERROR: CLAUDE.md → $$target; expected AGENTS.md" >&2; exit 1; \
fi
@echo "check-agents: AGENTS.md present; CLAUDE.md → AGENTS.md ✓"
# Build the wheel for a GitHub Release. PEP-517 via the `build`
# front-end; ships pure-Python with no compiled extensions. Output
# goes to `wheel-out/`, NOT `dist/` — `dist/` is reserved for the
# org's Phase-0 contract artifacts (`dist/repo.meta.json` +
# `dist/mcp-tools.json`), both tracked. Mixing wheel outputs there
# breaks the PyPI publish step (twine rejects `*.json` as "unknown
# distribution format").
build:
$(PYTHON) -m build --wheel --outdir wheel-out
clean:
rm -rf .venv .pytest_cache .ruff_cache .mypy_cache build dist/*.egg-info \
src/*.egg-info wheel-out
# Belt-and-suspenders: even if a future `python -m build` forgets
# --outdir and writes wheels under dist/, clean them up so they
# don't leak into a future PyPI publish.
rm -f dist/*.whl dist/*.tar.gz