|
1 | | -PYTHON ?= python3 |
2 | | -VENV ?= .venv |
3 | | -PIP := $(VENV)/bin/pip |
4 | | -SPECKIT_VERSION ?= |
5 | | -SPECKIT_BIN := $(VENV)/bin/speckit |
6 | | -SPECKIT_SPEC := speckit |
7 | | -# Semver-like: major.minor.patch with optional dot-separated pre-release identifiers (numeric identifiers are allowed). |
8 | | -SPECKIT_SEMVER_REGEX := ^[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9]+(\.[A-Za-z0-9]+)*)?$$ |
9 | | -SPECKIT_VERSION_CLEAN := $(strip $(SPECKIT_VERSION)) |
10 | | -SPECKIT_VERSION_VALID := $(if $(SPECKIT_VERSION_CLEAN),$(shell echo "$(SPECKIT_VERSION_CLEAN)" | grep -E '$(SPECKIT_SEMVER_REGEX)' >/dev/null && echo valid),valid) |
11 | | - |
12 | | -ifneq ($(SPECKIT_VERSION_CLEAN),) |
13 | | -# Require a semver-like value; optional suffix is dot-separated alphanumeric identifiers. |
14 | | -ifneq ($(findstring ..,$(SPECKIT_VERSION_CLEAN)),) |
15 | | -$(error SPECKIT_VERSION cannot contain consecutive dots) |
16 | | -endif |
17 | | -ifneq ($(SPECKIT_VERSION_VALID),valid) |
18 | | -$(error SPECKIT_VERSION must be semver-like (e.g., 0.2.0 or 1.2.3-rc.1; suffix is dot-separated alphanumeric identifiers)) |
19 | | -endif |
20 | | -SPECKIT_SPEC := speckit==$(SPECKIT_VERSION_CLEAN) |
21 | | -endif |
22 | | - |
23 | | -.PHONY: speckit-install speckit-init speckit-check speckit-clean |
24 | | - |
25 | | -$(VENV)/bin/python: |
26 | | - $(PYTHON) -m venv $(VENV) |
27 | | - $(PIP) install --upgrade pip setuptools wheel |
28 | | - |
29 | | -$(SPECKIT_BIN): $(VENV)/bin/python |
30 | | - $(PIP) install $(SPECKIT_SPEC) |
31 | | - |
32 | | -speckit-install: $(SPECKIT_BIN) |
33 | | - |
34 | | -speckit-init: $(SPECKIT_BIN) |
35 | | - $(SPECKIT_BIN) init |
36 | | - |
37 | | -speckit-check: $(SPECKIT_BIN) |
38 | | - $(SPECKIT_BIN) check |
39 | | - |
40 | | -speckit-clean: |
41 | | - rm -rf $(VENV) |
| 1 | +.PHONY: spec-kit agent-os help init |
| 2 | + |
| 3 | +.DEFAULT_GOAL := help |
| 4 | + |
| 5 | +help: ## Show available commands |
| 6 | + @awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n\nTargets:\n"} /^[a-zA-Z_-]+:.*?##/ { printf " \033[36m%-15s\033[0m %s\n", $$1, $$2 } /^##@/ { printf "\n\033[1m%s\033[0m\n", substr($$0, 5) } ' $(MAKEFILE_LIST) |
| 7 | + |
| 8 | +spec-kit: ## Install spec-kit (default: claude) |
| 9 | + @agent=$(word 2,$(MAKECMDGOALS)); \ |
| 10 | + if [ -z "$$agent" ]; then \ |
| 11 | + agent="claude"; \ |
| 12 | + echo "Using default agent: claude"; \ |
| 13 | + fi; \ |
| 14 | + if ! command -v specify >/dev/null 2>&1; then \ |
| 15 | + echo "[spec-kit] 'specify' not found."; \ |
| 16 | + echo "RUN: uv tool install specify-cli --from git+https://github.com/github/spec-kit.git"; \ |
| 17 | + exit 1; \ |
| 18 | + fi; \ |
| 19 | + yes | specify init --here --ai $$agent --script sh |
| 20 | + |
| 21 | +agent-os: ## Install agent-os (default: claude) |
| 22 | + @agent=$(word 2,$(MAKECMDGOALS)); \ |
| 23 | + script="$$HOME/agent-os/scripts/project-install.sh"; \ |
| 24 | + if [ -z "$$agent" ]; then \ |
| 25 | + agent="claude"; \ |
| 26 | + echo "Using default agent: claude"; \ |
| 27 | + fi; \ |
| 28 | + if [ ! -f "$$script" ]; then \ |
| 29 | + echo "[agent-os] 'agent-os' not found."; \ |
| 30 | + echo "RUN: curl -sSL https://raw.githubusercontent.com/buildermethods/agent-os/main/scripts/base-install.sh | bash"; \ |
| 31 | + exit 1; \ |
| 32 | + fi; \ |
| 33 | + echo "Installing agent-os with agent: $$agent"; \ |
| 34 | + if [ "$$agent" = "claude" ]; then \ |
| 35 | + yes | bash "$$script"; \ |
| 36 | + elif [ "$$agent" = "all" ]; then \ |
| 37 | + yes | bash "$$script" --agent-os-commands true --standards-as-claude-code-skills true; \ |
| 38 | + else \ |
| 39 | + yes | bash "$$script" --claude-code-commands false --use-claude-code-subagents false --standards-as-claude-code-skills true --agent-os-commands true; \ |
| 40 | + fi |
| 41 | + |
| 42 | +init: ## Setup Project environment (Docker required) |
| 43 | + @if ! command -v docker >/dev/null 2>&1; then \ |
| 44 | + echo "[init] 'docker' not found"; \ |
| 45 | + exit 1; \ |
| 46 | + fi; \ |
| 47 | + if ! docker compose version >/dev/null 2>&1; then \ |
| 48 | + echo "[init] 'docker compose' not found"; \ |
| 49 | + exit 1; \ |
| 50 | + fi; \ |
| 51 | + if [ ! -f .env ]; then \ |
| 52 | + echo "Copying .env.example to .env"; \ |
| 53 | + cp .env.example .env; \ |
| 54 | + fi; \ |
| 55 | + echo "Starting Docker containers"; \ |
| 56 | + docker compose up -d; \ |
| 57 | + echo "Installing npm packages"; \ |
| 58 | + docker run --rm -v $$(pwd):/app -w /app node:22-alpine npm install; \ |
| 59 | + echo "Running database migrations and seeders"; \ |
| 60 | + docker compose exec laravel.test php artisan migrate --seed |
| 61 | + |
| 62 | +%: |
| 63 | + @: |
0 commit comments