Files
computer-playbook/Makefile
T
kevinveenbirkenbachandClaude Opus 4.7 0e877caafe build(lint/javascript): introduce ESLint + eslint-plugin-playwright
Wires JavaScript linting into the project for the first time, scoped to
the Playwright specs and persona helpers under `roles/**/files/**/*.js`.

Setup
-----
- `package.json` + `package-lock.json` pin eslint v9, eslint-plugin-
  playwright v2, @eslint/js, globals.
- `eslint.config.js` (flat config) loads `eslint:recommended` and
  `playwright/flat/recommended`. Browser globals are injected so
  `page.evaluate(() => window.foo)` callbacks lint cleanly. Project-
  idiomatic patterns are explicitly turned off with rationale: the
  service-gating contract (req 006/019) uses test.skip on disabled
  services; persona helpers branch on isVisible/isServiceEnabled before
  expect; some specs deliberately use waitForTimeout / networkidle for
  OIDC settle. `no-empty` allows the empty-catch idiom; the autofixer
  for `prefer-web-first-assertions` and `no-wait-for-navigation` is
  unsafe in this codebase (broken diff in dashboard.js), so both are
  off pending a hand-migration pass.
- `scripts/lint/javascript.sh` mirrors the markdown.sh shape (skip on
  missing, exit 127 with "make install-lint" hint).
- `scripts/lint/autoformat.sh` gets a `run_eslint` worker (treats rc≤1
  as OK, like markdownlint).
- `scripts/install/lint.sh` gets `ensure_eslint` (npm-local install in
  the repo root, matching the markdownlint pattern), a `javascript`
  group, and `install_javascript_tools` is wired into the `all` group.
- `Makefile` exposes `lint-javascript` and folds it into the aggregate
  `lint` target.
- `.github/workflows/lint-javascript.yml` follows the lint-makefile.yml
  shape (Node 20, npm cache, `npm ci`, `make lint-javascript`); the
  ci-orchestrator wires it into the lint pipeline + lint-gate `needs:`.
- `.gitignore` adds `node_modules/`.

Real lint findings fixed in this commit
---------------------------------------
- `roles/web-app-decidim/files/playwright.spec.js` was using
  `runBiberFlow` / `runAdminFlow` without ever requiring `./personas`
  (would have failed at runtime). Adds the require.
- Same file: two nutzlose `\\'csrf-token\\'` escapes in a double-quoted
  query selector — eslint flagged, fixed.
- `roles/web-app-moodle/files/playwright.spec.js`:
  `expect(await locator.count()).toBe(0)` →
  `await expect(locator).toHaveCount(0)` (Playwright auto-retrying
  assertion; safe `prefer-to-have-count` autofix).

Lint baseline: 0 errors, 285 warnings (mostly `no-unused-vars` and
`playwright/expect-expect` — addressable as follow-up cleanup, not
blocking).

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-10 14:55:04 +02:00

393 lines
12 KiB
Makefile

.ONESHELL:
SHELL := /bin/bash
.SHELLFLAGS := -euo pipefail -c
# ------------------------------------------------------------
# SPOT: Global environment is defined in scripts/meta/env/all.sh
# ------------------------------------------------------------
ENV_SH ?= $(CURDIR)/scripts/meta/env/all.sh
export ENV_SH
# For non-interactive bash, BASH_ENV is sourced before executing the command.
# This makes the env layer apply automatically to *all* Make recipes.
ifneq ("$(wildcard $(ENV_SH))","")
export BASH_ENV := $(ENV_SH)
else
$(error Missing env file: $(ENV_SH))
endif
.PHONY: setup setup-clean install install-ansible install-lint install-venv install-python install-python-dev install-system-python install-skills update-skills agent-install
.PHONY: test lint lint-action lint-ansible lint-python lint-shellcheck lint-markdown lint-galaxy lint-makefile lint-javascript autoformat test-lint test-unit test-integration test-external test-deploy test-deploy-app
.PHONY: clean clean-sudo down cache-clean
.PHONY: system-purge system-disk-usage
.PHONY: list tree mig dockerignore chmod-scripts
.PHONY: print-python
.PHONY: dns-setup dns-remove
.PHONY: environment-bootstrap environment-teardown
.PHONY: wsl2-systemd-check wsl2-dns-setup wsl2-trust-windows
.PHONY: apparmor-teardown apparmor-restore
.PHONY: disable-ipv6 restore-ipv6
.PHONY: trust-ca
.PHONY: restart refresh exec up down stop
.PHONY: build build-missing build-no-cache build-no-cache-all build-cleanup build-dependency
.PHONY: act-all act-app act-workflow
.PHONY: deploy-fresh-kept-apps container-refresh-inventory deploy-reuse-kept-all container-purge-entity container-purge-system
.PHONY: deploy-fresh-purged-apps deploy-reuse-kept-apps deploy-reuse-purged-apps deploy-fresh-kept-all
.PHONY: bootstrap mark-development
# Bootstrap the local development environment.
environment-bootstrap: wsl2-systemd-check install-python-dev install-lint apparmor-teardown dns-setup disable-ipv6
# Tear down the local development environment.
environment-teardown: apparmor-restore dns-remove restore-ipv6
# Enable systemd on WSL2.
wsl2-systemd-check:
@bash scripts/system/systemd/enable/wsl2.sh
# Set up DNS on WSL2.
wsl2-dns-setup:
@sudo bash scripts/system/network/dns/setup/wsl.sh
# Trust Windows certificates in WSL2.
wsl2-trust-windows:
@bash scripts/system/tls/trust/wsl2.sh
# Configure DNS on Linux.
dns-setup: wsl2-dns-setup
@bash scripts/system/network/dns/setup/linux.sh
# Remove the DNS configuration.
dns-remove:
@bash scripts/system/network/dns/remove.sh
# Tear down AppArmor for local development.
apparmor-teardown:
@echo "==> AppArmor: full teardown (local dev)"
@if grep -q '^[Yy1]' /sys/module/apparmor/parameters/enabled 2>/dev/null; then \
sudo bash scripts/system/apparmor/teardown.sh; \
else \
echo "[apparmor] AppArmor module is not loaded — skipping teardown"; \
fi
# Restore AppArmor profiles.
apparmor-restore:
@echo "==> AppArmor: restore profiles"
@if grep -q '^[Yy1]' /sys/module/apparmor/parameters/enabled 2>/dev/null; then \
sudo bash scripts/system/apparmor/restore.sh; \
else \
echo "[apparmor] AppArmor module is not loaded — skipping restore"; \
fi
# Trust the local CA on Linux and WSL2.
trust-ca:
@bash scripts/system/tls/trust/linux.sh
@bash scripts/system/tls/trust/wsl2.sh
# Disable IPv6 for local development.
disable-ipv6:
@sudo bash scripts/system/network/ipv6/disable.sh
@"$(MAKE)" refresh
# Restore IPv6 settings.
restore-ipv6:
@sudo bash scripts/system/network/ipv6/restore.sh
@"$(MAKE)" refresh
# Remove ignored files from the working tree.
# Falls back to sudo when the first pass leaves files behind that are owned
# by an in-container UID (typical for __pycache__/*.pyc generated by the
# infinito container running as `nobody`). On runners with passwordless sudo
# (GitHub Actions, default Linux desktops with NOPASSWD) the second pass
# clears them; without sudo the warning is reported but cleanup continues so
# the surrounding deploy/test pipeline does not abort on a pure GC step.
clean:
@echo "Removing ignored git files"
@if git rev-parse --is-inside-work-tree >/dev/null 2>&1; then \
if ! git clean -fdX; then \
echo "git clean failed (likely container-owned files). Retrying with sudo..."; \
sudo -n git clean -fdX || { \
echo "WARNING: sudo cleanup also failed; continuing"; \
exit 0; \
}; \
fi; \
else \
echo "WARNING: not inside a git repository -> skipping 'git clean -fdX'"; \
echo "WARNING: (cleanup continues)"; \
fi
# Wipe the on-disk caches populated by the `cache` compose profile
# (registry-cache mirror + MITM CA, package-cache Nexus data dir).
# Stops the cache containers first, then removes the host paths under
# /var/cache/infinito/core/cache/ . Re-run `make up` to recreate.
cache-clean:
@bash scripts/system/cache/clean.sh
# Remove ignored files from the working tree with sudo.
clean-sudo:
@echo "Removing ignored git files with sudo"
sudo git clean -fdX;
# Show disk and Docker resource usage to identify what to clean up.
system-disk-usage:
@bash scripts/system/meta/disk-usage.sh
# Run the broad low-hardware cleanup routine.
system-purge:
@bash scripts/system/purge/system.sh
# Restart the development stack.
restart:
@"$${PYTHON}" -m cli.administration.deploy.development restart
# Refresh the running development stack only when it already exists.
refresh:
@bash scripts/system/network/docker/stack_refresh.sh
# Run a shell or command in the running container.
# Usage: make exec — opens interactive shell
# make exec CMD="..." — runs command non-interactively
exec:
@bash scripts/tests/deploy/local/exec/container.sh
# Start the development stack.
up: install
@"$${PYTHON}" -m cli.administration.deploy.development up
# Stop the development stack.
down:
@"$${PYTHON}" -m cli.administration.deploy.development down
# Stop the development stack without removing volumes.
stop:
@"$${PYTHON}" -m cli.administration.deploy.development stop
# Mark all shell scripts under scripts/ as executable.
chmod-scripts:
@find scripts/ -name "*.sh" -exec chmod +x {} \;
# Print the repository role list.
list:
@echo "Generating the roles list"
@"$${PYTHON}" -m cli.build.list
# Print the repository tree.
tree:
@echo "Generating Tree"
@"$${PYTHON}" -m cli.build.tree -D 2
# Build the meta graph inputs.
mig: list tree
@echo "Creating meta data for meta infinity graph"
# Build the local image.
build: dockerignore
@IMAGE_TAG="$$(bash scripts/meta/resolve/image/local.sh)" \
bash scripts/image/build.sh
# Build the local image if it is missing.
build-missing:
@IMAGE_TAG="$$(bash scripts/meta/resolve/image/local.sh)" \
bash scripts/image/build.sh --missing
# Pull the build dependency image.
build-dependency:
@docker pull ghcr.io/kevinveenbirkenbach/pkgmgr-$${INFINITO_DISTRO}:stable
# Build the local image without cache.
build-no-cache: build-dependency
@IMAGE_TAG="$$(bash scripts/meta/resolve/image/local.sh)" \
bash scripts/image/build.sh --no-cache
# Build the no-cache image for every distro.
build-no-cache-all:
@set -euo pipefail; \
for d in $${DISTROS}; do \
echo "=== build-no-cache: $$d ==="; \
INFINITO_DISTRO="$$d" "$(MAKE)" build-no-cache; \
done
# Clean up image artifacts.
build-cleanup:
@bash scripts/image/cleanup.sh
# Regenerate .dockerignore from .gitignore.
dockerignore:
@echo "Create dockerignore"
cat .gitignore > .dockerignore
echo ".git" >> .dockerignore
# Install Ansible dependencies.
install-ansible:
@ANSIBLE_COLLECTIONS_DIR="$(HOME)/.ansible/collections" \
bash scripts/install/ansible.sh
# Install lint dependencies.
install-lint:
@bash scripts/install/lint.sh
# Install agent skills from skills-lock.json.
install-skills:
@bash scripts/install/skills/install.sh
# Update all agent skills to latest versions and refresh skills-lock.json.
update-skills:
@bash scripts/install/skills/update.sh
# Install the system Python prerequisites.
install-system-python:
@bash roles/dev-python/files/install.sh ensure
# Install the virtual environment.
install-venv: install-system-python
@bash scripts/install/venv.sh
# Install Python tooling.
install-python: install-venv
@bash scripts/install/python.sh
# Install Python tooling including lint and dev dependencies.
install-python-dev: install-python
@bash scripts/install/python.sh dev
@bash scripts/install/pre-commit.sh
# Install all runtime dependencies.
install: install-python install-ansible
# Install OS-level sandbox dependencies (bubblewrap, socat) required by the Claude Code sandbox.
agent-install:
@bash scripts/install/sandbox.sh
# Run the setup step after generating .dockerignore.
setup: dockerignore
@bash scripts/setup.sh
# Create the development setup marker.
mark-development: dockerignore
touch env.development
# Install dependencies and prepare the project.
bootstrap: install setup
# Run setup after cleaning ignored files.
setup-clean: clean setup
@echo "Full build with cleanup before was executed."
# Run all lint checks.
lint: lint-action lint-ansible lint-python lint-shellcheck lint-markdown lint-galaxy lint-makefile lint-javascript
# Run the GitHub Actions lint checks.
lint-action:
@bash scripts/lint/action.sh
# Run Ansible lint checks (syntax-check + ansible-lint).
lint-ansible:
@bash scripts/lint/ansible.sh
# Run Python lint checks.
lint-python:
@bash scripts/lint/python.sh
# Run shellcheck lint checks.
lint-shellcheck:
@bash scripts/lint/shellcheck.sh
# Run Markdown lint checks via markdownlint-cli2.
lint-markdown:
@bash scripts/lint/markdown.sh
# Run galaxy-importer schema validation across roles/.
lint-galaxy:
@bash scripts/lint/galaxy.sh
# Run checkmake against the Makefile.
lint-makefile:
@bash scripts/lint/makefile.sh
# Run ESLint over the project's JavaScript files (Playwright specs + persona helpers).
lint-javascript:
@bash scripts/lint/javascript.sh
# Auto-format all source files (skips tools that are not installed).
autoformat:
@bash scripts/lint/autoformat.sh
# Run the full test suite.
test: test-lint test-unit test-integration test-deploy
@echo "✅ Full test (setup + tests) executed."
# Run the lint test suite.
test-lint: install
@TEST_TYPE="lint" \
INFINITO_COMPILE=0 \
bash scripts/tests/code.sh
# Run the unit test suite.
test-unit: install
@TEST_TYPE="unit" \
INFINITO_COMPILE=0 \
bash scripts/tests/code.sh
# Run the integration test suite.
test-integration: install
@TEST_TYPE="integration" \
INFINITO_COMPILE=0 \
bash scripts/tests/code.sh
# Run the external test suite.
test-external: install
@TEST_TYPE="external" \
INFINITO_COMPILE=0 \
bash scripts/tests/code.sh
# Run all act-based deploy checks.
act-all:
@bash scripts/tests/deploy/act/all.sh
# Run the act-based app deploy check.
act-app:
@bash scripts/tests/deploy/act/app.sh
# Run the act-based workflow deploy check.
act-workflow:
@bash scripts/tests/deploy/act/workflow.sh
# Refresh the container inventory without deploying apps.
container-refresh-inventory:
@bash scripts/tests/deploy/local/reset/inventory.sh
# Purge one or more app entities from the container.
container-purge-entity:
@bash scripts/tests/deploy/local/purge/entity.sh
# Purge the broader container-level deploy artifacts.
container-purge-system: container-purge-entity
@bash scripts/tests/deploy/local/purge/inventory.sh
@bash scripts/tests/deploy/local/purge/web.sh
@bash scripts/tests/deploy/local/purge/lib.sh
# Create a fresh inventory and deploy all apps.
deploy-fresh-kept-all:
@echo "=== local full deploy (type=$${TEST_DEPLOY_TYPE}, distro=$${INFINITO_DISTRO}) ==="
@bash scripts/tests/deploy/local/deploy/fresh-kept-all.sh
# Create a fresh inventory and deploy one or more apps.
deploy-fresh-kept-apps:
@: "$${APPS:?APPS must be set (e.g. APPS=web-app-nextcloud)}"
@bash scripts/tests/deploy/local/deploy/fresh-kept-app.sh "$${APPS}"
# Deploy one or more apps with purged entities. Set FULL_CYCLE=true to also run the update pass.
deploy-fresh-purged-apps: down up
@bash scripts/tests/deploy/local/deploy/fresh-purged-app.sh
# Redeploy one or more apps on an existing inventory.
deploy-reuse-kept-apps:
@DEBUG=true bash scripts/tests/deploy/local/deploy/reuse-kept-app.sh
# Redeploy all apps on an existing inventory.
deploy-reuse-kept-all:
@bash scripts/tests/deploy/local/deploy/reuse-kept-all.sh
# Purge one or more app entities, then redeploy them on existing inventory.
deploy-reuse-purged-apps: container-purge-entity
@$(MAKE) deploy-reuse-kept-apps