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
SHELL := /usr/bin/env bash
# Tools
PNPM := pnpm
CARGO := cargo
RUSTFMT := rustfmt
PRETTIER := $(shell command -v npx >/dev/null 2>&1 && echo "npx prettier" || echo "prettier")
# Root/workspace helpers
JS_WORKSPACE := $(PNPM) --filter agentsync
.PHONY: help all install js-install js-test js-build js-release \
rust-build rust-test rust-run e2e-test fmt docs-dev docs-build docs-preview \
agents-sync agents-sync-clean clean verify-all
help:
@echo "Makefile for agentsync"
@echo ""
@echo "Main targets:"
@echo " make all -> install + build (js + rust)"
@echo " make verify-all -> run all tests and linters"
@echo " make install -> install dependencies (pnpm + cargo build deps)"
@echo " make js-install -> pnpm install (workspace root)"
@echo " make js-test -> run JS tests (pnpm test)"
@echo " make js-build -> build JS packages (if 'build' script exists)"
@echo " make js-release -> release JS (pnpm run release)"
@echo " make rust-build -> cargo build"
@echo " make rust-test -> cargo test"
@echo " make e2e-test -> run E2E tests in docker"
@echo " make rust-run -> cargo run"
@echo " make fmt -> rustfmt + biome (if installed)"
@echo " make docs-dev -> start docs in dev mode"
@echo " make docs-build -> build docs"
@echo " make docs-preview -> preview docs"
@echo " make agents-sync -> pnpm run agents:sync"
@echo " make agents-sync-clean -> pnpm run agents:sync:clean"
@echo " make clean -> cleans common artifacts"
@echo ""
@echo "Examples:"
@echo " make js-test"
@echo " make rust-test"
all: install js-build
verify-all: fmt
@printf "\n========================================\n"
@echo " Running full verification suite"
@printf "========================================\n\n"
@echo "→ Verifying JS workspace (build + test)..."
@$(MAKE) js-build
@$(MAKE) js-test
@echo "→ Verifying Docs build..."
@$(MAKE) docs-build
@echo "→ Running JS lint (biome)..."
@if $(PNPM) exec biome --version >/dev/null 2>&1; then \
$(PNPM) exec biome check .; \
else \
echo "biome not available; skipping"; \
fi
@echo "→ Running cargo clippy..."
@$(CARGO) clippy --all-targets --all-features -- -D warnings
@echo "→ Running cargo test..."
@$(CARGO) test
@if [ "${RUN_E2E}" = "1" ]; then \
echo "→ Running E2E tests (docker)..."; \
$(MAKE) e2e-test; \
fi
@printf "\nAll verification checks passed. ✅\n"
install: js-install rust-build
@echo "Installation complete."
# JavaScript / pnpm targets
js-install:
@echo "Running pnpm install (workspace root)..."
$(PNPM) install
js-test:
@echo "Running JS tests..."
$(JS_WORKSPACE) run test
js-build:
@echo "Running JS build (workspace scripts if present)..."
$(JS_WORKSPACE) run --if-present build
js-release:
@echo "Running JS release (semantic-release)..."
$(PNPM) run release
# Rust targets
rust-build:
@echo "Building Rust workspace..."
$(CARGO) build
rust-test:
@echo "Running Rust tests..."
$(CARGO) test
rust-run:
@echo "Running Rust project..."
$(CARGO) run
# E2E Tests
e2e-test:
@echo "Running E2E tests with Docker Compose..."
@status=0; \
docker compose -f tests/e2e/docker-compose.yml up --build --exit-code-from test-runner-ubuntu || status=$$?; \
docker compose -f tests/e2e/docker-compose.yml down --volumes --remove-orphans; \
exit $$status
# Formatting
fmt:
@echo "Formatting Rust + JS..."
@if command -v rustfmt >/dev/null 2>&1; then \
$(CARGO) fmt; \
else \
echo "rustfmt not found; skipping"; \
fi
@if $(PNPM) exec biome --version >/dev/null 2>&1; then \
$(PNPM) exec biome format --write .; \
else \
echo "biome not available; skipping"; \
fi
# Docs
docs-dev:
@echo "Starting docs (dev)..."
$(PNPM) run docs:dev
docs-build:
@echo "Building docs..."
$(PNPM) run docs:build
docs-preview:
@echo "Preview docs..."
$(PNPM) run docs:preview
# Agentsync shortcuts (from package.json)
agents-sync:
@echo "Running agents:sync..."
$(PNPM) run agents:sync
agents-sync-clean:
@echo "Running agents:sync:clean..."
$(PNPM) run agents:sync:clean
clean:
@echo "Cleaning artifacts..."
-$(CARGO) clean
-$(PNPM) run -w --silent clean 2>/dev/null || true
@rm -rf target
@echo "Done."