diff --git a/.agents/README.md b/.agents/README.md index 6b400422a0..165a4a7745 100644 --- a/.agents/README.md +++ b/.agents/README.md @@ -65,6 +65,7 @@ JSON, REPL access, and so on. | [`nrepl-eval`](skills/nrepl-eval/SKILL.md) | Run Clojure or ClojureScript code in the live REPL sessions (backend and frontend). | | [`taiga`](skills/taiga/SKILL.md) | Look up Penpot issues, user stories, and tasks in Taiga. | | [`testing`](skills/testing/SKILL.md) | The repo's testing rules and TDD workflow, loaded before writing tests. | +| [`local-ci`](skills/local-ci/SKILL.md) | Run CI-style lint, test, and format checks for the modules you touched with `scripts/ci`, and read the logs when they fail. | | [`security-and-hardening`](skills/security-and-hardening/SKILL.md) | Security checks for code that handles user input, auth, or external services. | | [`ste`](skills/ste/SKILL.md) | Rewrites prose in Simplified Technical English. Loads only when you name it. | | [`refine-prompt`](skills/refine-prompt/SKILL.md) | Rewrites a rough prompt into a clearer one. Never runs the prompt. | diff --git a/.agents/skills/local-ci/SKILL.md b/.agents/skills/local-ci/SKILL.md new file mode 100644 index 0000000000..5cda6acf89 --- /dev/null +++ b/.agents/skills/local-ci/SKILL.md @@ -0,0 +1,95 @@ +--- +name: local-ci +description: Run local CI-style checks with ./scripts/ci (lint, tests, format) per monorepo module. Use when verifying changes before declaring work done, running lint or tests locally, fixing formatting, or repairing Clojure delimiter errors. +--- + +# Local CI + +Run the same checks CI runs, locally, for the modules you touched, with +`scripts/ci`. Each task writes a log file; the final summary says what +passed and what failed. + +Full details: `mem:scripts/ci` (file: `.serena/memories/scripts/ci.md`) + +## When to use + +- After implementing or fixing code — verify every module you touched + before declaring the work done. +- When the user asks to run CI, lint, tests, or format checks locally. +- When you changed `common/` — validate its consumers too. + +**Skip:** while exploring, planning, or reading code. + +## Command reference + +Run from the repo root: + +```bash +./scripts/ci [OPTIONS] [MODULES...] +``` + +Modules: `frontend` `backend` `common` `render-wasm` `exporter` `mcp` +`plugins` `library`, or `--all` for every module. + +With no task flags it runs three tasks per module, in order: **lint**, +**test**, **fmt** (format check; `--fix` formats files instead). + +| Flag | Effect | +|------|--------| +| `--all` | Run every module | +| `--exclude MOD` | Skip one module (repeatable) | +| `--lint` / `--no-lint` | Run only lint / drop lint | +| `--test` / `--no-test` | Run only tests / drop tests | +| `--fmt` / `--no-fmt` | Run only format check / drop it | +| `--fix` | Format files instead of checking (other tasks unaffected) | +| `--paren-repair` | Fix delimiter errors in Clojure/CLJS files | +| `--fail-fast` | Stop at the first failure | +| `--quiet` | Suppress failure output | +| `--dry-run` | Show what would run, execute nothing | +| `--clean` | Delete the `.ci-logs/` directory | + +## Reading failures + +Every task writes its full output to `.ci-logs/-.log`. On +failure the script prints only the last 30 lines. To diagnose a failure, +**read the log file** — never re-run the command piped through filters +(repo rule: redirect to a file first, then read it). The exit code is 1 +when any task failed; the summary lists each failed `module:task` and its +log path. + +## Typical workflows + +```bash +# Verify a module you changed: lint + tests + format check +./scripts/ci frontend + +# Fast pass while iterating: lint only +./scripts/ci --lint frontend + +# Lint + format check, skip the long test suite +./scripts/ci --no-test frontend + +# Format the module without running the test suite +./scripts/ci --fix --no-test frontend + +# Broke delimiters in Clojure/CLJS files: repair first, then lint +./scripts/ci --paren-repair frontend +./scripts/ci --lint frontend + +# Changed common/ — validate its consumers too +./scripts/ci frontend backend exporter + +# Preview what would run, without running it +./scripts/ci --dry-run --all +``` + +## Gotchas + +- Run from the repo root. +- Test tasks are long-running (backend runs `clojure -M:dev:test`); give + the bash call a generous timeout (10–20 minutes) instead of letting it + time out mid-run. +- `mcp` has no lint task — it shows as skipped, not failed. +- `--paren-repair` only fixes delimiters; run lint afterwards to catch + what remains. See `mem:scripts/paren-repair`. +- What to run and how to read test results: `mem:testing`. diff --git a/.serena/memories/critical-info.md b/.serena/memories/critical-info.md index 0854fe28ee..26fcfe2971 100644 --- a/.serena/memories/critical-info.md +++ b/.serena/memories/critical-info.md @@ -78,6 +78,10 @@ module. You can read it from `mem:/core` workspaces (root, modules, member packages). Keeps the shared pnpm store at `/.pnpm-store` unless `--store`; ignores `external/` and `.opencode/`. Usage and reinstall steps: `mem:workflow/updating-pnpm`. +- `scripts/ci` — CI orchestration script: runs lint, tests, and format + checks per module (`frontend backend common render-wasm exporter mcp + plugins library`). Logs go to `.ci-logs/`; read the log file on failure. + See `mem:scripts/ci`. # Dependency graph diff --git a/.serena/memories/scripts/ci.md b/.serena/memories/scripts/ci.md new file mode 100644 index 0000000000..69d3fa6968 --- /dev/null +++ b/.serena/memories/scripts/ci.md @@ -0,0 +1,61 @@ +# CI (scripts/ci) + +`scripts/ci` runs CI-style checks — lint, tests, format — for one or more +monorepo modules and prints a per-task summary. It is the local equivalent +of CI; use it to verify changes before declaring work done. + +## When to use + +- After implementing or fixing code in a module: run its checks before + finishing (AGENTS.md: run the applicable lint and format checks). +- When `common/` changed: validate its consumers too (frontend, backend, + exporter; see the dependency graph in `mem:critical-info`). +- To fix formatting across a module (`--fix`) or repair delimiters + (`--paren-repair`) before linting. + +## How to use (CLI) + +Run from the repo root: + +```bash +./scripts/ci MODULE... # lint + test + fmt per module +./scripts/ci --all --no-test # lint + fmt on all modules +./scripts/ci --lint frontend # lint only +./scripts/ci --fix --no-test frontend # format files, skip tests +./scripts/ci --paren-repair --all # fix delimiters in all Clojure modules +./scripts/ci --dry-run --all # preview what would run +``` + +Modules: `frontend backend common render-wasm exporter mcp plugins library`. + +Flags: + +- Default tasks: `lint`, `test`, `fmt` (format check; `--fix` formats + instead). +- `--lint` / `--test` / `--fmt` run one task only; `--no-lint` / + `--no-test` / `--no-fmt` drop one task from the default set. +- `--paren-repair` runs only the delimiter repair — it wraps + `scripts/paren-repair` over each module's Clojure/CLJS sources; see + `mem:scripts/paren-repair`. +- `--all` selects every module; `--exclude MOD` drops one (repeatable). +- `--fail-fast` stops at the first failure; `--quiet` suppresses failure + output; `--dry-run` prints commands without running; `--clean` removes + the log directory. + +## Logs and exit codes + +- Full output of every task: `.ci-logs/-.log`. +- On failure the script prints the last 30 lines; the final summary lists + every failed `module:task` with its log path. +- Exit code 0 when all selected tasks passed, 1 otherwise. +- Diagnose failures by reading the log file — never pipe test output + through filters (AGENTS.md hard rule). + +## Notes + +- `mcp` has no lint task (shows as skipped). `render-wasm` uses `./lint`, + `./test`, and `cargo fmt`. +- Test tasks are long-running (backend: `clojure -M:dev:test`); use a + generous timeout when calling it from an agent shell. +- Skill entry point: `.agents/skills/local-ci/SKILL.md`. +- Testing principles and output discipline: `mem:testing`. diff --git a/AGENTS.md b/AGENTS.md index a02706f460..bc2b4c9865 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -145,6 +145,6 @@ precision while maintaining a strong focus on maintainability and performance. - `scripts/nrepl-eval.mjs` — Evaluate Clojure code via nREPL (backend + frontend). - `scripts/check-commit` — Validate commit messages against Penpot's commit guidelines. - `scripts/check-fmt-clj` — Check Clojure formatting without modifying files. -- `scripts/ci` — CI orchestration script for running lint, tests, and format checks across modules. See `scripts/ci --help`. +- `scripts/ci` — CI orchestration script for running lint, tests, and format checks across modules. See `mem:scripts/ci`. - `scripts/gh.py` — Multi-purpose GitHub CLI helper. Subcommands: `issues` (list issues in a milestone), `prs` (fetch PR details), `advisories` (list/inspect security advisories). See `python3 scripts/gh.py --help`.