-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
188 lines (165 loc) · 10.3 KB
/
Makefile
File metadata and controls
188 lines (165 loc) · 10.3 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
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# ─────────────────────────────────────────────────────────────────────
# Atomadic Forge — Master Makefile
#
# "Every 'Thomas needs to' is a BUG."
#
# Usage:
# make → show available targets
# make release → bump, metrics, commit, tag, push (one command)
# make ship-check → lint + test + wire + certify
# make deploy-site → rebuild & deploy forge-site to Cloudflare Pages
# make ci-local → run the full CI matrix locally
# ─────────────────────────────────────────────────────────────────────
.DEFAULT_GOAL := help
SHELL := /bin/bash
.ONESHELL:
# ── Paths ────────────────────────────────────────────────────────────
FORGE_ROOT := $(shell pwd)
STANDARD_ROOT := $(dir $(FORGE_ROOT))
SITE_DIR := $(STANDARD_ROOT)atomadic-forge-site
# Build mirror (workaround for !! in path)
SITE_MIRROR := $(HOME)/atomadic-forge-site
# ── Version ──────────────────────────────────────────────────────────
VERSION := $(shell python -c "import tomllib; print(tomllib.load(open('pyproject.toml','rb'))['project']['version'])" 2>/dev/null || python -c "import tomli; print(tomli.load(open('pyproject.toml','rb'))['project']['version'])")
# ── Colors ───────────────────────────────────────────────────────────
GREEN := \033[0;32m
YELLOW := \033[0;33m
RED := \033[0;31m
CYAN := \033[0;36m
RESET := \033[0m
# ═══════════════════════════════════════════════════════════════════════
# HELP
# ═══════════════════════════════════════════════════════════════════════
.PHONY: help
help: ## Show this help
@echo ""
@echo " $(CYAN)Atomadic Forge$(RESET) v$(VERSION)"
@echo ""
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \
awk 'BEGIN {FS = ":.*?## "}; {printf " $(GREEN)%-20s$(RESET) %s\n", $$1, $$2}'
@echo ""
# ═══════════════════════════════════════════════════════════════════════
# DEVELOPMENT
# ═══════════════════════════════════════════════════════════════════════
.PHONY: install
install: ## Install forge in editable mode with dev deps
python -m pip install -e ".[dev]" --quiet
.PHONY: lint
lint: ## Run ruff linter (auto-fix)
@echo "$(CYAN)[lint]$(RESET) ruff..."
@python -m ruff check src/atomadic_forge tests --fix
@python -m ruff check src/atomadic_forge tests
.PHONY: test
test: ## Run pytest
@echo "$(CYAN)[test]$(RESET) pytest..."
@python -m pytest -q
.PHONY: wire
wire: ## Run forge wire (architecture layer check)
@echo "$(CYAN)[wire]$(RESET) forge wire..."
@python -m atomadic_forge.a4_sy_orchestration.cli wire src/atomadic_forge --fail-on-violations
.PHONY: certify
certify: ## Run forge self-certify (must score 100)
@echo "$(CYAN)[certify]$(RESET) forge certify..."
@python -m atomadic_forge.a4_sy_orchestration.cli certify . --fail-under 100
.PHONY: ship-check
ship-check: lint test wire certify ## Full pre-commit check: lint + test + wire + certify
@echo ""
@echo " $(GREEN)==============================$(RESET)"
@echo " $(GREEN) ship-check PASS — ship it$(RESET)"
@echo " $(GREEN)==============================$(RESET)"
@echo ""
.PHONY: ship-check-fast
ship-check-fast: lint test ## Quick check: lint + test only
@echo " $(GREEN)ship-check-fast PASS$(RESET)"
# ═══════════════════════════════════════════════════════════════════════
# METRICS
# ═══════════════════════════════════════════════════════════════════════
.PHONY: metrics
metrics: ## Regenerate forge_metrics.json
python scripts/update_metrics.py
.PHONY: metrics-propagate
metrics-propagate: ## Regenerate metrics + propagate to site & cognition
python scripts/update_metrics.py --propagate
.PHONY: metrics-check
metrics-check: ## Verify metrics are current (CI mode)
python scripts/update_metrics.py --check
# ═══════════════════════════════════════════════════════════════════════
# RELEASE (the one-command release pipeline)
# ═══════════════════════════════════════════════════════════════════════
# Usage: make release V=0.17.0
# Does everything: bump version, update metrics, commit, tag, push.
# PyPI publish happens automatically via GitHub Actions on release.
.PHONY: release
release: ## Release a new version (V=x.y.z required) — delegates to scripts/release.py for cross-platform parity
ifndef V
$(error $(RED)Usage: make release V=0.17.0$(RESET))
endif
@python scripts/release.py $(V)
@echo ""
@echo " $(GREEN)══════════════════════════════════════════════$(RESET)"
@echo " $(GREEN) v$(V) tagged and pushed!$(RESET)"
@echo " $(GREEN) → Create a GitHub Release to publish to PyPI$(RESET)"
@echo " $(GREEN) → https://github.com/atomadictech/atomadic-forge/releases/new?tag=v$(V)$(RESET)"
@echo " $(GREEN)══════════════════════════════════════════════$(RESET)"
@echo ""
# ═══════════════════════════════════════════════════════════════════════
# DEPLOYMENT
# ═══════════════════════════════════════════════════════════════════════
.PHONY: deploy-site
deploy-site: ## Build & deploy forge-site to Cloudflare Pages
@echo "$(CYAN)[deploy-site]$(RESET) Syncing to build mirror..."
@mkdir -p "$(SITE_MIRROR)"
@cp -r "$(SITE_DIR)/app" "$(SITE_DIR)/functions" \
"$(SITE_DIR)/package.json" "$(SITE_DIR)/tsconfig.json" \
"$(SITE_DIR)/postcss.config.mjs" "$(SITE_DIR)/next.config.ts" \
"$(SITE_MIRROR)/"
@echo "$(CYAN)[deploy-site]$(RESET) Installing deps..."
@cd "$(SITE_MIRROR)" && npm install --silent
@echo "$(CYAN)[deploy-site]$(RESET) Building..."
@cd "$(SITE_MIRROR)" && npm run build
@echo "$(CYAN)[deploy-site]$(RESET) Deploying to Cloudflare Pages..."
@cd "$(SITE_MIRROR)" && npx wrangler pages deploy out \
--project-name=atomadic-forge --branch=main --commit-dirty=true
@echo ""
@echo " $(GREEN)forge-site deployed!$(RESET)"
.PHONY: deploy-all
deploy-all: deploy-site ## Deploy all services (site + workers auto-deploy on push)
@echo ""
@echo " $(GREEN)All deployments complete.$(RESET)"
@echo " (CF workers + cognition auto-deploy on push to main)"
# ═══════════════════════════════════════════════════════════════════════
# CI (local)
# ═══════════════════════════════════════════════════════════════════════
.PHONY: ci-local
ci-local: ship-check metrics-check ## Run the full CI pipeline locally
@echo ""
@echo " $(GREEN)ci-local PASS — matches what GitHub Actions will run$(RESET)"
# ═══════════════════════════════════════════════════════════════════════
# UPTIME CHECK
# ═══════════════════════════════════════════════════════════════════════
.PHONY: uptime
uptime: ## Quick health check on all Atomadic services
@echo "$(CYAN)Checking Atomadic services...$(RESET)"
@echo ""
@for url in \
"https://atomadic.tech" \
"https://forge.atomadic.tech" \
"https://forge.atomadic.tech/mcp" \
"https://chat.atomadic.tech" \
"https://forge-auth.atomadic.tech" \
; do \
status=$$(curl -s -o /dev/null -w "%{http_code}" --max-time 5 "$$url" 2>/dev/null); \
if [ "$$status" = "200" ] || [ "$$status" = "405" ] || [ "$$status" = "401" ]; then \
echo " $(GREEN)OK$(RESET) $$status $$url"; \
else \
echo " $(RED)ERR$(RESET) $$status $$url"; \
fi; \
done
@echo ""
# ═══════════════════════════════════════════════════════════════════════
# CLEAN
# ═══════════════════════════════════════════════════════════════════════
.PHONY: clean
clean: ## Remove build artifacts
rm -rf build/ dist/ *.egg-info/ .pytest_cache/ .ruff_cache/ .import_linter_cache/
find . -type d -name __pycache__ -exec rm -rf {} + 2>/dev/null || true