mirror of
https://github.com/Frooodle/Stirling-PDF.git
synced 2026-04-22 23:08:53 +02:00
Add Taskfile for unified dev workflow across all components (#6080)
## Add Taskfile for unified dev workflow ### Summary - Introduces [Taskfile](https://taskfile.dev/) as the single CLI entry point for all development workflows across backend, frontend, engine, Docker, and desktop - ~80 tasks organized into 6 namespaces: `backend:`, `frontend:`, `engine:`, `docker:`, `desktop:`, plus root-level composites - All CI workflows migrated to use Task - Deletes `engine/Makefile` and `scripts/build-tauri-jlink.{sh,bat}` — replaced by Task equivalents - Removes redundant npm scripts (`dev`, `build`, `prep`, `lint`, `test`, `typecheck:all`) from `package.json` - Smart dependency caching: `sources`/`status`/`generates` fingerprinting, CI-aware `npm ci` vs `npm install`, `run: once` for parallel dep deduplication ### What this does NOT do - Does not replace Gradle, npm, or Docker — Taskfile is a thin orchestration wrapper - Does not change application code or behavior ### Install ``` npm install -g @go-task/cli # or: brew install go-task, winget install Task.Task ``` ### Quick start ``` task --list # discover all tasks task install # install all deps task dev # start backend + frontend task dev:all # also start AI engine task test # run all tests task check # quick quality gate (local dev) task check:all # full CI quality gate ``` ### Test plan - [ ] Install `task` CLI and run `task --list` — verify all tasks display - [ ] Run `task install` — verify frontend + engine deps install - [ ] Run `task dev` — verify backend + frontend start, Ctrl+C exits cleanly - [ ] Run `task frontend:check` — verify typecheck + lint + test pass - [ ] Run `task desktop:dev` — verify jlink builds are cached on second run - [ ] Verify CI passes on all workflows --------- Co-authored-by: James Brunton <jbrunton96@gmail.com>
This commit is contained in:
@@ -4,9 +4,23 @@ This file is for AI agents working in `engine/`.
|
||||
|
||||
The engine is a Python reasoning service for Stirling. It plans and interprets work, but it does not own durable state, and it does not execute Stirling PDF operations directly. Keep the service narrow: typed contracts in, typed contracts out, with AI only where it adds reasoning value.
|
||||
|
||||
## Commands
|
||||
|
||||
All engine commands can be run from the repository root using Task:
|
||||
|
||||
- `task engine:check` — run all checks (typecheck + lint + format-check + test)
|
||||
- `task engine:fix` — auto-fix lint + formatting
|
||||
- `task engine:install` — install Python dependencies via uv
|
||||
- `task engine:dev` — start FastAPI with hot reload (localhost:5001)
|
||||
- `task engine:test` — run pytest
|
||||
- `task engine:lint` — run ruff linting
|
||||
- `task engine:typecheck` — run pyright
|
||||
- `task engine:format` — format code with ruff
|
||||
- `task engine:tool-models` — generate tool_models.py from frontend TypeScript defs
|
||||
|
||||
## Code Style
|
||||
|
||||
- Keep `make check` passing.
|
||||
- Keep `task engine:check` passing.
|
||||
- Use modern Python when it improves clarity.
|
||||
- Prefer explicit names to cleverness.
|
||||
- Avoid nested functions and nested classes unless the language construct requires them.
|
||||
|
||||
@@ -1,82 +0,0 @@
|
||||
.PHONY: help install prep check fix lint lint-fix lint-fix-unsafe format format-check typecheck test run run-dev clean tool-models docker-build docker-run
|
||||
|
||||
REPO_ROOT_DIR = ..
|
||||
ROOT_DIR = .
|
||||
VENV_DIR = $(ROOT_DIR)/.venv
|
||||
DEPS_STAMP := $(VENV_DIR)/.deps-installed
|
||||
TOOL_MODELS := $(CURDIR)/src/stirling/models/tool_models.py
|
||||
FRONTEND_DIR := $(REPO_ROOT_DIR)/frontend
|
||||
FRONTEND_TSX := $(FRONTEND_DIR)/node_modules/.bin/tsx
|
||||
|
||||
$(DEPS_STAMP): $(ROOT_DIR)/uv.lock $(ROOT_DIR)/pyproject.toml
|
||||
uv python install 3.13.8
|
||||
uv sync
|
||||
touch $(DEPS_STAMP)
|
||||
|
||||
help:
|
||||
@echo "Engine commands:"
|
||||
@echo " make install - Install production dependencies"
|
||||
@echo " make prep - Set up .env file from .env.example"
|
||||
@echo " make lint - Run linting checks"
|
||||
@echo " make format - Format code"
|
||||
@echo " make format-check - Show whether code is correctly formatted"
|
||||
@echo " make typecheck - Run type checking"
|
||||
@echo " make test - Run tests"
|
||||
@echo " make run - Run the FastAPI backend with uvicorn"
|
||||
@echo " make run-dev - Run the FastAPI backend with reload"
|
||||
@echo " make tool-models - Generate src/stirling/models/tool_models.py from frontend TypeScript tool defs"
|
||||
@echo " make clean - Clean up generated files"
|
||||
@echo " make docker-build - Build Docker image"
|
||||
@echo " make docker-run - Run Docker container"
|
||||
|
||||
install: $(DEPS_STAMP)
|
||||
|
||||
prep: install
|
||||
uv run scripts/setup_env.py
|
||||
|
||||
check: typecheck lint format-check test
|
||||
|
||||
fix: lint-fix format
|
||||
|
||||
lint: install
|
||||
uv run ruff check .
|
||||
|
||||
lint-fix: install
|
||||
uv run ruff check . --fix
|
||||
|
||||
lint-fix-unsafe: install
|
||||
uv run ruff check . --fix --unsafe-fixes
|
||||
|
||||
format: install
|
||||
uv run ruff format .
|
||||
|
||||
format-check: install
|
||||
uv run ruff format . --diff
|
||||
|
||||
typecheck: install
|
||||
uv run pyright . --warnings
|
||||
|
||||
test: prep
|
||||
uv run pytest tests
|
||||
|
||||
run: prep
|
||||
cd src && PYTHONUNBUFFERED=1 uv run uvicorn stirling.api.app:app --host 0.0.0.0 --port 5001
|
||||
|
||||
run-dev: prep
|
||||
cd src && PYTHONUNBUFFERED=1 uv run uvicorn stirling.api.app:app --host 0.0.0.0 --port 5001 --reload
|
||||
|
||||
frontend-deps:
|
||||
if [ ! -x "$(FRONTEND_TSX)" ]; then cd $(FRONTEND_DIR) && npm install; fi
|
||||
|
||||
tool-models: install frontend-deps
|
||||
uv run python scripts/generate_tool_models.py --output $(TOOL_MODELS)
|
||||
$(MAKE) fix
|
||||
|
||||
clean:
|
||||
rm -rf $(VENV_DIR) data logs output
|
||||
|
||||
docker-build:
|
||||
docker build -t stirling-pdf-engine .
|
||||
|
||||
docker-run:
|
||||
docker run -p 5001:5001 stirling-pdf-engine
|
||||
Reference in New Issue
Block a user