GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — pipelex-plugins/Makefile at main · Pipelex/pipelex-plugins Expand file tree/ Copy pathMakefileMore file actions 300 lines (239 loc) · 14.8 KB / Copy pathMakefileFile metadata and controls300 lines (239 loc) · 14.8 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 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 SHELL := /bin/bash .SHELLFLAGS := -euo pipefail -c # The interpreter is the one .python-version names, unless PYTHON_VERSION or UV_PYTHON asks for another. # Exporting it hands the same version to every uv command, so `uv sync` never rebuilds .venv on the pin. PYTHON_VERSION ?= $(or $(UV_PYTHON),$(shell cat .python-version)) export UV_PYTHON := $(PYTHON_VERSION) TARGET ?= prod VIRTUAL_ENV := $(CURDIR)/.venv VENV_PYTHON := "$(VIRTUAL_ENV)/bin/python" VENV_PYTEST := "$(VIRTUAL_ENV)/bin/pytest" VENV_RUFF := "$(VIRTUAL_ENV)/bin/ruff" VENV_PYRIGHT := "$(VIRTUAL_ENV)/bin/pyright" VENV_MYPY := "$(VIRTUAL_ENV)/bin/mypy" UV_MIN_VERSION = $(shell grep -m1 'required-version' pyproject.toml | sed -E 's/.*= *"[^0-9]*([0-9][0-9.]*).*/\1/') .PHONY: \ help env check-uv install lock li \ gen-skill-docs build render-outside-smoke vendor-hook check-hook-fresh check check-shared check-claude check-codex agent-check \ format lint ruff-format ruff-lint pyright mypy fix-unused-imports fui \ test agent-test test-cross-os test-recipes check-outside-smoke tp \ cleanderived cleanenv cleanall reinstall ri \ codex-use-local codex-use-official codex-refresh codex-status \ claude-local-mcp codex-local-mcp ########################################################################################## ### SETUP ########################################################################################## check-uv: ## Ensure uv is installed (auto-installs if missing) @command -v uv >/dev/null 2>&1 || { \ echo "uv not found – installing latest (minimum $(UV_MIN_VERSION)) …"; \ curl -LsSf https://astral.sh/uv/install.sh | sh; \ } @uv self update >/dev/null 2>&1 || true env: check-uv ## Create virtual environment @test -d "$(VIRTUAL_ENV)" || uv venv "$(VIRTUAL_ENV)" --quiet lock: env ## Refresh uv.lock without updating anything @uv lock install: env ## Create venv + install all deps @uv sync --all-extras --quiet li: lock install ## Lock + install @echo "> done: li = lock install" ########################################################################################## ### CLEANING ########################################################################################## cleanderived: ## Remove caches/compiled files @find . -name '.coverage' -delete && \ find . -wholename '**/*.pyc' -delete && \ find . -type d -name '__pycache__' -exec rm -rf {} + && \ find . -type d -wholename './.cache' -exec rm -rf {} + && \ find . -type d -wholename './.mypy_cache' -exec rm -rf {} + && \ find . -type d -wholename './.ruff_cache' -exec rm -rf {} + && \ find . -type d -wholename '.pytest_cache' -exec rm -rf {} + && \ find . -type d -wholename '**/.pytest_cache' -exec rm -rf {} + && \ echo "Cleaned up derived files" cleanenv: ## Remove virtual env and lock files @find . -name 'uv.lock' -delete && \ find . -type d -wholename './.venv' -exec rm -rf {} + && \ echo "Cleaned up virtual env and lock files" cleanall: cleanderived cleanenv ## Remove all derived files + env reinstall: cleanenv install ## Clean env and reinstall @echo "Reinstalled dependencies" ri: reinstall ## Shorthand -> reinstall ########################################################################################## ### LINTING & FORMATTING ########################################################################################## ruff-format: install ## Format Python with ruff @$(VENV_RUFF) format . ruff-lint: install ## Lint Python with ruff @$(VENV_RUFF) check . --fix format: ruff-format ## Format all @echo "> done: format" lint: ruff-lint ## Lint all @echo "> done: lint" pyright: install ## Type-check with pyright @$(VENV_PYRIGHT) --pythonpath $(VENV_PYTHON) --project pyproject.toml mypy: install ## Type-check with mypy @$(VENV_MYPY) fix-unused-imports: install ## Fix unused imports with ruff @$(VENV_RUFF) check --select=F401 --fix . fui: fix-unused-imports ## Shorthand -> fix-unused-imports ########################################################################################## ### CHECKS ########################################################################################## check-shared: install ## Verify shared refs + target versions + template freshness + format + lint + typecheck @$(VENV_PYTHON) scripts/check.py --scope shared @$(VENV_PYTHON) scripts/gen_skill_docs.py --target all --check @$(VENV_RUFF) format --check . @$(VENV_RUFF) check . # `ignore = ["F401"]` in pyproject hides unused imports from the line above; # `--select` on the command line overrides it. Reported here, never fixed, # because `agent-check` is the target that repairs and this one only reports. @$(VENV_RUFF) check --select=F401 --no-fix . @$(MAKE) --no-print-directory pyright mypy check-claude: install ## Verify Claude marketplace packaging consistency @$(VENV_PYTHON) scripts/check.py --scope claude check-codex: install ## Verify Codex packaging consistency (canonical packaging/codex-marketplace.json) @$(VENV_PYTHON) scripts/check.py --scope codex check: check-shared check-claude check-codex ## Run shared, Claude, and Codex checks agent-check: fix-unused-imports format lint ## Full quality check (for AI agents) @$(MAKE) --no-print-directory check @echo "• All checks passed." ########################################################################################## ### TESTING ########################################################################################## test: install ## Run unit tests @$(VENV_PYTEST) tests/ -v tp: install ## Run tests with prints (TEST=name to filter) @if [ -n "$(TEST)" ]; then \ $(VENV_PYTEST) tests/ -s -v -k "$(TEST)"; \ else \ $(VENV_PYTEST) tests/ -s -v; \ fi # The selection the Windows job runs under PowerShell with no bash (.github/workflows/windows.yml), run here. test-cross-os: install ## Run the tests that must also pass on Windows (the cross_os marker) @$(VENV_PYTEST) tests/ -m cross_os -v test-recipes: install ## Execute the shipped synthetic-inputs recipes (slow; runs uv, downloads packages) @$(VENV_PYTEST) tests/recipes -m recipes -v # The command a consumer runs, from a wheel built from this checkout and installed into a fresh environment # with its bytecode compiled, as pip does by default, then run outside the checkout, in two checks. The smoke # fixture's committed rendering must pass `--check`, and fail it once a byte of it has changed. Then every # upstream skill, rendered from the checkout, must pass the installed command's `--check`, bytes and executable # bits alike, so the wheel carries all the render reads and nothing the installer adds beside it. The wheel and # the environment are new on every run, so no uv cache can hand back an older build, which `uvx --from .` does # after a file is deleted. `set -e` because the macOS make ignores .SHELLFLAGS. check-outside-smoke: install ## Build the wheel, install it in a fresh environment, and run its pipelex-plugins-render --check outside the checkout @set -euo pipefail; scratch="$$(mktemp -d)"; trap 'rm -rf "$$scratch"' EXIT; \ uv build --wheel --quiet --out-dir "$$scratch/dist"; \ uv venv --quiet "$$scratch/venv"; \ uv pip install --quiet --compile-bytecode --python "$$scratch/venv/bin/python" "$$scratch"/dist/*.whl; \ render="$$scratch/venv/bin/pipelex-plugins-render"; \ mkdir -p "$$scratch/smoke"; cp -R "$(OUTSIDE_SMOKE_DIR)/." "$$scratch/smoke/"; \ "$$render" "$$scratch/smoke/source/smoke.toml" --check; \ printf 'x' >> "$$scratch/smoke/rendered/smoke-notes/SKILL.md"; \ if "$$render" "$$scratch/smoke/source/smoke.toml" --check >/dev/null; then \ echo "FAIL: --check passed on a rendering changed by one byte"; exit 1; \ fi; \ mkdir -p "$$scratch/every-skill"; \ printf '[render]\noutput = "../every-skill-rendered"\n\n[vars]\nplatform = "agent-skills"\nharness_name = "the harness"\nskill_dir = "<skill-dir>"\n' \ > "$$scratch/every-skill/every-skill.toml"; \ $(VENV_PYTHON) -m scripts.outside_render "$$scratch/every-skill/every-skill.toml" >/dev/null; \ "$$render" "$$scratch/every-skill/every-skill.toml" --check; \ echo "• The installed pipelex-plugins-render checks the smoke fixture, and renders every skill as the checkout does" agent-test: install ## Run unit tests quietly (output only on failure) @echo "• Running unit tests..." @tmpfile=$$(mktemp); \ if $(VENV_PYTEST) -o log_level=WARNING --tb=short -q > "$$tmpfile" 2>&1; then \ exit_code=0; \ else \ exit_code=$$?; \ fi; \ if [ $$exit_code -ne 0 ]; then cat "$$tmpfile"; fi; \ rm -f "$$tmpfile"; \ if [ $$exit_code -eq 0 ]; then echo "• All tests passed."; fi; \ exit $$exit_code ########################################################################################## ### HELP ########################################################################################## help: ## Show this help @grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | \ awk 'BEGIN {FS = ":.*?## "}; {printf " %-18s %s\n", $$1, $$2}' ########################################################################################## ### BUILD ########################################################################################## gen-skill-docs: install ## Generate SKILL.md from .j2 templates (use TARGET=name to build one target) @$(VENV_PYTHON) scripts/gen_skill_docs.py --target $(TARGET) build: install ## Build all targets (prod + codex + mistral-vibe) @$(VENV_PYTHON) scripts/gen_skill_docs.py --target all @echo "Done: built all targets" # The outside-target smoke fixture, whose rendering is committed beside its source. The render refuses an # output inside this repository, so the fixture is rendered in a scratch copy and the result copied back. OUTSIDE_SMOKE_DIR := tests/data/outside-target-smoke render-outside-smoke: install ## Re-render the outside-target smoke fixture's committed output @set -euo pipefail; scratch="$$(mktemp -d)"; trap 'rm -rf "$$scratch"' EXIT; \ cp -R "$(OUTSIDE_SMOKE_DIR)/." "$$scratch/"; \ $(VENV_PYTHON) -m scripts.outside_render "$$scratch/source/smoke.toml"; \ rm -rf "$(OUTSIDE_SMOKE_DIR)/rendered"; \ cp -R "$$scratch/rendered" "$(OUTSIDE_SMOKE_DIR)/rendered" # Where the check.mjs hook bundle is built: the js/ directory of a pipelex-sdk checkout (override for a non-sibling one). SDK_JS_DIR ?= ../pipelex-sdk/js vendor-hook: ## Rebuild check.mjs in pipelex-sdk's js/ and vendor it into templates/hooks/assets/ @cd "$(SDK_JS_DIR)" && npm run build:hook @cp "$(SDK_JS_DIR)/dist-hooks/check.mjs" templates/hooks/assets/check.mjs @head -3 templates/hooks/assets/check.mjs | tail -1 @echo "• Vendored check.mjs — now run 'make build' to propagate it to the targets" # A release gate, not a CI check: it needs SDK_JS_DIR on its base and the network, and CI has neither. check-hook-fresh: install ## Fail when the vendored check.mjs is behind npm's tools-wasm or a rebuild in SDK_JS_DIR (release gate) @$(VENV_PYTHON) scripts/check_hook_fresh.py --sdk-js-dir "$(SDK_JS_DIR)" ########################################################################################## ### CODEX MARKETPLACE SOURCE (local dev vs published GitHub) ########################################################################################## CODEX_MARKETPLACE_NAME := pipelex-plugins CODEX_OFFICIAL_SOURCE := Pipelex/pipelex-plugins CODEX_LOCAL_SOURCE := $(CURDIR) CODEX_PLUGIN_REF := pipelex@$(CODEX_MARKETPLACE_NAME) # Codex >= 0.144 runs installed plugins from a cache copy # ($CODEX_HOME/plugins/cache/<marketplace>/<plugin>/<version>) taken at # install time, and `codex plugin marketplace upgrade` only refreshes Git # marketplace snapshots. So for a local-path marketplace the cache re-sync is # an idempotent `codex plugin add` — that is what codex-refresh does, and both # codex-use-* targets end with it. codex-use-local: ## Point Codex at this local pipelex-plugins checkout (refreshes plugin cache) @codex plugin marketplace remove $(CODEX_MARKETPLACE_NAME) >/dev/null 2>&1 || true @codex plugin marketplace add "$(CODEX_LOCAL_SOURCE)" @codex plugin add $(CODEX_PLUGIN_REF) @echo "• Codex marketplace '$(CODEX_MARKETPLACE_NAME)' now points at $(CODEX_LOCAL_SOURCE)" @echo " Restart Codex to pick up the swap. If the hook config changed, re-trust it on first run." codex-use-official: ## Point Codex back at the published GitHub marketplace (refreshes plugin cache) @codex plugin marketplace remove $(CODEX_MARKETPLACE_NAME) >/dev/null 2>&1 || true @codex plugin marketplace add $(CODEX_OFFICIAL_SOURCE) @codex plugin add $(CODEX_PLUGIN_REF) @echo "• Codex marketplace '$(CODEX_MARKETPLACE_NAME)' now points at $(CODEX_OFFICIAL_SOURCE)" @echo " Restart Codex to pick up the swap. If the hook config changed, re-trust it on first run." codex-refresh: ## Re-sync the installed plugin's cache copy from the marketplace source (run after make build) @codex plugin add $(CODEX_PLUGIN_REF) codex-status: ## Show which source is currently registered for the Codex pipelex marketplace @awk '/^\[marketplaces\.$(CODEX_MARKETPLACE_NAME)\]/{flag=1; next} /^\[/{flag=0} flag' \ "$$HOME/.codex/config.toml" \ | grep -E "^(source_type|source|last_revision|last_updated)" \ || echo "• No '$(CODEX_MARKETPLACE_NAME)' marketplace registered." ########################################################################################## ### LOCAL WORKSHOP (start an agent on a pipelex-mcp the plugin does not ship) ########################################################################################## # MCP is a pipelex-mcp checkout or worktree, whose workshop scripts/local_mcp.py builds # with the checkout's own `make build-local` first; MCP_VERSION, a published @pipelex/mcp # version or dist-tag, replaces it and builds nothing. WORKDIR is where the session # starts, which is where the workshop resolves a { path } file. ARGS goes to claude or # codex as it is. Neither target writes a tracked file: see "A local build of # pipelex-mcp" in docs/development.md. # # Each is read from make's command line alone, and never assigned here: the names are # generic, so a shell variable called WORKDIR or ARGS belongs to some other tool, and it # reaches the session as it was. Each is taken unexpanded, so make acts on no `$` in it, # and a path goes as one single-quoted shell word, which the shell does not act on either. local_mcp_given = $(if $(filter command line,$(origin $(1))),$(value $(1)),$(2)) local_mcp_word = '$(subst ','\'',$(call local_mcp_given,$(1),$(2)))' LOCAL_MCP_SOURCE = $(if $(call local_mcp_given,MCP_VERSION,),--mcp-version $(call local_mcp_word,MCP_VERSION,),--mcp $(call local_mcp_word,MCP,../pipelex-mcp)) LOCAL_MCP_OPTIONS = $(LOCAL_MCP_SOURCE) --workdir $(call local_mcp_word,WORKDIR,.) -- $(call local_mcp_given,ARGS,) claude-local-mcp: install ## Start Claude Code on this checkout's skills with another workshop (MCP=path or MCP_VERSION=x.y.z) @$(VENV_PYTHON) scripts/local_mcp.py claude $(LOCAL_MCP_OPTIONS) codex-local-mcp: install ## Start Codex with another workshop in place of the plugin's (MCP=path or MCP_VERSION=x.y.z) @$(VENV_PYTHON) scripts/local_mcp.py codex $(LOCAL_MCP_OPTIONS) |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |