-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjustfile
More file actions
127 lines (100 loc) · 4.32 KB
/
Copy pathjustfile
File metadata and controls
127 lines (100 loc) · 4.32 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
set dotenv-load
# progi task runner
#
# Quickstart:
# just install # python deps + vendored JS + tailwind CLI
# just build # compile CSS
# just dev # run MCP server over SSE
#
# Versions are pinned; bump them here.
tailwind_version := "v4.1.18"
alpine_version := "3.15.4"
alpine_focus_version := "3.15.4"
alpine_ajax_version := "0.12.4"
mermaid_version := "11.15.0"
marked_version := "18.0.5"
# ---------------------------------------------------------------------------
# Dev
# ---------------------------------------------------------------------------
# Run the web app with autoreload only (no CSS watch).
uvicorn:
uv run python -m uvicorn progi.web.app:app --reload
# Watch and rebuild CSS while developing (run alongside `just uvicorn`).
watch-css:
cd frontend && ./tailwindcss -i input.css -o ../progi/web/static/style.css --watch
# Run the MCP server over SSE (shared, persistent; clients connect via URL instead of spawning a process)
dev host="127.0.0.1" port="8001":
uv run progi --transport sse --mcp-host {{host}} --mcp-port {{port}}
# ---------------------------------------------------------------------------
# Install
# ---------------------------------------------------------------------------
install:
just install-python
just vendorize
just install-tailwind-cli
install-python:
uv sync --extra dev
# Vendor frontend JS locally (no runtime CDN). Alpine plugins must be present
# before Alpine core loads; base.html orders the <script> tags accordingly.
vendorize:
just _vendorize alpine {{alpine_version}} "https://unpkg.com/alpinejs@{{alpine_version}}/dist/cdn.min.js"
just _vendorize alpine-focus {{alpine_focus_version}} "https://unpkg.com/@alpinejs/focus@{{alpine_focus_version}}/dist/cdn.min.js"
just _vendorize alpine-ajax {{alpine_ajax_version}} "https://unpkg.com/@imacrayon/alpine-ajax@{{alpine_ajax_version}}/dist/cdn.min.js"
just _vendorize mermaid {{mermaid_version}} "https://cdn.jsdelivr.net/npm/mermaid@{{mermaid_version}}/dist/mermaid.min.js"
just _vendorize marked {{marked_version}} "https://cdn.jsdelivr.net/npm/marked@{{marked_version}}/lib/marked.umd.js"
_vendorize name version url:
#!/usr/bin/env bash
set -euo pipefail
location="progi/web/static/vendor/{{name}}.min.js"
curl -sL -o "$location" "{{url}}"
echo "✓ Vendorized {{name}}.min.js"
# Download the Tailwind standalone CLI.
# Works on Linux, macOS, Windows (git-bash). No Node required.
install-tailwind-cli:
#!/usr/bin/env bash
set -euo pipefail
os=$(uname -s | tr '[:upper:]' '[:lower:]')
arch=$(uname -m)
case "$os" in
linux) platform="linux"; ext="" ;;
darwin) platform="macos"; ext="" ;;
mingw*|msys*|cygwin*) platform="windows"; ext=".exe" ;;
*) echo "Unsupported OS: $os"; exit 1 ;;
esac
case "$arch" in
x86_64|amd64) arch_name="x64" ;;
arm64|aarch64) arch_name="arm64" ;;
*) echo "Unsupported architecture: $arch"; exit 1 ;;
esac
filename="tailwindcss-${platform}-${arch_name}${ext}"
url="https://github.com/tailwindlabs/tailwindcss/releases/download/{{tailwind_version}}/${filename}"
output="frontend/tailwindcss${ext}"
echo "Downloading Tailwind CSS CLI {{tailwind_version}} for ${platform}-${arch_name}..."
curl -sL -o "$output" "$url"
chmod +x "$output"
echo "✓ Installed Tailwind CSS CLI to ${output}"
# ---------------------------------------------------------------------------
# Build
# ---------------------------------------------------------------------------
build:
just build-tailwind
build-tailwind:
cd frontend && ./tailwindcss -i input.css -o "../progi/web/static/style.css" --minify
# ---------------------------------------------------------------------------
# DB / migrations
# ---------------------------------------------------------------------------
# Create a new autogenerated migration: just migrate "add users table"
migrate message:
uv run alembic revision --autogenerate -m "{{message}}"
# Apply migrations.
upgrade:
uv run alembic upgrade head
# ---------------------------------------------------------------------------
# Quality
# ---------------------------------------------------------------------------
lint:
uv run ruff check progi
fmt:
uv run ruff format progi
test:
uv run python -m pytest