-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathMakefile
More file actions
184 lines (166 loc) · 5.68 KB
/
Copy pathMakefile
File metadata and controls
184 lines (166 loc) · 5.68 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
# Flowspec - Makefile
# Development and maintenance commands
.PHONY: help install test lint format clean dev-validate dev-fix dev-status
# Default target
help:
@echo "Flowspec - Available Commands"
@echo "=================================="
@echo ""
@echo "Development:"
@echo " make install - Install dependencies with uv"
@echo " make test - Run all tests"
@echo " make lint - Run linter (ruff check)"
@echo " make format - Format code (ruff format)"
@echo " make clean - Clean build artifacts"
@echo ""
@echo "Development Setup Management:"
@echo " make dev-validate - Validate dev setup"
@echo " make dev-fix - Fix dev setup (recreate symlinks)"
@echo " make dev-status - Show dev setup status"
@echo ""
@echo "CLI:"
@echo " make cli-install - Install CLI locally"
@echo " make cli-uninstall - Uninstall CLI"
@echo ""
# ============================================================
# DEVELOPMENT COMMANDS
# ============================================================
install:
@echo "Installing dependencies..."
uv sync
test:
@echo "Running tests..."
uv run pytest tests/ -v
test-dev:
@echo "Running development setup tests..."
uv run pytest tests/test_command_*.py -v
lint:
@echo "Running linter..."
uv run ruff check .
format:
@echo "Formatting code..."
uv run ruff format .
clean:
@echo "Cleaning build artifacts..."
find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true
find . -type d -name "*.egg-info" -exec rm -rf {} + 2>/dev/null || true
find . -type d -name ".pytest_cache" -exec rm -rf {} + 2>/dev/null || true
find . -type d -name ".ruff_cache" -exec rm -rf {} + 2>/dev/null || true
@echo "✓ Cleaned"
# ============================================================
# DEVELOPMENT SETUP MANAGEMENT
# ============================================================
dev-validate:
@echo "Validating development setup..."
@echo ""
@echo "Checking for non-symlink .md files in .claude/commands/..."
@if find .claude/commands -name "*.md" -type f 2>/dev/null | grep -q .; then \
echo "❌ ERROR: Found non-symlink .md files:"; \
find .claude/commands -name "*.md" -type f; \
exit 1; \
else \
echo "✓ All .md files are symlinks"; \
fi
@echo ""
@echo "Checking for broken symlinks..."
@if find .claude/commands -type l ! -exec test -e {} \; -print 2>/dev/null | grep -q .; then \
echo "❌ ERROR: Found broken symlinks:"; \
find .claude/commands -type l ! -exec test -e {} \; -print; \
exit 1; \
else \
echo "✓ All symlinks resolve correctly"; \
fi
@echo ""
@echo "✓ Development setup validation passed"
dev-fix:
@echo "Fixing development setup..."
@echo ""
@echo "Step 1: Backing up current state..."
@if [ -d .claude/commands/flowspec ]; then \
echo " - Found flowspec directory"; \
fi
@if [ -d .claude/commands/speckit ]; then \
echo " - Found speckit directory"; \
fi
@echo ""
@echo "Step 2: Removing existing symlinks..."
@rm -rf .claude/commands/flowspec .claude/commands/speckit 2>/dev/null || true
@echo " ✓ Removed"
@echo ""
@echo "Step 3: Recreating symlinks with dev-setup command..."
@uv run flowspec dev-setup --force
@echo ""
@echo "Step 4: Validating new setup..."
@echo " - Checking symlinks..."
@if find .claude/commands -name "*.md" -type f 2>/dev/null | grep -q .; then \
echo " ❌ Still found non-symlink files"; \
exit 1; \
else \
echo " ✓ All files are symlinks"; \
fi
@echo ""
@echo "=========================================="
@echo "✓ Development setup restored successfully"
@echo "=========================================="
dev-status:
@echo "=========================================="
@echo "Development Setup Status"
@echo "=========================================="
@echo ""
@echo "=== .claude/commands/ structure ==="
@ls -la .claude/commands/ 2>/dev/null || echo "Directory does not exist"
@echo ""
@if [ -d .claude/commands/speckit ]; then \
echo "=== speckit commands ==="; \
ls -la .claude/commands/speckit/ | grep -E '\.md$$' || echo "No .md files"; \
echo ""; \
fi
@if [ -d .claude/commands/flowspec ]; then \
echo "=== flowspec commands ==="; \
ls -la .claude/commands/flowspec/ | grep -E '\.md$$' || echo "No .md files"; \
echo ""; \
fi
@echo "=== Symlink verification ==="
@TOTAL=$$(find .claude/commands -name "*.md" 2>/dev/null | wc -l); \
SYMLINKS=$$(find .claude/commands -name "*.md" -type l 2>/dev/null | wc -l); \
FILES=$$(find .claude/commands -name "*.md" -type f 2>/dev/null | wc -l); \
echo "Total .md files: $$TOTAL"; \
echo "Symlinks: $$SYMLINKS"; \
echo "Regular files: $$FILES"; \
if [ $$FILES -gt 0 ]; then \
echo ""; \
echo "❌ WARNING: Found regular files (should be symlinks):"; \
find .claude/commands -name "*.md" -type f; \
fi
@echo ""
# ============================================================
# CLI COMMANDS
# ============================================================
cli-install:
@echo "Installing CLI..."
uv tool install . --force
@echo "✓ CLI installed"
@echo ""
@echo "Verify with: specify --version"
cli-uninstall:
@echo "Uninstalling CLI..."
uv tool uninstall specify-cli || true
@echo "✓ CLI uninstalled"
# ============================================================
# CI/CD SIMULATION
# ============================================================
ci-local:
@echo "Running local CI simulation..."
@echo ""
@echo "Step 1: Linting..."
@make lint
@echo ""
@echo "Step 2: Testing..."
@make test
@echo ""
@echo "Step 3: Development setup validation..."
@make dev-validate
@echo ""
@echo "=========================================="
@echo "✓ Local CI simulation passed"
@echo "=========================================="