mirror of
https://github.com/penpot/penpot.git
synced 2026-11-18 16:12:24 +00:00
Compare commits
No commits in common. "develop" and "2.17.0-RC1" have entirely different histories.
develop
...
2.17.0-RC1
@ -1,534 +0,0 @@
|
|||||||
# Agentic development with opencode inside devenv
|
|
||||||
|
|
||||||
This doc shows how to run AI-assisted development for Penpot inside the
|
|
||||||
devenv with [opencode](https://opencode.ai). It covers the setup once,
|
|
||||||
then points to the skills that drive daily work.
|
|
||||||
|
|
||||||
Full reference lives in the technical guide:
|
|
||||||
|
|
||||||
- [Dev environment](../docs/technical-guide/developer/devenv.md)
|
|
||||||
|
|
||||||
This file does not repeat those guides. It gives the short path and
|
|
||||||
leaves room for notes we add step by step.
|
|
||||||
|
|
||||||
## TL;DR
|
|
||||||
|
|
||||||
```bash
|
|
||||||
./manage.sh pull-devenv
|
|
||||||
./manage.sh run-devenv --ws 0 --attach
|
|
||||||
```
|
|
||||||
|
|
||||||
Then open a shell in the container tmux session, run `opencode` inside
|
|
||||||
~/penpot directory.
|
|
||||||
|
|
||||||
## 1. Introduction
|
|
||||||
|
|
||||||
The LLM client — opencode, Claude Code, or Codex — runs in a shell
|
|
||||||
inside the plain devenv container, with the repo mounted and the
|
|
||||||
skills in this folder driving the work. One client session per
|
|
||||||
workspace (`ws0` is the live repo, `ws1+` are sibling clones).
|
|
||||||
|
|
||||||
This doc is written around opencode, but Claude Code runs the same
|
|
||||||
way inside devenv and follows exactly the same flows. This is not
|
|
||||||
the "agentic devenv" (`--agentic`) from the technical guide, which
|
|
||||||
runs the client outside devenv and wires it in over MCP — here the
|
|
||||||
client lives inside the sandboxed devenv docker.
|
|
||||||
|
|
||||||
The content lives at the paths the ecosystem agreed on: `AGENTS.md` at the
|
|
||||||
repository root and the skills in this folder, `.agents/skills/`. Codex,
|
|
||||||
opencode, Cursor, Zed, Amp, omp and pi read both without any setup.
|
|
||||||
|
|
||||||
Claude Code reads `AGENTS.md` from 2.1.277, through the built-in
|
|
||||||
`agents-md` plugin, but only in a project that has no instruction file of
|
|
||||||
its own. A `CLAUDE.md`, `.claude/CLAUDE.md` or `CLAUDE.local.md` anywhere
|
|
||||||
from the repository root down to your working directory hands the whole
|
|
||||||
project back to `CLAUDE.md`, and this file's guidance stops arriving. Keep
|
|
||||||
none of them here. Personal steering goes in `AGENTS.local.md`, or in
|
|
||||||
`.claude/rules/*.md` and `~/.claude/CLAUDE.md`, which the plugin does not
|
|
||||||
count and which therefore leave the project guidance in place.
|
|
||||||
|
|
||||||
Skills are untouched by that plugin and still load from `.claude/skills`
|
|
||||||
alone, which is not committed, so link it once per clone:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
mkdir -p .claude && ln -s ../.agents/skills .claude/skills
|
|
||||||
# or, with Node:
|
|
||||||
npx skills add ./.agents/skills --agent claude-code
|
|
||||||
```
|
|
||||||
|
|
||||||
Below 2.1.277, and on Bedrock, Vertex and Foundry where the fallback has
|
|
||||||
not arrived, add `ln -s AGENTS.md CLAUDE.md` and drop it once your client
|
|
||||||
has the feature. The auto-update channel decides when that is: `latest`,
|
|
||||||
the default, has it; `stable` runs about a week behind; Homebrew and the
|
|
||||||
Linux packages update by hand. Personal skills go in
|
|
||||||
`.agents/local/skills/<name>/`.
|
|
||||||
|
|
||||||
Every one of those paths is gitignored, so your own files keep working and
|
|
||||||
no checkout overwrites them. Inside the devenv, `ws0` sees the links from
|
|
||||||
the live checkout, and `ws1` and above are seeded on their first sync.
|
|
||||||
|
|
||||||
Unlike the agentic devenv, running the client inside the devenv
|
|
||||||
docker gives it full access to the live environment: every
|
|
||||||
dependency already resolved by the image, so the agent can write
|
|
||||||
and run tests directly, query the running PostgreSQL, and reach
|
|
||||||
the backend and frontend through nREPL — no proxies, no round
|
|
||||||
trips outside the container.
|
|
||||||
|
|
||||||
And if you later want vision, it is one MCP entry away — a
|
|
||||||
headless Playwright server in your `opencode.json`:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"$schema": "https://opencode.ai/config.json",
|
|
||||||
"mcp": {
|
|
||||||
"playwright": {
|
|
||||||
"type": "local",
|
|
||||||
"command": ["npx", "-y", "@playwright/mcp", "--headless"],
|
|
||||||
"enabled": true,
|
|
||||||
"env": {}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## 2. Quickstart: bring up devenv and run opencode inside
|
|
||||||
|
|
||||||
Pull once, then bring up the workspace you want (add `--ws 1`,
|
|
||||||
`--ws 2`, … for more):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
./manage.sh pull-devenv
|
|
||||||
./manage.sh run-devenv --ws 0 --attach # ws0 (the live repo)
|
|
||||||
```
|
|
||||||
|
|
||||||
This attaches to the container tmux session. Open a new shell there
|
|
||||||
(`Ctrl+b c`), `cd` to the repo, and run opencode directly:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
cd penpot;
|
|
||||||
opencode
|
|
||||||
```
|
|
||||||
|
|
||||||
One session drives exactly one workspace — for N parallel workspaces,
|
|
||||||
open one container shell and one opencode session per workspace.
|
|
||||||
|
|
||||||
Stop with `./manage.sh stop-devenv [--ws N | --all]`. Shared infra
|
|
||||||
stops when the last workspace stops.
|
|
||||||
|
|
||||||
|
|
||||||
## 3. Connecting providers
|
|
||||||
|
|
||||||
### Starting point: Zen free models, no login needed
|
|
||||||
|
|
||||||
The easiest way to try the setup is Zen's free models — they need no
|
|
||||||
login and no key. Just run opencode, pick a free model, and work.
|
|
||||||
|
|
||||||
That said, creating a Zen account and connecting with your API key is
|
|
||||||
still worth it from day one: it unlocks the full model list, spend
|
|
||||||
limits, auto-reload, and the Go-overflow fallback below. Connect
|
|
||||||
through the TUI:
|
|
||||||
|
|
||||||
- Run `/connect`, pick a provider, paste the key.
|
|
||||||
- Run `/models` to see what that provider offers.
|
|
||||||
|
|
||||||
### OpenCode Go (subscription, best value for daily use)
|
|
||||||
|
|
||||||
$10/month subscription with generous included usage — up to $60/month
|
|
||||||
of model consumption at published per-token rates, depending on the
|
|
||||||
model. Best value if you work mostly with open coding models
|
|
||||||
(GLM, Kimi, Qwen, DeepSeek, MiniMax, LongCat…).
|
|
||||||
|
|
||||||
The strong part: when you hit a model's monthly limit, Go can fall
|
|
||||||
back to your Zen balance instead of blocking (enable *Use balance* in
|
|
||||||
the console). So the setup many of us use is Go + Zen credit on top —
|
|
||||||
subscription first, pay-as-you-go overflow after.
|
|
||||||
|
|
||||||
### OpenCode Zen (pay per use)
|
|
||||||
|
|
||||||
Zen is the opencode team's gateway: curated models tested for coding
|
|
||||||
agents, fair prices, no markups, stable latency. You top up credit
|
|
||||||
and pay per request, with monthly spend limits and auto-reload.
|
|
||||||
|
|
||||||
Free usage is generous: the free models carry limits good enough for
|
|
||||||
real work, not just a quick taste. Worth knowing: brand-new,
|
|
||||||
unannounced models often show up on Zen first with a very generous
|
|
||||||
free quota so people try them — e.g. `0x Alpha`, which later turned
|
|
||||||
out to be GLM-5.3-Flash. Keep an eye on the free list; the newest
|
|
||||||
entry is often the best deal.
|
|
||||||
|
|
||||||
Two reasons to have a Zen account even with Go:
|
|
||||||
|
|
||||||
- It absorbs Go overflow (see above).
|
|
||||||
- Its free models let you try the whole setup before paying.
|
|
||||||
|
|
||||||
### OpenRouter (widest catalog)
|
|
||||||
|
|
||||||
If you already have an account, connect it: the widest model range in
|
|
||||||
one place. Trade-off is latency and occasional instability versus Zen,
|
|
||||||
which is tuned for coding agents.
|
|
||||||
|
|
||||||
Beyond code: OpenRouter also serves image, video, and audio models.
|
|
||||||
opencode itself cannot call those directly — it is built for code —
|
|
||||||
but a cheap model can quickly build you a small tool or script that
|
|
||||||
talks to them through the OpenRouter API. So if you also generate
|
|
||||||
content other than code and text, having OpenRouter connected is
|
|
||||||
worth it: the agent wires the plumbing for you.
|
|
||||||
|
|
||||||
### OpenAI (subscription or API key)
|
|
||||||
|
|
||||||
If you have an OpenAI subscription or API access, connect it — it
|
|
||||||
works very well as a daily driver alongside (or instead of) Go/Zen.
|
|
||||||
|
|
||||||
### Suggested combos
|
|
||||||
|
|
||||||
| Profile | Connect |
|
|
||||||
|---|---|
|
|
||||||
| Try it out | Nothing (Zen free models, no login) |
|
|
||||||
| Try it out, properly | Zen account + API key (free models + limits) |
|
|
||||||
| Daily use, best value | Go + Zen credit (overflow) |
|
|
||||||
| Widest model choice | Add OpenRouter |
|
|
||||||
| Already pay OpenAI | Add OpenAI account |
|
|
||||||
|
|
||||||
## 4. Recommended models
|
|
||||||
|
|
||||||
Personal picks from Andrey, current as of September 2026. Models come
|
|
||||||
and go, so treat this as a snapshot — the shape (one cheap solver,
|
|
||||||
one reviewer/planner, one explorer) matters more than the names.
|
|
||||||
|
|
||||||
| Model | Role | How often |
|
|
||||||
|---|---|---|
|
|
||||||
| Muse Spark 1.3 (`high`) | Main solver: plan, review, develop. Sharp and cheap — covers ~70% of coding tasks. | Daily |
|
|
||||||
| GLM-5.3-Flash | Reasoning all-rounder, now mostly code/plan reviewer and planner. | Daily |
|
|
||||||
| DeepSeek V4.1 Flash (`high`) | Explorer: code and idea exploration, sometimes development. Especially good at small bash/node utilities for repo chores and changelog updates. | Daily |
|
|
||||||
| LongCat 2.0 | Backup solver, occasional stand-in for Muse Spark 1.3. | Weekly |
|
|
||||||
| GPT-5.6 Luna | Alternative to DeepSeek Flash; pricier, unclear the extra cost pays off. | Rarely |
|
|
||||||
| Qwen3.8 Flash | As strong as the top three; used in rotation to avoid hammering one model. Less Go subsidy than the top picks, so mostly in overflow mode. | Overflow |
|
|
||||||
| MiMo-V2.5-Pro | Former main model; slightly pricier now next to Muse Spark / GLM-Flash / LongCat, and less Go subsidy — used in overflow. | Overflow |
|
|
||||||
| Kimi K3 | Heavy reasoning for hard reviews and plans. Expensive, ~1% of tasks. | Rarely |
|
|
||||||
| GLM-5.3 | Same slot as Kimi K3: hard reviews and plans only. | Rarely |
|
|
||||||
|
|
||||||
**TL;DR:** the first three (Muse Spark 1.3, GLM-5.3-Flash, DeepSeek
|
|
||||||
V4.1 Flash) are a good starting point.
|
|
||||||
|
|
||||||
## 5. Customizing your `opencode.json`
|
|
||||||
|
|
||||||
opencode merges config in this order (later wins):
|
|
||||||
|
|
||||||
1. Global: `~/.config/opencode/opencode.json` (on host, or the dir
|
|
||||||
mounted with `--opencode-config-dir` inside devenv —
|
|
||||||
see §9 Advanced usage).
|
|
||||||
2. Project: `opencode.json` at the repo root (gitignored on purpose —
|
|
||||||
use it to override the global entries for one workspace).
|
|
||||||
|
|
||||||
Below is a full working example of my personal config at the date of
|
|
||||||
writing this. It is only an example: define whatever subagents you
|
|
||||||
need, with whatever models you like or work with.
|
|
||||||
|
|
||||||
Copy it to `opencode.json` on the root of the repo:
|
|
||||||
|
|
||||||
```json
|
|
||||||
{
|
|
||||||
"$schema": "https://opencode.ai/config.json",
|
|
||||||
"disabled_providers": ["amazon-bedrock"],
|
|
||||||
"subagent_depth": 2,
|
|
||||||
"agent": {
|
|
||||||
"compaction": {
|
|
||||||
"model": "opencode-go/deepseek-flash",
|
|
||||||
"variant": "high"
|
|
||||||
},
|
|
||||||
"title": {
|
|
||||||
"model": "opencode-go/deepseek-flash",
|
|
||||||
"variant": "low"
|
|
||||||
},
|
|
||||||
"explore": {
|
|
||||||
"model": "opencode-go/deepseek-flash",
|
|
||||||
"variant": "high"
|
|
||||||
},
|
|
||||||
"build": {
|
|
||||||
"prompt": "{file:.agents/prompts/engineer-agent-prompt.md}",
|
|
||||||
"permission": {
|
|
||||||
"external_directory": {
|
|
||||||
"/tmp/**": "allow"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"general": {
|
|
||||||
"prompt": "{file:.agents/prompts/engineer-agent-prompt.md}",
|
|
||||||
"permission": {
|
|
||||||
"external_directory": {
|
|
||||||
"/tmp/**": "allow"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"engineer-glm": {
|
|
||||||
"mode": "subagent",
|
|
||||||
"model": "opencode-go/glm-5.3-flash",
|
|
||||||
"variant": "high",
|
|
||||||
"prompt": "{file:.agents/prompts/engineer-agent-prompt.md}",
|
|
||||||
"permission": {
|
|
||||||
"*": "allow",
|
|
||||||
"task": {
|
|
||||||
"*": "allow"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"engineer-kimi": {
|
|
||||||
"mode": "subagent",
|
|
||||||
"model": "opencode/kimi-k3",
|
|
||||||
"variant": "high",
|
|
||||||
"prompt": "{file:.agents/prompts/engineer-agent-prompt.md}",
|
|
||||||
"permission": {
|
|
||||||
"*": "allow",
|
|
||||||
"task": {
|
|
||||||
"*": "allow"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
},
|
|
||||||
|
|
||||||
"engineer-qwen": {
|
|
||||||
"mode": "subagent",
|
|
||||||
"model": "opencode-go/qwen3.7-plus",
|
|
||||||
"variant": "high",
|
|
||||||
"prompt": "{file:.agents/prompts/engineer-agent-prompt.md}",
|
|
||||||
"permission": {
|
|
||||||
"*": "allow",
|
|
||||||
"task": {
|
|
||||||
"*": "allow"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
What the blocks mean:
|
|
||||||
|
|
||||||
- `compaction` / `title` / `explore`: cheap background agents. Keep
|
|
||||||
them on a fast model; `title` uses the `low` variant on purpose.
|
|
||||||
- `build` / `general`: the main agents. They load the shared prompt
|
|
||||||
`{file:.agents/prompts/engineer-agent-prompt.md}` and may only touch
|
|
||||||
`/tmp/**` outside the repo without asking for explicit permision.
|
|
||||||
- `engineer-*`: one subagent per model family, all with the same
|
|
||||||
prompt and full permissions (`"*": "allow"`). They purpose are
|
|
||||||
specially for delegate work to them because are defined to be used
|
|
||||||
only as subagents.
|
|
||||||
- `disabled_providers` / `subagent_depth`: global guards. Keep
|
|
||||||
`"$schema"` — opencode refuses to start if any field is wrong.
|
|
||||||
|
|
||||||
How the `engineer-*` subagents are actually used — delegating work to
|
|
||||||
them to keep the main context clean — is covered in §6 Common agentic
|
|
||||||
flows.
|
|
||||||
|
|
||||||
Note this is opencode-only: other clients have their own way of
|
|
||||||
defining subagents or helpers — or none at all.
|
|
||||||
|
|
||||||
## 6. Common agentic flows
|
|
||||||
|
|
||||||
Work happens two ways: directly in your session, or delegated to a
|
|
||||||
subagent. Besides the `engineer-*` subagents from §5 there is a
|
|
||||||
builtin `general` subagent. Delegating planning and review to a
|
|
||||||
subagent starts a fresh, clean context with a clean prompt instead
|
|
||||||
of growing the main session — the main lever for keeping context
|
|
||||||
small. To delegate without switching models, delegate to `general`.
|
|
||||||
|
|
||||||
### Issue / error report flow
|
|
||||||
|
|
||||||
1. **Frame the problem.** Enter Plan mode (TAB in opencode) and paste the
|
|
||||||
report with your intent: "investigate this and find the possible cause",
|
|
||||||
"investigate and tell me where this points", or "does this still apply?".
|
|
||||||
Explore until you and the agent roughly agree on the problem.
|
|
||||||
2. **Write the plan.** Run `/make-a-plan` — it executes in Build mode.
|
|
||||||
If you need to step in and answer something yourself, press TAB to
|
|
||||||
leave Build mode. Use Plan mode only when you want a hard guarantee
|
|
||||||
that the agent modifies no file under any circumstance. If you
|
|
||||||
explored with a weaker model but want a stronger one to write the
|
|
||||||
plan, switch models first or delegate:
|
|
||||||
`/make-a-plan delegate to @engineer-glm`.
|
|
||||||
3. **Iterate on the plan.** The plan is saved to `.agents/plans/`, so you
|
|
||||||
never depend on LLM memory: read the file directly, or run `/review-plan`
|
|
||||||
for a second opinion (delegation works here too). Complex plans deserve a
|
|
||||||
review; simple ones can skip it.
|
|
||||||
4. **Execute.** Run `/implement-plan`. It first prints the full picture —
|
|
||||||
whether it will create an issue and a branch, the execution style, and a
|
|
||||||
task checklist — and waits for your go-ahead. Say "step by step" to stop
|
|
||||||
after each task (one commit per task) so you can verify as it goes;
|
|
||||||
the default runs all tasks with one final commit.
|
|
||||||
5. **Land the work.** When it finishes, either push yourself and run
|
|
||||||
`/create-pr`, or loop `/review-code` → `/make-a-plan` →
|
|
||||||
`/implement-plan` until the findings are addressed, then push and
|
|
||||||
`/create-pr`. Nothing pushes for you — you always push from your shell.
|
|
||||||
|
|
||||||
> Note: `/implement-plan` checks the current branch. On a base branch
|
|
||||||
> (`main`, `develop`, `staging`) it creates a GitHub issue and a branch
|
|
||||||
> `issue-NNNN`; on an existing feature branch it continues there and
|
|
||||||
> creates nothing. The pre-run summary tells you which applies. Read the
|
|
||||||
> skill at `.agents/skills/implement-plan/SKILL.md` — it is
|
|
||||||
> self-explanatory.
|
|
||||||
|
|
||||||
### Big feature with multiple plans
|
|
||||||
|
|
||||||
When the work is too large for a single plan, tell `/make-a-plan`
|
|
||||||
up front: produce a high-level roadmap where each task will get its
|
|
||||||
own execution plan, and the roadmap doubles as the progress tracker.
|
|
||||||
|
|
||||||
From there the flow mirrors the issue flow above, one level down:
|
|
||||||
take each roadmap task in turn, write its own plan (`/make-a-plan`,
|
|
||||||
delegating when it helps), review it when the task is complex
|
|
||||||
(`/review-plan`), implement it (`/implement-plan`), and mark progress
|
|
||||||
on the roadmap as you land each piece.
|
|
||||||
|
|
||||||
### Plan file naming (base + derivatives)
|
|
||||||
|
|
||||||
Base plans live in `.agents/plans/` as `YYYY-MM-DD-<slug>.md`.
|
|
||||||
Derived plans reuse the parent basename verbatim and append one
|
|
||||||
suffix per level with `--`, with no new date — the parent prefix
|
|
||||||
keeps everything adjacent in `ls`:
|
|
||||||
|
|
||||||
- Review followup on implemented work:
|
|
||||||
`2026-09-14-paste-before-init-crash.md` →
|
|
||||||
`2026-09-14-paste-before-init-crash--review-01.md`
|
|
||||||
- Roadmap sub-plan (task number from the roadmap):
|
|
||||||
`2026-09-20-upload-pipeline-roadmap.md` →
|
|
||||||
`2026-09-20-upload-pipeline-roadmap--task-01-chunk-upload.md`
|
|
||||||
- Chained: `...--task-02-gc--review-01.md`
|
|
||||||
|
|
||||||
While a plan is still unimplemented, `/make-a-plan` revises it in
|
|
||||||
place. Once implemented and reviewed, it writes a new followup file.
|
|
||||||
Full rules live in the `planner` skill.
|
|
||||||
|
|
||||||
### Plan status lifecycle
|
|
||||||
|
|
||||||
Every plan carries `Status: draft | reviewed | done` plus an
|
|
||||||
append-only `Review Log` (UTC ISO 8601, one line per entry):
|
|
||||||
|
|
||||||
- `draft` — fresh from `/make-a-plan`.
|
|
||||||
- `reviewed` — review feedback incorporated. `/review-plan` stays
|
|
||||||
read-only; only your explicit "apply" makes `/make-a-plan` apply
|
|
||||||
the changes, flip the status, and log one line.
|
|
||||||
- `done` — `/implement-plan` closes it on completion, logging the
|
|
||||||
issue URL when one exists (never commit hashes).
|
|
||||||
|
|
||||||
A plan approved with no changes goes `draft` → `done` directly.
|
|
||||||
|
|
||||||
A plan is never staged or committed: the `done` status and its
|
|
||||||
`Review Log` are session bookkeeping, not part of the change. Their
|
|
||||||
absence from the commit is expected.
|
|
||||||
|
|
||||||
## 7. Connecting `gh` CLI with a token
|
|
||||||
|
|
||||||
The `create-issue` and `create-pr` flows need an authenticated `gh`
|
|
||||||
so they can run on their own. Create a fine-grained token with the
|
|
||||||
minimum scopes:
|
|
||||||
|
|
||||||
1. GitHub → Settings → Developer settings → Personal access tokens →
|
|
||||||
Fine-grained tokens → Generate new token.
|
|
||||||
2. Under Organization permissions, grant access to **Projects**.
|
|
||||||
3. Under Repository permissions, grant at least **Issues** and
|
|
||||||
**Pull requests**.
|
|
||||||
|
|
||||||
Then authenticate the CLI and follow the prompts:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
gh auth login
|
|
||||||
```
|
|
||||||
|
|
||||||
Verify with `gh auth status` (token lives in
|
|
||||||
`~/.config/gh/hosts.yml`). You still push from your own shell — the
|
|
||||||
agents only read and open issues and PRs.
|
|
||||||
|
|
||||||
## 8. Troubleshooting / FAQ
|
|
||||||
|
|
||||||
> TBD — filled in step by step as issues come up.
|
|
||||||
|
|
||||||
## 9. Advanced usage
|
|
||||||
|
|
||||||
### Personal agents and prompts without committing them here
|
|
||||||
|
|
||||||
Bind-mount a host dir over the container's `~/.config/opencode`:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
./manage.sh run-devenv --ws 0 --opencode-config-dir ../penpot-opencode
|
|
||||||
```
|
|
||||||
|
|
||||||
It applies at container creation, so changing it needs a stop + rerun
|
|
||||||
of that instance.
|
|
||||||
|
|
||||||
## Summary of available skills
|
|
||||||
|
|
||||||
### How the skills are organized
|
|
||||||
|
|
||||||
**Flows** are the six skills you invoke by name. Each one covers one step
|
|
||||||
in the life of a change: plan it, review the plan, implement it, review
|
|
||||||
the code, open the pull request.
|
|
||||||
|
|
||||||
**References** hold the quality standards. A flow's reviewer loads them;
|
|
||||||
you rarely touch them directly.
|
|
||||||
|
|
||||||
**Procedures** define how one concrete step is done — a plan document, an
|
|
||||||
issue, a commit. Flows call them, but they also work on their own.
|
|
||||||
|
|
||||||
**Utilities** are small helpers for everyday work: search, file lookup,
|
|
||||||
JSON, REPL access, and so on.
|
|
||||||
|
|
||||||
### Flows
|
|
||||||
|
|
||||||
| Skill | What it does | When you would say |
|
|
||||||
|---|---|---|
|
|
||||||
| [`make-a-plan`](skills/make-a-plan/SKILL.md) | Researches the task, writes an implementation plan, asks you the open questions in plain language, and saves the plan to `.agents/plans/`. | "make a plan for the token refresh bug" |
|
|
||||||
| [`review-plan`](skills/review-plan/SKILL.md) | Evaluates a plan before anyone writes code: completeness, ordering, risks. Approves it or asks for changes. | "review this plan before we start" |
|
|
||||||
| [`implement-plan`](skills/implement-plan/SKILL.md) | Shows you the full flow first — the issue and branch it will create (or the branch it continues on), the execution style, and the task checklist — and, after your go-ahead, executes a ready plan. Default: every task, one commit. On request ("step by step"): one task, one commit, your confirmation between tasks. On request ("direct"): no issue and no branch, commits on the current branch. | "implement the plan" · "step by step, one commit per task" · "direct, no branch" |
|
|
||||||
| [`review-code`](skills/review-code/SKILL.md) | Reviews a diff, branch, or PR and returns findings ranked by impact. | "review my changes before I push" |
|
|
||||||
| [`create-pr`](skills/create-pr/SKILL.md) | Opens a pull request for the current branch — with checks on base branch, commits, issue, and push state — or updates an existing PR's title and description. | "open a PR for this branch" |
|
|
||||||
| [`resolve-git-conflicts`](skills/resolve-git-conflicts/SKILL.md) | Untangles merge or rebase conflicts: explains both sides, proposes a resolution, applies it after you approve. Never runs `git rebase --continue`. | "resolve these conflicts" |
|
|
||||||
|
|
||||||
### References
|
|
||||||
|
|
||||||
| Skill | What it holds |
|
|
||||||
|---|---|
|
|
||||||
| [`plan-review-criteria`](skills/plan-review-criteria/SKILL.md) | The plan review rubric: six axes, severity levels, approval standard, output format. The `review-plan` reviewer loads it. |
|
|
||||||
| [`code-review-criteria`](skills/code-review-criteria/SKILL.md) | The code review rubric: five axes, core principles (DRY, KISS, YAGNI), severity format, verdict. The `review-code` reviewer loads it. |
|
|
||||||
|
|
||||||
### Procedures
|
|
||||||
|
|
||||||
| Skill | What it does |
|
|
||||||
|---|---|
|
|
||||||
| [`planner`](skills/planner/SKILL.md) | The spec of a good plan: context, architecture decisions, tasks with acceptance criteria, checkpoints. Used by `make-a-plan`. |
|
|
||||||
| [`create-issue`](skills/create-issue/SKILL.md) | Creates a GitHub issue that follows Penpot conventions. Used by `implement-plan`; also works on its own. |
|
|
||||||
| [`create-commit`](skills/create-commit/SKILL.md) | Makes a commit the Penpot way: emoji subject, clear body, `AI-assisted-by` trailer. Used by `implement-plan`; also works alone when you say "commit this". |
|
|
||||||
|
|
||||||
### Utilities
|
|
||||||
|
|
||||||
| Skill | What it does |
|
|
||||||
|---|---|
|
|
||||||
| [`bat-cat`](skills/bat-cat/SKILL.md) | Read files in the terminal with syntax highlighting and line numbers. |
|
|
||||||
| [`fd-find`](skills/fd-find/SKILL.md) | Find files by name or pattern, respecting `.gitignore`. |
|
|
||||||
| [`ripgrep`](skills/ripgrep/SKILL.md) | Fast content search with regular expressions. |
|
|
||||||
| [`jq-json-processor`](skills/jq-json-processor/SKILL.md) | Slice, filter, and reshape JSON output. |
|
|
||||||
| [`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. |
|
|
||||||
| [`update-changelog`](skills/update-changelog/SKILL.md) | Regenerates `CHANGES.md` from a GitHub milestone. |
|
|
||||||
| [`find-project-anomalies`](skills/find-project-anomalies/SKILL.md) | Checks a milestone against the Main project board and reports anomalies to `tmp/<MILESTONE>-ANOMALIES.md`. |
|
|
||||||
|
|
||||||
### A typical round
|
|
||||||
|
|
||||||
1. `/make-a-plan` — you get a plan and a saved file in `.agents/plans/`.
|
|
||||||
2. `/review-plan` — a second opinion; approve or request changes.
|
|
||||||
3. `/implement-plan` — the code gets written and committed. Starting from a base branch, it also opens the GitHub issue and the `issue-NNNN` branch; the plans that follow continue on that same branch.
|
|
||||||
4. `/review-code` — a reviewer checks the commit.
|
|
||||||
5. `/create-pr` — the branch goes up as a pull request.
|
|
||||||
|
|
||||||
Every step also works on its own, and you can always say what you want
|
|
||||||
in plain words — the agents pick the right skill from what you say.
|
|
||||||
|
|
||||||
### Adding or changing a skill
|
|
||||||
|
|
||||||
Create a folder here with a `SKILL.md` inside. The file needs `name` and
|
|
||||||
`description` in its frontmatter, and a clear "When to use" section so
|
|
||||||
agents know when to reach for it. Keep one job per skill, and keep the
|
|
||||||
two families apart: flows are named with a verb first; reference skills
|
|
||||||
end in `-criteria`.
|
|
||||||
@ -1,15 +0,0 @@
|
|||||||
Act as a senior full-stack software engineer for this project.
|
|
||||||
|
|
||||||
## Instructions
|
|
||||||
|
|
||||||
1. Read `AGENTS.md` first and follow its memory-reading rules: read `mem:critical-info`, then the core memory of every module your work touches, plus any deeper memories they reference.
|
|
||||||
2. Work autonomously: explore the codebase first, follow existing patterns and conventions, apply DRY/KISS.
|
|
||||||
3. Verify before finishing: run tests, lint and fm, fix anything you broke. Never report done with failing checks.
|
|
||||||
4. Before finishing, review the affected memories and documentation against the implementation. If the change introduces behavior, contracts, decisions, or constraints that are not documented, or makes existing documentation inaccurate, update the relevant memories and docs in the same change.
|
|
||||||
|
|
||||||
## Strong Rules
|
|
||||||
|
|
||||||
1. All new functionality ships with tests. No exceptions.
|
|
||||||
2. Do not touch unrelated modules.
|
|
||||||
3. Never `git push`, force-push, or modify remotes. Only create commits when the
|
|
||||||
command or the user explicitly instructs it.
|
|
||||||
@ -1,172 +0,0 @@
|
|||||||
---
|
|
||||||
name: code-review-criteria
|
|
||||||
description: Code review criteria — the five review axes, core principles, severity format, and verdict for reviewing code changes. Loaded by the reviewer subagent of the review-code flow. Not a user-facing flow — to review code, use the review-code flow.
|
|
||||||
---
|
|
||||||
|
|
||||||
# Code Review Criteria and Quality
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
|
|
||||||
Multi-dimensional code review with quality gates. Every change gets reviewed before merge — no exceptions. Review covers five axes: correctness, readability, architecture, security, and performance.
|
|
||||||
|
|
||||||
**The approval standard:** Approve a change when it definitely improves overall code health, even if it isn't perfect. Perfect code doesn't exist — the goal is continuous improvement. Don't block a change because it isn't exactly how you would have written it. If it improves the codebase and follows the project's conventions, approve it.
|
|
||||||
|
|
||||||
## When to Use
|
|
||||||
|
|
||||||
- The reviewer subagent of the `review-code` flow loads this skill to perform the review of a code change.
|
|
||||||
- To review code, always go through the `review-code` flow — never load this skill directly for that. This is the criteria reference, not the flow.
|
|
||||||
|
|
||||||
## Core Principles
|
|
||||||
|
|
||||||
These principles underpin every axis. When in doubt, default to them.
|
|
||||||
|
|
||||||
- **DRY (Don't Repeat Yourself):** Every piece of knowledge has one authoritative representation. Flag duplicated logic as a required change — it is not "just similar", it is drift that will diverge.
|
|
||||||
- **KISS (Keep It Simple, Stupid):** The simplest solution that works is the best solution. Complexity must earn its place: if it needs more than a sentence to explain, push for simplification before merge.
|
|
||||||
- **YAGNI (You Aren't Gonna Need It):** No abstractions, hooks or generalizations for hypothetical future use cases. Generalize on the third occurrence, not the first.
|
|
||||||
- **Don't invent problems:** Every finding must be a real risk, a real readability barrier, or a real architectural concern — not a hypothetical or a stylistic preference disguised as a problem.
|
|
||||||
|
|
||||||
## The Five-Axis Review
|
|
||||||
|
|
||||||
Every review evaluates code across these dimensions.
|
|
||||||
|
|
||||||
### 1. Correctness
|
|
||||||
|
|
||||||
Does the code do what it claims to do?
|
|
||||||
|
|
||||||
- Does it match the spec or task requirements?
|
|
||||||
- Are edge cases handled (null, empty, boundary values)?
|
|
||||||
- Are error paths handled (not just the happy path)?
|
|
||||||
- Do the tests cover the changed behavior, including its edge cases?
|
|
||||||
- Are there off-by-one errors, race conditions, or state inconsistencies?
|
|
||||||
|
|
||||||
### 2. Readability & Simplicity
|
|
||||||
|
|
||||||
Can another engineer (or agent) understand this code without the author explaining it?
|
|
||||||
|
|
||||||
- Are names descriptive and consistent with project conventions? (No `temp`, `data`, `result` without context)
|
|
||||||
- Is the control flow straightforward (avoid nested ternaries, deep callbacks)?
|
|
||||||
- Are there "clever" tricks that should be simplified? Could this be done in fewer lines? (1000 lines where 100 suffice is a failure)
|
|
||||||
- Is a new conditional bolted onto an unrelated flow? Push the logic into its own helper, state, or policy.
|
|
||||||
- Do repeated conditionals on the same shape appear? They signal a missing model or dispatcher.
|
|
||||||
- Are there dead code artifacts: no-op variables, backwards-compat shims, or `// removed` comments?
|
|
||||||
|
|
||||||
### 3. Architecture
|
|
||||||
|
|
||||||
Does the change fit the system's design?
|
|
||||||
|
|
||||||
- Does it follow existing patterns or introduce a new one? If new, is it justified?
|
|
||||||
- Does it keep clean module boundaries, with dependencies flowing the right way (no cycles)?
|
|
||||||
- Is the abstraction level appropriate (not over-engineered, not too coupled)?
|
|
||||||
- Is there existing code that already does this? Reuse the canonical helper instead of a near-duplicate, and collapse branches that do nearly the same thing.
|
|
||||||
- Is feature-specific logic leaking into a shared or general-purpose module?
|
|
||||||
- Are type boundaries explicit? Question gratuitous `any`/`unknown`/optional/casts and silent fallbacks.
|
|
||||||
- Does the change reduce complexity or relocate it? Count the concepts a reader must hold: prefer the restructuring that makes whole branches disappear, and deleting an abstraction over polishing it.
|
|
||||||
- **Give the remedy, not only the problem:** replace conditionals with dispatchers, separate orchestration from business logic, extract helpers, split large files. Prefer the remedy that removes moving pieces over one that spreads the same complexity around.
|
|
||||||
|
|
||||||
### 4. Security
|
|
||||||
|
|
||||||
For detailed security guidance, see `security-and-hardening`.
|
|
||||||
|
|
||||||
- Is user input validated and sanitized?
|
|
||||||
- Are secrets kept out of code, logs, and version control?
|
|
||||||
- Is authentication/authorization checked where needed?
|
|
||||||
- Are SQL queries parameterized (no string concatenation)?
|
|
||||||
- Are outputs encoded to prevent XSS?
|
|
||||||
- Are dependencies from trusted sources with no known vulnerabilities?
|
|
||||||
- Is data from external sources (APIs, logs, user content, config files) treated as untrusted?
|
|
||||||
|
|
||||||
### 5. Performance
|
|
||||||
|
|
||||||
- Any N+1 query patterns?
|
|
||||||
- Any unbounded loops or unconstrained data fetching?
|
|
||||||
- Any synchronous operations that should be async?
|
|
||||||
- Any unnecessary re-renders in UI components?
|
|
||||||
- Any missing pagination on list endpoints?
|
|
||||||
- Any large objects created in hot paths?
|
|
||||||
|
|
||||||
## Review Process
|
|
||||||
|
|
||||||
1. **Understand the intent** — What is this change trying to accomplish? What spec or task does it implement?
|
|
||||||
2. **Review tests first** — Tests reveal intent and coverage. Do they test behavior, not implementation details? Are edge cases covered?
|
|
||||||
3. **Review the implementation** — Walk through each file with the five axes in mind.
|
|
||||||
4. **Categorize findings** — Label every comment with its severity:
|
|
||||||
|
|
||||||
| Prefix | Meaning | Author Action |
|
|
||||||
|--------|---------|---------------|
|
|
||||||
| **Critical:** | Blocks merge | Security vulnerability, data loss, broken functionality |
|
|
||||||
| **High:** | Required change | Must address before merge |
|
|
||||||
| **Medium:** | Should fix | Strongly recommended, not a blocker |
|
|
||||||
| **Low:** | Minor, optional | Author may ignore — formatting, style preferences |
|
|
||||||
| **Suggestion:** | Worth considering | Not required, but improves the code |
|
|
||||||
|
|
||||||
**Finding IDs.** Assign every finding a stable identifier by severity class: `R1`, `R2`, … for required findings (Critical, High), `M1`, `M2`, … for minor findings (Medium, Low), and `S1`, `S2`, … for suggestions. Number within each class in review order. Use the ID everywhere the finding is mentioned — in section headers, in the verdict, in follow-up discussion. Never renumber within a review. Example: `**R2** — `app/validate.cljs:42` — duplicate branch logic…`.
|
|
||||||
|
|
||||||
For each finding, describe the circumstances under which it could fail: specific inputs, load conditions, timing, or user actions that trigger the problem. "This crashes when input is null" is actionable; "this might crash" is not.
|
|
||||||
|
|
||||||
Lead with what matters: correctness and security first, then structural issues, then everything else. A few high-conviction comments beat a long list.
|
|
||||||
|
|
||||||
5. **Check the evidence, do not re-run it** — Which tests cover the change? What did the author run, and what did CI report? Never re-run the full suite or a build yourself: the author's run and CI already cover that, and repeating it only lengthens the review. Run at most the single test file that settles a specific doubt. When no checks have been run at all (a change you did not see tested), run the module's checks before the verdict.
|
|
||||||
|
|
||||||
## Change Sizing
|
|
||||||
|
|
||||||
Small, focused changes are easier to review, faster to merge, and safer to deploy. Flag the size when a diff exceeds ~300 lines, or when it grows a file past ~1000 total lines, and name the remedy: split it, and separate refactoring from feature work. This is a finding about the change, not work to do inside the review.
|
|
||||||
|
|
||||||
## Dependencies
|
|
||||||
|
|
||||||
Before accepting a new dependency: does the existing stack already solve it, how large is the bundle impact, is it maintained, does `npm audit` report anything, is the license compatible. Prefer the standard library and existing utilities — every dependency is a liability.
|
|
||||||
|
|
||||||
For upgrades: read the changelog, not just the version number; one dependency per change; a green suite before and after; review the lockfile diff and never hand-edit it. Supply-chain triage follows `security-and-hardening`.
|
|
||||||
|
|
||||||
## Review Output
|
|
||||||
|
|
||||||
Structure every review using this format:
|
|
||||||
|
|
||||||
### Summary
|
|
||||||
|
|
||||||
Briefly explain what the code does and give an overall assessment.
|
|
||||||
|
|
||||||
### Critical and High-Priority Issues
|
|
||||||
|
|
||||||
List problems that could cause security incidents, data loss, crashes, incorrect behavior, or major performance degradation. Each finding gets its unique ID (`R1`, `R2`, …). For each: state the severity, identify the file/function/code section, explain why it's a problem, describe failure circumstances, and provide a concrete improvement with corrected code when useful.
|
|
||||||
|
|
||||||
### Other Findings
|
|
||||||
|
|
||||||
List medium- and low-priority issues, including maintainability and design concerns. Use `M1`, `M2`, … for Medium/Low and `S1`, `S2`, … for Suggestions.
|
|
||||||
|
|
||||||
### Suggested Refactoring
|
|
||||||
|
|
||||||
Provide focused code changes or revised snippets. Preserve existing behavior unless a behavior change is explicitly justified.
|
|
||||||
|
|
||||||
### Testing Recommendations
|
|
||||||
|
|
||||||
Identify missing tests and describe specific test cases, including edge cases and failure scenarios.
|
|
||||||
|
|
||||||
### Positive Observations
|
|
||||||
|
|
||||||
Mention implementation choices that are clear, safe, efficient, or well designed. This is not fluff — it reinforces good patterns and tells the author what to keep doing.
|
|
||||||
|
|
||||||
### Final Verdict
|
|
||||||
|
|
||||||
Choose one:
|
|
||||||
|
|
||||||
- **Approve** — Ready to merge
|
|
||||||
- **Approve with minor changes** — Good to merge after addressing low/medium issues
|
|
||||||
- **Request changes** — Critical or high issues must be resolved before merge
|
|
||||||
|
|
||||||
List the finding IDs the verdict depends on (e.g. "Request changes: R1, R2").
|
|
||||||
|
|
||||||
## Red Flags
|
|
||||||
|
|
||||||
- A change merged without any review.
|
|
||||||
- A review that only checks whether the tests pass.
|
|
||||||
- Security-sensitive changes without a security-focused review.
|
|
||||||
- A change too large to review properly: split it.
|
|
||||||
|
|
||||||
## Verification
|
|
||||||
|
|
||||||
Before emitting the verdict, confirm the evidence the review rests on. This covers the state of the code at review time, not the later fixing of findings:
|
|
||||||
|
|
||||||
- [ ] The suite is green, and the evidence is the author's run or CI — not your own re-run. Say which one you relied on.
|
|
||||||
- [ ] New behavior has tests that cover the edge cases in the diff.
|
|
||||||
- [ ] The verification story is stated: what changed and how it was verified.
|
|
||||||
- [ ] Dependency changes were reviewed against the changelog and the lockfile diff.
|
|
||||||
@ -1,70 +0,0 @@
|
|||||||
---
|
|
||||||
name: create-commit
|
|
||||||
description: Stage, review, and commit files following Penpot commit conventions.
|
|
||||||
slash: true
|
|
||||||
---
|
|
||||||
|
|
||||||
# Skill: create-commit
|
|
||||||
|
|
||||||
Produce a git commit that follows Penpot's commit message conventions. This
|
|
||||||
skill owns the commit format, staging review, and safety checks — it does not
|
|
||||||
implement features or push.
|
|
||||||
|
|
||||||
## When to Use
|
|
||||||
|
|
||||||
- After code changes are complete and files need to be committed
|
|
||||||
- When delegated by a workflow step (e.g. implement-plan) to handle the commit
|
|
||||||
|
|
||||||
## Required Reading
|
|
||||||
|
|
||||||
Before drafting any commit, read `mem:workflow/creating-commits` end-to-end. It
|
|
||||||
is the authoritative source for the commit message format, the emoji menu,
|
|
||||||
subject/body limits, and the `AI-assisted-by` trailer. Follow it exactly.
|
|
||||||
|
|
||||||
## Iron Rules (non-negotiable)
|
|
||||||
|
|
||||||
1. **Wrap every body line at 80 characters or fewer.** Count characters, do
|
|
||||||
not eyeball. Exceptions: `Signed-off-by:` / `AI-assisted-by:` trailers and
|
|
||||||
lines carrying a URL. This is the rule agents skip most often.
|
|
||||||
2. **Subject ≤80 chars**, imperative, capitalized, no trailing period.
|
|
||||||
`Merge`/`Revert`/`Reapply` commits skip the length check.
|
|
||||||
3. **Blank line between subject and body.**
|
|
||||||
4. **Run `./scripts/check-commit` and require exit code 0.** It mechanically
|
|
||||||
checks rules 1–3. A non-zero exit is a hard blocker: fix the message and
|
|
||||||
re-commit. Never report the commit as done with a failing checker.
|
|
||||||
|
|
||||||
## Workflow
|
|
||||||
|
|
||||||
1. **Stage the files** specified by the calling context. Do not ask for
|
|
||||||
confirmation.
|
|
||||||
2. Run `git diff --staged` to review the content. If you see secrets (API keys,
|
|
||||||
tokens, passwords, private keys, `.env` values), debug prints, or anything
|
|
||||||
that does not match the stated intent, **STOP** and tell the user before
|
|
||||||
committing.
|
|
||||||
3. Draft the message following the format in the memory doc, wrapping the body
|
|
||||||
at 80 characters per line, and run:
|
|
||||||
```bash
|
|
||||||
git commit -m "<subject>" -m "<body>"
|
|
||||||
```
|
|
||||||
(or `git commit -F -` if the body has unusual characters).
|
|
||||||
4. **Verify the message with the checker**:
|
|
||||||
```bash
|
|
||||||
./scripts/check-commit
|
|
||||||
```
|
|
||||||
If it fails, amend the message (`git commit --amend`) until it passes. Do
|
|
||||||
not finish with a failing checker.
|
|
||||||
5. The `AI-assisted-by` trailer value is provided by the calling context — use
|
|
||||||
it verbatim.
|
|
||||||
|
|
||||||
## Constraints
|
|
||||||
|
|
||||||
- Do not push. Pushing is a separate workflow handled by the user.
|
|
||||||
- Do not run `git reset`, `git checkout`, `git restore`, `git clean`, or `rm`.
|
|
||||||
- Do not pass `--author`. Author identity comes from the local git config.
|
|
||||||
- Do not amend a commit you did not create in this session, unless explicitly asked.
|
|
||||||
- Do not bypass pre-commit hooks (`--no-verify`) unless explicitly asked.
|
|
||||||
- Add `Co-authored-by:` only for a human co-author. AI providers, agents and
|
|
||||||
bots are rejected by `./scripts/check-commit`; for AI participation use the
|
|
||||||
`AI-assisted-by:` trailer.
|
|
||||||
- Do not add untracked files that were not created in this session.
|
|
||||||
- Do not skip the `scripts/check-commit` verification step (Iron Rule 4).
|
|
||||||
@ -1,31 +0,0 @@
|
|||||||
---
|
|
||||||
name: create-issue
|
|
||||||
description: Create or update GitHub issues (from PR, from draft body, retitle existing). Routes to the canonical flow in `mem:workflow/creating-issues`.
|
|
||||||
slash: true
|
|
||||||
---
|
|
||||||
|
|
||||||
# Skill: create-issue
|
|
||||||
|
|
||||||
Entry point for all GitHub issue work. All rules (title derivation, metadata,
|
|
||||||
body templates, Issue Type IDs), all flows, and all `gh` / GraphQL commands
|
|
||||||
live in `mem:workflow/creating-issues` (file:
|
|
||||||
`.serena/memories/workflow/creating-issues.md`). This skill routes to the
|
|
||||||
right flow.
|
|
||||||
|
|
||||||
## When to Use
|
|
||||||
|
|
||||||
- **Create from PR** — PR exists; the issue is the changelog/release unit,
|
|
||||||
the PR is the implementation. Issue = WHAT, PR = HOW.
|
|
||||||
→ memory section **Creating Issues from PRs**
|
|
||||||
- **Create from draft body** — Taiga story, user report, discussion; no PR
|
|
||||||
yet.
|
|
||||||
→ memory section **Creating Issues from Draft Body**
|
|
||||||
- **Create as sub-issue** — the issue must be grouped under an umbrella/EPIC
|
|
||||||
issue; create it first, then link it to its parent.
|
|
||||||
→ memory section **Adding an Issue as a Sub-issue**
|
|
||||||
- **Retitle existing issue** — current title is vague, prefixed, or stale.
|
|
||||||
→ memory section **Retitling an Existing Issue**
|
|
||||||
|
|
||||||
Everything else (title derivation, metadata policy, body templates, Issue
|
|
||||||
Type IDs, create/verify/cleanup commands) lives in the memory — go to the
|
|
||||||
matching section there.
|
|
||||||
@ -1,133 +0,0 @@
|
|||||||
---
|
|
||||||
name: create-pr
|
|
||||||
description: PR flow — open a new PR for the current task branch (validates base branch, commits, issue and push state) or update an existing PR's title or description to match Penpot conventions. Use it when the user asks to open or create a PR, in any phrasing.
|
|
||||||
---
|
|
||||||
|
|
||||||
# Create PR
|
|
||||||
|
|
||||||
Two modes. **Open mode** takes the current task branch to a new, validated
|
|
||||||
PR. **Update mode** rewrites an existing PR's title or description. Gather
|
|
||||||
information, validate, and act in one pass. If validation fails, STOP with a
|
|
||||||
single coherent message that lists every problem and states exactly what
|
|
||||||
information is missing — never fix or work around problems silently.
|
|
||||||
|
|
||||||
Both modes require an authenticated `gh` CLI (`gh auth status`) and never
|
|
||||||
push — the user pushes from their own shell.
|
|
||||||
|
|
||||||
## When to use
|
|
||||||
|
|
||||||
- The user asks to open or create a NEW PR for the current task branch, in
|
|
||||||
any phrasing ("open a PR", "create the pull request", "put this up for
|
|
||||||
review") — or runs `/create-pr`. → **Open mode**.
|
|
||||||
- The user asks to fix or update an EXISTING PR's title or description to
|
|
||||||
match conventions. → **Update mode**.
|
|
||||||
|
|
||||||
If the running agent cannot write (for example, the plan agent), say so and
|
|
||||||
stop — this skill needs the build agent.
|
|
||||||
|
|
||||||
## Open mode
|
|
||||||
|
|
||||||
### 1. Gather context (read-only)
|
|
||||||
|
|
||||||
- Current branch: `git rev-parse --abbrev-ref HEAD`.
|
|
||||||
- Target base branch: run `./scripts/detect-target-branch` from the repo root.
|
|
||||||
It prints the nearest ancestor branch of HEAD (exit 0) or fails (exit 1).
|
|
||||||
- Commits: `git log --oneline <base>..HEAD`.
|
|
||||||
- Push state (local): `git rev-parse --verify origin/<branch>` and compare
|
|
||||||
with HEAD. It reads the local remote-tracking ref — no network, no SSH. It
|
|
||||||
reflects the last push or fetch this clone knows about.
|
|
||||||
- Issue: from the session context, or from the branch name — `issue-NNNN`
|
|
||||||
maps to issue NNNN; recover its title and body with `gh issue view NNNN`.
|
|
||||||
|
|
||||||
### 2. Validate — stop with one message if anything fails
|
|
||||||
|
|
||||||
Run all checks before reporting, then report every failure together:
|
|
||||||
|
|
||||||
1. **Base branch not usable.** If the script fails (exit 1), or its output —
|
|
||||||
after stripping an optional `remotes/origin/` prefix — is not one of the
|
|
||||||
canonical branches (`develop`, `staging`, `main`), stop and ask the user
|
|
||||||
to re-run with more context — for example, passing the base branch
|
|
||||||
explicitly in their invocation. An explicit base given by the user
|
|
||||||
overrides the script's output.
|
|
||||||
2. **On a base branch.** There is no task branch to merge — say so and stop.
|
|
||||||
3. **No commits.** The branch has no commits ahead of the base — say so and
|
|
||||||
stop.
|
|
||||||
4. **No clear issue.** There is no issue in the session context, and the
|
|
||||||
branch name has no `issue-NNNN` pattern (or `gh issue view` finds nothing)
|
|
||||||
— say so and stop. Exception: the user's invocation says `no issue` /
|
|
||||||
`without issue` — then continue without an issue reference.
|
|
||||||
5. **Branch not pushed.** The remote-tracking ref `origin/<branch>` is
|
|
||||||
missing, or `git rev-parse origin/<branch>` differs from HEAD — the
|
|
||||||
branch was never pushed, or has commits the remote does not have. Never
|
|
||||||
push yourself; ask the user to push and to run `/create-pr` again
|
|
||||||
afterwards, then stop.
|
|
||||||
|
|
||||||
### 3. Already-open PR
|
|
||||||
|
|
||||||
Check whether a PR already exists for this branch (`gh pr list --head
|
|
||||||
<branch>`). If one exists, report its URL and stop — do not create a second
|
|
||||||
one. Title or description fixes belong to Update mode.
|
|
||||||
|
|
||||||
### 4. Write and create the PR
|
|
||||||
|
|
||||||
Write the title and body following `mem:workflow/creating-prs` (title format,
|
|
||||||
description structure, writing principles) and `mem:workflow/creating-commits`
|
|
||||||
(commit type emojis). Derive the title and body from the commits and, when
|
|
||||||
there is one, from the issue body. Include `Closes #NNNN` for readable context,
|
|
||||||
but do not treat it as the link; use `python3 scripts/gh.py link-issue <ISSUE_NUMBER> <PR_NUMBER>` after creating the PR.
|
|
||||||
|
|
||||||
Repeat the `AI-assisted-by:` trailer in the body, once per model that worked
|
|
||||||
on the branch, so the PR states the assistance where a reviewer reads it. The
|
|
||||||
branch commits keep their own trailers, and a squash merge carries every one
|
|
||||||
of them into the landed message.
|
|
||||||
|
|
||||||
Before offering or accepting a draft PR, warn that CI doesn't run on them. Add
|
|
||||||
`--draft` only when the user agrees to that.
|
|
||||||
|
|
||||||
```bash
|
|
||||||
gh pr create --repo penpot/penpot --base "<BASE>" --title "<TITLE>" \
|
|
||||||
--project "Main" --body-file /tmp/pr-body.md
|
|
||||||
```
|
|
||||||
|
|
||||||
`--base` is the branch resolved in step 1: without it the PR opens against the
|
|
||||||
repository default, which is wrong for a branch cut from `staging`. `--project
|
|
||||||
"Main"` is required by `mem:workflow/creating-prs`.
|
|
||||||
|
|
||||||
If an issue is present, run the explicit assignment command from
|
|
||||||
`mem:workflow/creating-prs` before reporting success:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
python3 scripts/gh.py link-issue <ISSUE_NUMBER> <PR_NUMBER>
|
|
||||||
```
|
|
||||||
|
|
||||||
### 5. Report
|
|
||||||
|
|
||||||
Report the PR URL and stop.
|
|
||||||
|
|
||||||
## Update mode
|
|
||||||
|
|
||||||
1. Identify the PR: the number given by the user, or `gh pr list --head
|
|
||||||
<branch>`.
|
|
||||||
2. Write the new title and/or body following `mem:workflow/creating-prs`.
|
|
||||||
3. Apply and verify:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
gh pr edit <NUMBER> --repo penpot/penpot --title "<TITLE>" --body-file /tmp/pr-body.md
|
|
||||||
gh pr view <NUMBER> --repo penpot/penpot --json title,body
|
|
||||||
```
|
|
||||||
|
|
||||||
If the updated body contains `Closes #NNNN`, run the explicit assignment
|
|
||||||
command from `mem:workflow/creating-prs`:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
python3 scripts/gh.py link-issue <ISSUE_NUMBER> <PR_NUMBER>
|
|
||||||
```
|
|
||||||
|
|
||||||
4. Report and stop.
|
|
||||||
|
|
||||||
## User context
|
|
||||||
|
|
||||||
Extra context in the user's invocation (the message that triggered this skill)
|
|
||||||
plays the role command arguments play elsewhere: overrides such as `no issue` /
|
|
||||||
`without issue`, an explicit base branch (`from origin/staging`), a PR number
|
|
||||||
for Update mode, and so on.
|
|
||||||
@ -1,116 +0,0 @@
|
|||||||
---
|
|
||||||
name: find-project-anomalies
|
|
||||||
description: Check a GitHub milestone against the Main project board, report the five anomaly types to tmp/<MILESTONE>-ANOMALIES.md, and fix missing milestone assignments on request.
|
|
||||||
---
|
|
||||||
|
|
||||||
# Skill: find-project-anomalies
|
|
||||||
|
|
||||||
Check every issue and PR in a given GitHub milestone against the Main
|
|
||||||
project board. Report the five anomaly types below, then fix the ones a
|
|
||||||
human confirms.
|
|
||||||
|
|
||||||
## Getting the version ($ARGUMENTS)
|
|
||||||
|
|
||||||
The milestone version comes from the skill arguments (`$ARGUMENTS`), the
|
|
||||||
same way other skills receive theirs. Accept `2.17.0`, `v2.17.0`,
|
|
||||||
`milestone 2.17.0`, or any text clearly containing one `X.Y.Z` version.
|
|
||||||
|
|
||||||
If no version is given and none can be deduced from the arguments or the
|
|
||||||
conversation context, **stop and ask the user** which milestone to check.
|
|
||||||
Do not guess, do not default to the latest release.
|
|
||||||
|
|
||||||
## When to Use
|
|
||||||
|
|
||||||
- Before a release, to catch board/milestone drift while there is still time
|
|
||||||
to fix it
|
|
||||||
- After triage sessions, to verify every milestone item is tracked, owned,
|
|
||||||
and correctly assigned
|
|
||||||
- Whenever someone asks "is milestone X.Y.Z clean on Main?"
|
|
||||||
|
|
||||||
## Prerequisites
|
|
||||||
|
|
||||||
- `gh` CLI authenticated (`gh auth status`)
|
|
||||||
- Python 3.8+
|
|
||||||
- `scripts/gh.py` for GitHub queries, `scripts/project-anomalies.py` for
|
|
||||||
detection and reporting (`python3 scripts/project-anomalies.py check --help`)
|
|
||||||
|
|
||||||
## Workflow
|
|
||||||
|
|
||||||
### 1. Resolve the version (see above), then run the check
|
|
||||||
|
|
||||||
```bash
|
|
||||||
python3 scripts/project-anomalies.py check "2.17.0"
|
|
||||||
# explicit path:
|
|
||||||
python3 scripts/project-anomalies.py check "2.17.0" --output tmp/2.17.0-ANOMALIES.md
|
|
||||||
```
|
|
||||||
|
|
||||||
This fetches milestone issues and PRs in bulk (one GraphQL call per 50
|
|
||||||
items), resolves outsiders the same way, and overwrites
|
|
||||||
`tmp/<MILESTONE>-ANOMALIES.md`. Every number renders as a full
|
|
||||||
`[#N](https://github.com/penpot/penpot/issues/N)` or
|
|
||||||
`[#N](https://github.com/penpot/penpot/pull/N)` link.
|
|
||||||
|
|
||||||
### 2. Read the report and judge each anomaly
|
|
||||||
|
|
||||||
The five types, in report order:
|
|
||||||
|
|
||||||
1. **OPEN issue with a MERGED PR** — the fix landed but the issue never
|
|
||||||
closed (or it reopened). Fix: close the issue, or move it out of the
|
|
||||||
milestone if the fix did not actually land here.
|
|
||||||
2. **Milestone issue, PR elsewhere or issue off Main** — a *merged* closing
|
|
||||||
PR in another milestone (or none), or the issue itself not on the Main
|
|
||||||
board. An unmerged PR's milestone means nothing (it landed nowhere), so
|
|
||||||
it never triggers this type. Fix: align the milestones (see step 3), or
|
|
||||||
add the issue to Main.
|
|
||||||
3. **Milestone PR, issue elsewhere or off Main** — the mirror view over
|
|
||||||
*merged* PRs only: a PR released here closes an issue tracked elsewhere
|
|
||||||
(or nowhere on Main). Unmerged PRs never trigger this type — their
|
|
||||||
milestone means nothing yet. Fix: align the milestones (see step 3), or
|
|
||||||
add the issue to Main.
|
|
||||||
4. **MERGED PR on a `needs triage` issue** — landed without triage. Only a
|
|
||||||
human can triage; never auto-remove the label.
|
|
||||||
5. **MERGED PR on an unassigned, non-community issue** — no owner and no
|
|
||||||
`community contribution` label (checked on both issue and PR). Either
|
|
||||||
assign an owner or confirm it is community work. Never invent an owner.
|
|
||||||
|
|
||||||
Scope notes (deliberate, not bugs):
|
|
||||||
- Project membership is checked **on the issue side only**. PRs are not the
|
|
||||||
unit tracked on Main, so an unprojected PR alone is never an anomaly.
|
|
||||||
- An issue with *no* milestone closed by a milestone PR **is** reported
|
|
||||||
here (type 3): unlike the changelog flow, this pairing always needs a
|
|
||||||
human look.
|
|
||||||
|
|
||||||
### 3. Fix missing milestone assignments (only these, only on confirmation)
|
|
||||||
|
|
||||||
The only mechanical fix in this skill is assigning a missing milestone.
|
|
||||||
The report already prints the exact command next to each such case:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
gh pr edit <PR> --milestone "<MILESTONE>"
|
|
||||||
gh issue edit <ISSUE> --milestone "<MILESTONE>"
|
|
||||||
```
|
|
||||||
|
|
||||||
Rules:
|
|
||||||
- Apply **only** when one side lacks a milestone. When both sides have
|
|
||||||
*different* milestones, a human decides which one moves — never pick a
|
|
||||||
side yourself.
|
|
||||||
- Confirm **each fix (or each small batch)** with the user before running
|
|
||||||
it. Read back what the command will change.
|
|
||||||
- Everything else (closing issues, triaging, assigning owners, adding
|
|
||||||
items to the Main board) is human work: point at it, do not do it.
|
|
||||||
|
|
||||||
### 4. Re-run until clean
|
|
||||||
|
|
||||||
After fixes land, re-run step 1 and confirm the report shows zero
|
|
||||||
anomalies. The `tmp/` report is scratch output (gitignored): quote or
|
|
||||||
paste entries into chat when reporting back, do not commit it.
|
|
||||||
|
|
||||||
## Key Principles
|
|
||||||
|
|
||||||
- **No version, no run.** Stop and ask when the milestone is unknown.
|
|
||||||
- **Report first, touch nothing.** No board or milestone changes without
|
|
||||||
explicit per-item confirmation.
|
|
||||||
- **Milestone gaps auto-fix; judgment calls do not.** Only a missing
|
|
||||||
milestone is mechanical. triage, ownership, and close/reopen decisions
|
|
||||||
belong to humans.
|
|
||||||
- **Every number clickable.** The report is useless without full GitHub links.
|
|
||||||
@ -1,158 +0,0 @@
|
|||||||
---
|
|
||||||
name: implement-plan
|
|
||||||
description: Implementation flow — execute a ready plan from the session context
|
|
||||||
slash: true
|
|
||||||
---
|
|
||||||
|
|
||||||
# Implement Plan
|
|
||||||
|
|
||||||
This flow is run once a plan is ready (for example, from plan mode). Execute
|
|
||||||
the plan already prepared in the current session context. It never pushes —
|
|
||||||
the user pushes.
|
|
||||||
|
|
||||||
By default it ends with exactly one commit. When the user asks for it
|
|
||||||
("step by step"), it commits once per task instead and waits for the
|
|
||||||
user's confirmation after each one (see *Execution modes*).
|
|
||||||
|
|
||||||
## Plan file handling
|
|
||||||
|
|
||||||
Plan files are local workflow artifacts. They must never be staged or
|
|
||||||
committed, even when `.gitignore` already excludes them. Never use
|
|
||||||
`git add -f`, change ignore rules, or otherwise force a plan file into a
|
|
||||||
commit. Close and update the plan when this flow requires it, but leave it
|
|
||||||
in the local working tree.
|
|
||||||
|
|
||||||
## When to use
|
|
||||||
|
|
||||||
- The user asks to implement or execute a plan, in any phrasing:
|
|
||||||
"implement the plan", "execute it", "go build it" — or runs
|
|
||||||
`/implement-plan`.
|
|
||||||
- A ready, reviewed plan is in the session context or a plan file path
|
|
||||||
was given (typically after `/make-a-plan` or `/review-plan`).
|
|
||||||
|
|
||||||
Do not use it to produce plans — that is the `make-a-plan` flow.
|
|
||||||
|
|
||||||
## 1. Read the plan first
|
|
||||||
|
|
||||||
Identify the plan to execute — from the file path the user gave, the
|
|
||||||
arguments, or the session context. Read it completely. Read the required
|
|
||||||
memories before writing any code: `mem:critical-info` and the core memory
|
|
||||||
of every module the plan touches, plus the deeper memories they reference
|
|
||||||
(AGENTS.md governs this).
|
|
||||||
|
|
||||||
## 2. Detect the flow (no questions)
|
|
||||||
|
|
||||||
Inspect the current branch with `git rev-parse --abbrev-ref HEAD`, pick the
|
|
||||||
mode, and announce it in one line before presenting anything. Detection is
|
|
||||||
read-only: nothing is created until the user confirms (step 3).
|
|
||||||
|
|
||||||
- **On a base branch** (`main`, `develop`, `staging`) → **standalone mode**:
|
|
||||||
a new GitHub issue and a branch `issue-NNNN` will be created after the
|
|
||||||
user's confirmation.
|
|
||||||
- **On any other branch** (a feature branch, typically `issue-NNNN`) →
|
|
||||||
**continue mode**: the implementation continues on the current branch.
|
|
||||||
No issue or branch is created. The branch name provides the issue
|
|
||||||
reference when it follows the `issue-NNNN` pattern.
|
|
||||||
|
|
||||||
Arguments override detection: `standalone`, `continue`, `direct`
|
|
||||||
(`no branch` / `direct commit`), `no issue` / `without issue`, or an
|
|
||||||
explicit base such as `from origin/develop`.
|
|
||||||
|
|
||||||
**Direct mode** (`direct`, `no branch`, `direct commit`): no issue and
|
|
||||||
no branch — the implementation and the commit land on the current branch
|
|
||||||
as it is, even when it is a base branch. Best for small or tooling-only
|
|
||||||
changes the user wants committed in place.
|
|
||||||
|
|
||||||
**Standalone while already on a feature branch:** stop and explain that this
|
|
||||||
would stack branches. Ask the user to re-run with an explicit base, for
|
|
||||||
example `from origin/develop` — then branch from that base instead of HEAD.
|
|
||||||
|
|
||||||
## 3. Present the checklist and wait
|
|
||||||
|
|
||||||
Before touching the repository, show the user the full picture:
|
|
||||||
|
|
||||||
- **The flow**: whether the GitHub issue and the branch will be created
|
|
||||||
(standalone mode — give the planned branch name, `issue-NNNN` or
|
|
||||||
`plan-<slug>`), whether you continue on the current branch
|
|
||||||
(continue mode — name it), or whether everything lands on the current
|
|
||||||
branch as it is (direct mode — name it, and say so when it is a base
|
|
||||||
branch).
|
|
||||||
- **The execution style**: batch or step-by-step (see *Execution modes*).
|
|
||||||
- A checklist (todolist) of the plan's tasks, in order.
|
|
||||||
|
|
||||||
Then WAIT for the user's explicit confirmation. Do not start until you
|
|
||||||
have it. If the plan has no discrete tasks, ask the user how to split
|
|
||||||
it, or propose running it as a single change.
|
|
||||||
|
|
||||||
## 4. Execute the plan
|
|
||||||
|
|
||||||
**Standalone setup, after the confirmation:** create the issue with the
|
|
||||||
**`create-issue`** skill, following the *Creating Issues from Draft Body*
|
|
||||||
flow in `mem:workflow/creating-issues`. Derive the issue title and body
|
|
||||||
from the plan, capture the new issue's number — call it **NNNN** — and
|
|
||||||
create the branch from the current HEAD:
|
|
||||||
|
|
||||||
```
|
|
||||||
git checkout -b issue-NNNN
|
|
||||||
```
|
|
||||||
|
|
||||||
If the arguments say `no issue` / `without issue`, skip the issue and
|
|
||||||
create a branch named `plan-<slug>` instead, where `<slug>` is the plan
|
|
||||||
title, lowercase and hyphen-separated.
|
|
||||||
|
|
||||||
If the arguments say `direct` / `no branch` / `direct commit`, skip the
|
|
||||||
issue and the branch: implement and commit on the current branch as it
|
|
||||||
is. If it is a base branch, the checklist presentation already said so —
|
|
||||||
no further confirmation is needed.
|
|
||||||
|
|
||||||
### Batch mode (default)
|
|
||||||
|
|
||||||
Implement every task in one go. Work methodically, keeping changes
|
|
||||||
focused on what the issue requires. Respect the plan's proposed
|
|
||||||
parallelization when it applies.
|
|
||||||
|
|
||||||
When the implementation is complete, close the plan file first: flip its
|
|
||||||
`Status` to `done` and append one UTC ISO 8601 line to its `Review Log`
|
|
||||||
with the issue URL when one exists (standalone mode, e.g.
|
|
||||||
`https://github.com/penpot/penpot/issues/NNNN`); in continue/direct
|
|
||||||
mode with no issue, just `done` with no invented identifier. Never
|
|
||||||
record commit hashes. Leave the closed plan file local and uncommitted.
|
|
||||||
Then load the **`create-commit`** skill and follow its workflow to commit
|
|
||||||
only the implementation, tests, memory, and documentation changes. Before
|
|
||||||
committing, verify that the staged file list does not contain the plan
|
|
||||||
file. Provide a brief summary of what was implemented and why, the issue
|
|
||||||
reference (`issue-NNNN`) when there is one, and the model name you are
|
|
||||||
running as so the `AI-assisted-by` trailer is set correctly.
|
|
||||||
|
|
||||||
### Step-by-step mode (on request)
|
|
||||||
|
|
||||||
When the user asks for it — "step by step", "task by task", "one commit
|
|
||||||
per task" — loop one task at a time:
|
|
||||||
|
|
||||||
- Execute exactly ONE task.
|
|
||||||
- Commit it now: load the **`create-commit`** skill and follow it —
|
|
||||||
one commit per task, never two tasks in one commit. Same inputs as
|
|
||||||
always: what and why, the issue reference, your model name.
|
|
||||||
- After the final task commit, close the plan file (`Status: done`, one
|
|
||||||
`Review Log` line with the issue URL when one exists). Leave it local
|
|
||||||
and uncommitted; never amend the task commit to include it.
|
|
||||||
- Show the user the result (what changed, files touched, how it was
|
|
||||||
verified).
|
|
||||||
- WAIT for the user's confirmation before starting the next task.
|
|
||||||
|
|
||||||
Never batch in this mode: no two tasks in one commit, and no new task
|
|
||||||
before the user confirms. If a task turns out much bigger than planned,
|
|
||||||
stop and ask the user before splitting it.
|
|
||||||
|
|
||||||
## When you are done
|
|
||||||
|
|
||||||
End by suggesting the next steps (suggestions, not a required pipeline — any
|
|
||||||
instruction from me overrides them):
|
|
||||||
|
|
||||||
- `/review-code` — to review the changes just committed; it routes to
|
|
||||||
`/make-a-plan` by itself if the findings need one.
|
|
||||||
- `/create-pr` — when the task is done and the branch is ready to merge.
|
|
||||||
|
|
||||||
## User input, overrides and additional context
|
|
||||||
|
|
||||||
$ARGUMENTS
|
|
||||||
@ -1,109 +0,0 @@
|
|||||||
---
|
|
||||||
name: local-ci
|
|
||||||
description: Run local CI-style checks with ./scripts/ci (lint, tests, format, and on request production builds) per monorepo module. Use when verifying changes before declaring work done, running lint or tests locally, fixing formatting, repairing Clojure delimiter errors, or checking that a module still compiles.
|
|
||||||
---
|
|
||||||
|
|
||||||
# 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` `media-processor`, 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). **build**
|
|
||||||
is opt-in: it compiles the module the way production does and is the slow
|
|
||||||
one, so it never runs unless you ask for it.
|
|
||||||
|
|
||||||
| 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 |
|
|
||||||
| `--build` / `--no-build` | Run only the production build / 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/<module>-<task>.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
|
|
||||||
|
|
||||||
# Check that the module still compiles (slow: minutes)
|
|
||||||
./scripts/ci --build frontend
|
|
||||||
|
|
||||||
# Compile every module (8 builds, ~4 min with warm caches)
|
|
||||||
./scripts/ci --build --all
|
|
||||||
|
|
||||||
# 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` and `media-processor` have no lint task — they show as skipped,
|
|
||||||
not failed. `common` has no build task for the same reason.
|
|
||||||
- Build runs are the slow ones (frontend ~2 min even with warm caches;
|
|
||||||
cold caches roughly double it). Give the shell a generous timeout and
|
|
||||||
do not run two builds at once in the same checkout: `render-wasm` takes
|
|
||||||
a build lock.
|
|
||||||
- `--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`.
|
|
||||||
@ -1,112 +0,0 @@
|
|||||||
---
|
|
||||||
name: make-a-plan
|
|
||||||
description: Planning flow — research the subject of this session, produce an implementation plan with the planner skill, resolve open questions with the user in plain language, and save the final plan to .agents/plans/.
|
|
||||||
slash: true
|
|
||||||
---
|
|
||||||
|
|
||||||
# Make a Plan
|
|
||||||
|
|
||||||
Act as a senior software engineer: research the subject of this session in depth and
|
|
||||||
produce a well-grounded, actionable implementation plan.
|
|
||||||
|
|
||||||
If the running agent cannot write (for example, the plan agent), say so and
|
|
||||||
stop — this skill needs the build agent to save the plan.
|
|
||||||
|
|
||||||
## When to use
|
|
||||||
|
|
||||||
- The user asks to plan, design, or break down a task, in any phrasing:
|
|
||||||
"make a plan", "how would we build X", "design an approach for Y" —
|
|
||||||
or runs `/make-a-plan`.
|
|
||||||
- The user asks to rework or extend an existing plan. While the plan is
|
|
||||||
still unimplemented (pre-`implement-plan` iteration, e.g. after
|
|
||||||
`/review-plan` findings or user feedback), revise the saved plan file
|
|
||||||
in place. Once the plan has been implemented and reviewed (post
|
|
||||||
`/review-code` findings on committed work), write a new derived plan
|
|
||||||
file instead — never rewrite the executed plan. The `planner` skill
|
|
||||||
defines the derived naming (`--review-NN`, `--task-NN`).
|
|
||||||
- The user says to apply `review-plan` findings to a still-unimplemented
|
|
||||||
plan: apply the agreed changes, flip `Status` to `reviewed`, and
|
|
||||||
append one UTC ISO 8601 line to `Review Log` describing what changed.
|
|
||||||
This apply step is the only pre-implementation write to those fields —
|
|
||||||
`review-plan` itself stays read-only and never writes.
|
|
||||||
|
|
||||||
Do not use it to execute a plan — that is the `implement-plan` flow.
|
|
||||||
|
|
||||||
## Instructions
|
|
||||||
|
|
||||||
1. **Produce the plan** with the `planner` skill. By default, research the
|
|
||||||
subject of this session and draft the plan yourself. If I ask for it (for
|
|
||||||
example, `delegated` in the user context), delegate to the `general` subagent
|
|
||||||
instead — the delegate must also follow the `planner` skill and receive all
|
|
||||||
the relevant session context (a review, user feedback, and so on).
|
|
||||||
2. Before asking me to decide anything, explain the plan and every open question in
|
|
||||||
plain language. Assume I know only the high-level project goal, not the codebase,
|
|
||||||
architecture, implementation terms, or the problem this task solves.
|
|
||||||
3. Once all decisions are answered and the plan is final, save it verbatim to the
|
|
||||||
announced path under `.agents/plans/` (create the directory if it does not
|
|
||||||
exist). This step is the flow's explicit authorization to write the plan
|
|
||||||
file — the only write allowed here. A fresh plan uses
|
|
||||||
`.agents/plans/YYYY-MM-DD-<slug>.md` with `Status: draft` and an
|
|
||||||
empty `Review Log`; a derived plan uses the parent
|
|
||||||
basename plus the `planner` suffix (`--review-NN`, `--task-NN`) in its
|
|
||||||
own new file, also starting as `draft`. If I later ask for changes to a still-unimplemented plan,
|
|
||||||
update the saved file directly.
|
|
||||||
4. Present me with a clear, self-contained summary of the plan's most relevant points
|
|
||||||
only after all required decisions have been answered. Write it for someone who knows
|
|
||||||
only the project's high-level goal and may not know the plan's low-level context.
|
|
||||||
Explain necessary technical language in plain terms, include the problem being
|
|
||||||
solved and the proposed outcome, and do not assume that listing technical task names
|
|
||||||
is enough.
|
|
||||||
|
|
||||||
### Hard rule — read-only while planning
|
|
||||||
|
|
||||||
While this flow runs, act read-only: research with read-only tools only.
|
|
||||||
Never edit source files, never run builds, tests, linters, or any command that
|
|
||||||
modifies state, and never commit. The single allowed write is the plan file in
|
|
||||||
step 3. This rule expires when I approve the plan or move on to another task;
|
|
||||||
then you act as a normal build agent again.
|
|
||||||
|
|
||||||
When the plan contains open questions, do not show them as bare technical questions or
|
|
||||||
assume that I understand the technical language or technical words used in the plan.
|
|
||||||
For each question, first explain:
|
|
||||||
|
|
||||||
- What part of the user problem the decision affects.
|
|
||||||
- The relevant concept from the beginning, with a small concrete example.
|
|
||||||
- What each available option would make the system do.
|
|
||||||
- The practical benefits, costs, risks, and user-visible consequences of each option.
|
|
||||||
- Which option the planner recommends and why.
|
|
||||||
|
|
||||||
Only after that explanation, use the `question` tool to ask the decision with clear,
|
|
||||||
non-technical option labels. Put the recommended option first and mark it as
|
|
||||||
`(Recommended)`. Group related questions when their context is shared, but do not ask a
|
|
||||||
question whose meaning has not already been explained.
|
|
||||||
|
|
||||||
If I say that I do not understand a question or its choices, do not treat my previous
|
|
||||||
answer as valid. Explain the concepts again from the high-level project goal, use a more
|
|
||||||
concrete example, explain the implications, and ask the question again with the
|
|
||||||
`question` tool. Repeat this until I can make an informed choice. If one answer creates
|
|
||||||
new design consequences or additional decisions, explain those consequences before
|
|
||||||
asking any new question.
|
|
||||||
|
|
||||||
Distinguish clearly between requirements already fixed by the roadmap or existing
|
|
||||||
architecture and choices that actually require my input. Do not ask me to choose an
|
|
||||||
implementation detail when the plan can resolve it safely without changing the public
|
|
||||||
behavior. If there are no decisions that require my input, say so and present the
|
|
||||||
summary.
|
|
||||||
|
|
||||||
IMPORTANT: **Under no circumstances execute the plan. Wait for the user to review it
|
|
||||||
after all possible questions have been answered.** The final summary must explain the
|
|
||||||
problem being solved, the proposed behavior, the main user-visible workflow, important
|
|
||||||
constraints and risks, what is deliberately out of scope, and the path where the plan
|
|
||||||
is saved. Never assume that a short list of task names is enough context. End
|
|
||||||
the final response by suggesting the next steps, in this order:
|
|
||||||
|
|
||||||
1. `/review-plan` — to get a second opinion on the plan before executing it.
|
|
||||||
2. `/implement-plan` — to execute the plan from the current session context.
|
|
||||||
|
|
||||||
These are suggestions, not a required pipeline — any instruction from me
|
|
||||||
overrides them (for example, asking you to implement the plan directly).
|
|
||||||
|
|
||||||
## User input, overrides and additional context
|
|
||||||
|
|
||||||
$ARGUMENTS
|
|
||||||
@ -1,330 +0,0 @@
|
|||||||
---
|
|
||||||
name: migrate-ds-area
|
|
||||||
description: Migrate one Penpot UI area to the Design System components for one group of the DS migration epic (#12375): buttons and icons (icon-button*, button*, icon*), selects (select*) and later groups. Moves the area's SCSS off the deprecated styles, proves every change with a zero-tolerance visual test, then opens the draft PR and updates the group issue (PRs table row, QA comment). Use when the user asks to migrate an area or module to the DS, continue a DS migration group, or names an area of a group issue.
|
|
||||||
---
|
|
||||||
|
|
||||||
# Skill: migrate-ds-area
|
|
||||||
|
|
||||||
Move one UI area (one `.cljs` + `.scss` pair, or a few related modules)
|
|
||||||
from legacy components and raw HTML to the Design System components,
|
|
||||||
prove with pixels what changed, and ship it as a draft PR that QA can
|
|
||||||
test.
|
|
||||||
|
|
||||||
The epic is #12375. Each control type is a group with its own issue
|
|
||||||
(buttons and icons #12376, selects #12377, radios #12378, …). The group
|
|
||||||
issue holds the plan (order, waiting areas), the changes QA should
|
|
||||||
expect, and the PRs table where people claim areas. Read it first.
|
|
||||||
|
|
||||||
## Input
|
|
||||||
|
|
||||||
- The group issue (e.g. `#12376`) and the area: a module path (e.g.
|
|
||||||
`dashboard/fonts`) or an area named in the group issue.
|
|
||||||
- No area given: take the next unclaimed area in the group issue's plan
|
|
||||||
order, and say which one.
|
|
||||||
|
|
||||||
## Ground rules
|
|
||||||
|
|
||||||
- Never `git push`. The user pushes; then you open the PR.
|
|
||||||
- PRs go to `develop`; branches start from `origin/develop`.
|
|
||||||
- **Stay in the group.** Only the controls of this group change. In the
|
|
||||||
buttons/icons group, selects, radios, numeric/text inputs, checkboxes,
|
|
||||||
menus (`%menu-*`, `%dropdown-*`) and modal structure (`%modal-*`) stay;
|
|
||||||
a checkbox tick or an input label icon stays legacy.
|
|
||||||
- **Accept the DS look.** Do not add CSS to imitate legacy sizes or
|
|
||||||
colors. Do keep positions: icons and labels must not move unless the
|
|
||||||
DS size forces it, and then say so.
|
|
||||||
- No negative margins to compensate; use positive DS spacing or
|
|
||||||
`px2rem()`.
|
|
||||||
- **Gaps in the DS wait.** An area that needs an icon or a feature the
|
|
||||||
DS lacks keeps its legacy control; say so in the PR.
|
|
||||||
- Skip legacy shared components that another group will replace
|
|
||||||
(`context_menu_a11y`, `forms`, `select`, `dropdown`, `radio_buttons`,
|
|
||||||
`search_bar`, `title_bar`, …): they wait for that group's cleanup,
|
|
||||||
where they are updated if still used or deleted if not.
|
|
||||||
- Debug-only UI gets no QA comment and no compare image.
|
|
||||||
|
|
||||||
## Devenv
|
|
||||||
|
|
||||||
Run every test, lint and `pnpm` command inside the workspace container,
|
|
||||||
never on the host (a host `pnpm` relinks `node_modules` and breaks the
|
|
||||||
container's watcher). The container is `penpot-devenv-ws<N>-main`, where
|
|
||||||
`<N>` is the workspace number (`ws0` is the main repo; `wsN` lives in
|
|
||||||
`~/.penpot/penpot_workspaces/wsN`). Write output to a file, then read it:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
C=penpot-devenv-ws1-main # your workspace
|
|
||||||
docker exec -u penpot -w /home/penpot/penpot/frontend $C \
|
|
||||||
bash -lc '<command>' > <scratch>/out.txt 2>&1
|
|
||||||
```
|
|
||||||
|
|
||||||
When the app does not behave as the code says, check the build first:
|
|
||||||
|
|
||||||
- **Stale build after a branch switch** ("is not a function", or a page
|
|
||||||
with empty `stl/css` classes): `touch` the stale `.cljs`/`.scss`, wait
|
|
||||||
for the compiled file under `frontend/resources/public/` to update,
|
|
||||||
hard-reload.
|
|
||||||
- **A whole area unstyled:** a new `.scss` added after the watcher
|
|
||||||
started is missing from `main.css` (grep `main.css` for the module
|
|
||||||
prefix), or `main.css` was written corrupted after many `.scss`
|
|
||||||
changed at once. Touch a `.scss`; if the module is still missing,
|
|
||||||
restart the watcher in the workspace's tmux session (`penpot:0`,
|
|
||||||
`./scripts/watch app`).
|
|
||||||
- **Blank app after switching between `develop` and `staging`:**
|
|
||||||
dependencies differ. Run `pnpm install --frozen-lockfile` in the
|
|
||||||
container and restart the watcher.
|
|
||||||
|
|
||||||
## Workflow
|
|
||||||
|
|
||||||
### 1. Claim the area and branch
|
|
||||||
|
|
||||||
1. Read the group issue: plan, waiting areas, expected changes, PRs table.
|
|
||||||
2. Add a row to the PRs table with no PR number, the user's @login as
|
|
||||||
Owner and the state `Claimed` (`gh issue view/edit <n> --body-file`).
|
|
||||||
Read the body right before editing, and read it again after saving:
|
|
||||||
when two people edit at the same time, GitHub keeps only the last
|
|
||||||
edit, so a row can vanish. Put yours back if it is gone.
|
|
||||||
Skip an area someone else already claimed, unless the claim has had
|
|
||||||
no PR for 7 days and its owner did not answer a comment asking.
|
|
||||||
3. `git switch -c <user>-ds-<group>-<area> origin/develop`.
|
|
||||||
4. Survey the area: every control of the group in the `.cljs`, the
|
|
||||||
legacy icons, the placeholders and mixins the `.scss` uses, the
|
|
||||||
`div`/`span` with `:on-click`.
|
|
||||||
|
|
||||||
### 2. Visual baseline
|
|
||||||
|
|
||||||
Add a `test.describe("<Area> controls", …)` block to the matching spec
|
|
||||||
in `frontend/playwright/ui/visual-specs/` (project `ds`, dark theme).
|
|
||||||
Put it next to the blocks of the same screen, not always at the end of
|
|
||||||
the file: two PRs that both append at the end conflict.
|
|
||||||
|
|
||||||
- Every shot: `toHaveScreenshot({ maxDiffPixelRatio: 0, threshold: 0 })`.
|
|
||||||
- Show every changed control at rest, on hover and open or pressed.
|
|
||||||
Capture the element or the smallest stable container.
|
|
||||||
- Locators must work before and after the change: text, role, testid,
|
|
||||||
`[class*='…']`, or `a.or(b)` when the element type changes (raw
|
|
||||||
`[class*='menu-btn']` before, `getByRole("button", { name: "Options" })`
|
|
||||||
after). Scope `.or()` to the area so it cannot match elsewhere.
|
|
||||||
- Missing data? Add a fixture under `frontend/playwright/data/` and mock
|
|
||||||
it (`dashboardPage.mockRPC(...)`, `DashboardPage.mockConfigFlags` for
|
|
||||||
flags). Watch for expired or inconsistent fixtures (dates in the past,
|
|
||||||
wrong file for a mock).
|
|
||||||
- Capture with `--update-snapshots=all`:
|
|
||||||
```bash
|
|
||||||
npx playwright test --project=ds <spec> -g "<describe>" --update-snapshots=all
|
|
||||||
```
|
|
||||||
Plain `--update-snapshots` keeps a snapshot within the project's 0.5%
|
|
||||||
tolerance, so a real diff looks like 0.
|
|
||||||
- Copy the snapshots (`<spec>.spec.js-snapshots/<Describe>-*`) to
|
|
||||||
`<scratch>/diffs/<area>/before/` and look at them: the state you
|
|
||||||
wanted must really be on screen.
|
|
||||||
|
|
||||||
### 3. Controls commit
|
|
||||||
|
|
||||||
#### Buttons and icons
|
|
||||||
|
|
||||||
| Legacy | DS |
|
|
||||||
|---|---|
|
|
||||||
| icon-only raw button | `[:> icon-button* {:variant "ghost" :aria-label (tr …) :icon i/x :on-click f}]` (always pass `:variant`; `"action"` for 24px icon toggles) |
|
|
||||||
| pressed/selected | `:aria-pressed (boolean x)` |
|
|
||||||
| text button | `[:> button* {:variant "primary"/"secondary"/"ghost"/"destructive" :type "button"} label]` |
|
|
||||||
| `[:input {:type "button"}]` | `button*` |
|
|
||||||
| modal close | `icon-button*` ghost, `:aria-label (tr "labels.close")`, `:tooltip-class` carrying the corner position |
|
|
||||||
| legacy icon outside a button | `[:> icon* {:icon-id i/x :class …}]` |
|
|
||||||
|
|
||||||
- Not every raw button changes: rows, tabs, swatches, avatar widgets,
|
|
||||||
full-height segments, round custom buttons and link-style text buttons
|
|
||||||
stay raw (their legacy icon still changes). List the kept ones in the
|
|
||||||
PR.
|
|
||||||
- A `div`/`span` with `:on-click` in the area becomes a `[:button]`
|
|
||||||
(with `aria-expanded`/`aria-haspopup` when it opens something). An
|
|
||||||
`[:a]` without `href` stays; list it in the PR.
|
|
||||||
- **Tooltip wrapper.** `icon-button*` renders inside a tooltip trigger
|
|
||||||
wrapper. Position (`position: absolute`, grid placement, margins
|
|
||||||
against siblings) goes on `:tooltip-class`; look (`--button-height`,
|
|
||||||
colors) goes on `:class`.
|
|
||||||
- **Tooltip at the right edge.** Small icon buttons at the right end of
|
|
||||||
a sidebar row or title bar get `:tooltip-placement "top-left"`; list
|
|
||||||
it as an expected change.
|
|
||||||
- **Sizes through custom properties:** `--button-height: #{px2rem(64)}` /
|
|
||||||
`--button-width`. Sass does not evaluate functions inside custom
|
|
||||||
properties without `#{}`.
|
|
||||||
- **A grown `button*` keeps its label at the start**: add
|
|
||||||
`justify-content: center` when it is wider than its content.
|
|
||||||
- **Icon colors:** DS icons use `stroke: currentColor`. Set `color` on
|
|
||||||
the icon class, not `stroke`/`fill`. A legacy `color: transparent` left
|
|
||||||
on the button or wrapper makes the DS icon invisible: drop it. A class
|
|
||||||
that redefines the color variable on the icon breaks the hover that
|
|
||||||
changes it on the button: define the variable on the button.
|
|
||||||
- **Every DS icon needs a color of its own** (on its class or a parent):
|
|
||||||
one that inherits none shows in the devenv debug yellow.
|
|
||||||
- **Icon sizes:** `"s"` draws 12px inside a 16px box (compensate the
|
|
||||||
margin by 2px per side to keep the drawing in place); `"m"` 16px; `"l"`
|
|
||||||
24px; `"xl"` 32px.
|
|
||||||
- **Stroke width:** DS icons keep the DS stroke width. Never set
|
|
||||||
`stroke-width` on a DS icon to match the legacy one; a thinner or
|
|
||||||
thicker line is part of the DS look.
|
|
||||||
- **Legacy placeholders that style `svg` descendants** (e.g.
|
|
||||||
`%dropdown-element-base` → `span svg { 12px box; stroke }`) override a
|
|
||||||
DS icon placed inside them: give the icon class its own box
|
|
||||||
(`inline-size`/`block-size` 16px) and `stroke: currentcolor` with more
|
|
||||||
specificity.
|
|
||||||
- **Flex shrink:** a DS svg inside a small flex button can shrink and be
|
|
||||||
cut; add `flex-shrink: 0` to the icon class.
|
|
||||||
- **Rotated legacy arrows:** prefer `i/arrow-left`/`-right`/`-up`/`-down`
|
|
||||||
over rotating `i/arrow` (same path), unless a rotation class drives the
|
|
||||||
open/closed state.
|
|
||||||
- **Menus anchored by the button size** move when the button grows; open
|
|
||||||
them from the top (`inset-block-start: calc(100% + var(--sp-xs))`) or
|
|
||||||
fix the context menu offset, and say so.
|
|
||||||
|
|
||||||
#### Selects
|
|
||||||
|
|
||||||
`[:& select {:default-value v :options [{:value :label}] :on-change f}]`
|
|
||||||
→ `[:> select* {:default-selected <id> :options <memoized vector of {:id :label}> :on-change f}]`
|
|
||||||
(`app.main.ui.ds.controls.select`).
|
|
||||||
|
|
||||||
- **Ids are non-blank strings.** A blank id shows a dimmed "--", and an
|
|
||||||
id that matches no option falls back to the first one. Give mixed,
|
|
||||||
none and auto their own ids (`"multiple"`, `"none"`, `"auto"`) and map
|
|
||||||
them back in the handler. Use `""` only where "--" is the wanted look.
|
|
||||||
- **Convert the value.** The legacy select ran `d/read-string`, so
|
|
||||||
handlers got keywords, numbers or uuids; `select*` passes the `:id`
|
|
||||||
string. Convert with `keyword`, `d/parse-integer` or `uuid/parse`.
|
|
||||||
- **Memoized options, live selection.** `select*` resets its selection
|
|
||||||
when `:default-selected` or the `:options` identity changes. Build
|
|
||||||
options with `mf/with-memo` and `mapv` (the schema wants a non-empty
|
|
||||||
vector) and pass `:default-selected` from the live value, never a
|
|
||||||
constant.
|
|
||||||
- **Never pass nil.** In dev builds a present prop with value nil
|
|
||||||
(`:class`, `:wrapper-class`, `:disabled`, `:default-selected`) throws
|
|
||||||
`invalid props on component select*`. Use `(boolean x)`, `d/nilv`, or
|
|
||||||
add the prop only when it has a value.
|
|
||||||
- **Props the legacy select ignored stay out**: `select*` passes rest
|
|
||||||
props to its button, so they would reach the DOM.
|
|
||||||
- **Classes:** `:wrapper-class` for layout, `:class` for look.
|
|
||||||
- **Portal:** add `:has-portal true` only where the visual test shows the
|
|
||||||
list cut at the bottom of a panel, and say so in the QA comment.
|
|
||||||
- **Locators:** the button is a `combobox` with no accessible name; use
|
|
||||||
`getByRole("combobox").filter({ hasText: "Linear" })` (it matches the
|
|
||||||
legacy select too) and `getByRole("option", { name: … })`.
|
|
||||||
- **Keyboard:** the arrows no longer change the value while the list is
|
|
||||||
closed. It is an expected change, already listed in #12377.
|
|
||||||
|
|
||||||
#### All groups
|
|
||||||
|
|
||||||
- New labels: add the key to `en.po` and `es.po` by hand, in sorted
|
|
||||||
position, with a `#:` reference to the cljs line. Never run the
|
|
||||||
translations sync.
|
|
||||||
- The `.scss` only gets what the new controls need in this commit.
|
|
||||||
- Some e2e specs are not Prettier-clean on develop: never run
|
|
||||||
`prettier --write` on a whole spec; format only your block.
|
|
||||||
|
|
||||||
Then wait for the watcher (grep the compiled JS/CSS under
|
|
||||||
`frontend/resources/public/` for the change), recapture with `=all`,
|
|
||||||
copy to `after/`, diff:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
SK=.agents/skills/migrate-ds-area/scripts
|
|
||||||
python3 -I $SK/diff.py <before> <after> # per-file pixel count + bbox
|
|
||||||
python3 -I $SK/trip.py <b> <a> <out.png> <scale> # before | after | red diff
|
|
||||||
```
|
|
||||||
|
|
||||||
`trip.py` pads images of different sizes, so a taller "after" still
|
|
||||||
renders.
|
|
||||||
Explain every diff. Fix what is not a DS-look change (moved icons, cut
|
|
||||||
icons, lost hover color). Rerun a shot that changes on unchanged code
|
|
||||||
before trusting it; flaky spots seen so far: the invite modal textarea
|
|
||||||
border, the search input caret, the user account page, the path handler
|
|
||||||
menu trigger.
|
|
||||||
|
|
||||||
Lint, then commit (read `mem:workflow/creating-commits` first):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
npx prettier --check <spec> <fixtures>; npx stylelint <scss>; clj-kondo --lint <cljs>; cljfmt check <cljs>
|
|
||||||
git add -f <cljs> <scss> <po> <spec> <fixtures> # -f: visual-specs/ is gitignored
|
|
||||||
./scripts/check-commit
|
|
||||||
```
|
|
||||||
|
|
||||||
A plain `git add` with an ignored path in the list adds nothing; always
|
|
||||||
`-f`, and check `git show --stat`. Never commit the screenshots.
|
|
||||||
Subject: `:recycle: Use DS <controls> in <area>`. A pre-existing bug
|
|
||||||
found and fixed on the way goes in its own `:bug:` commit.
|
|
||||||
|
|
||||||
### 4. SCSS commit
|
|
||||||
|
|
||||||
Run the `refactor-scss` skill on every `.scss` the PR touched (only
|
|
||||||
those), in its own commit. Keep `refactor/` only for component-family
|
|
||||||
placeholders (`%modal-*`, `%menu-*`, `%input-*`, `%checkbox-*`) and say
|
|
||||||
why in a comment above the `@use`. Unused selectors are deleted, not
|
|
||||||
commented out (list them in the commit body). Typography without an
|
|
||||||
exact match uses the closest DS typography. Run the skill's
|
|
||||||
**Self-review** before committing: no bare element selectors (add
|
|
||||||
classes in the `.cljs`), no copied properties that do nothing, z-index
|
|
||||||
tokens by purpose. Compare against the controls commit: it should be
|
|
||||||
0 px; explain anything else (typically a typography or border change).
|
|
||||||
For files that several modules share or that are huge, stop and propose
|
|
||||||
a separate PR instead.
|
|
||||||
|
|
||||||
### 5. Hand off, PR and tracking
|
|
||||||
|
|
||||||
1. Report to the user: commits, visible changes, kept raw controls,
|
|
||||||
pre-existing bugs, and the compare image path
|
|
||||||
(`<scratch>/diffs/<area>/compare.png`, before | after | diff). Give
|
|
||||||
the push command: `git push -u origin <branch>` (the branch tracks
|
|
||||||
`origin/develop`, so a bare `git push` is refused).
|
|
||||||
2. After the user pushes, check `git rev-parse HEAD origin/<branch>`,
|
|
||||||
then (read `mem:workflow/creating-prs` first):
|
|
||||||
```bash
|
|
||||||
gh pr create --repo penpot/penpot --draft --base develop --head <branch> \
|
|
||||||
--title "<commit subject>" --body-file <body> \
|
|
||||||
--label "WG adoption" --label "no issue required" \
|
|
||||||
--milestone <group issue milestone> --project Main
|
|
||||||
gh pr edit <n> --repo penpot/penpot --remove-label "needs triage"
|
|
||||||
```
|
|
||||||
Never add `no changelog` to a PR: that label goes on issues.
|
|
||||||
Body: AI note, `Part of #<group> (DS migration epic #12375).`, a
|
|
||||||
short What / How, the kept raw controls, an empty `## Screenshots`
|
|
||||||
when something is visible (the user attaches the image). Never
|
|
||||||
`Closes #<group>`. Keep it short: reviewers find long PRs hard to read.
|
|
||||||
3. In the group issue's PRs table, fill your row:
|
|
||||||
`| #<n> | <area>: <controls> (<visible changes>) | @<owner> | Draft |`.
|
|
||||||
4. Post a QA comment on the group issue: `**#<n>: <area>**`, *Where* (how
|
|
||||||
to reach it), *Expected changes* (every visible change; QA treats
|
|
||||||
anything not listed as a bug), *No other change* (what still works
|
|
||||||
the same).
|
|
||||||
|
|
||||||
Do not mark the draft ready or ask for review: the user decides when.
|
|
||||||
|
|
||||||
### 6. Review fixes
|
|
||||||
|
|
||||||
When the reviewer comments on a PR:
|
|
||||||
|
|
||||||
1. Fix each comment in a new commit on the branch (never amend pushed
|
|
||||||
commits). A comment you do not apply gets a short reason the user can
|
|
||||||
post, with an image when it is visual.
|
|
||||||
2. Rerun the area's visual spec before and after the fix with `=all`.
|
|
||||||
Build a compare image for every visible change and give the user its
|
|
||||||
full path, saying which PR it goes to.
|
|
||||||
3. Update everything the fix makes stale, in the same turn: the QA
|
|
||||||
comment (*Expected changes* must list the new visible changes), the
|
|
||||||
PRs table row, and the PR body.
|
|
||||||
4. When working on several PRs in one go, report per PR: branch, new
|
|
||||||
commit, what changed, image path. Never mix two branches in one list.
|
|
||||||
5. Give the push command per branch. If a rebase is coming soon, say
|
|
||||||
that pushing now costs one extra CI run; the user decides.
|
|
||||||
6. After a round of review fixes, check whether the same issue exists in
|
|
||||||
the user's other open PRs of the group, and fix it there too.
|
|
||||||
|
|
||||||
### 7. After merges
|
|
||||||
|
|
||||||
Whenever PRs merge (or go from draft to ready), sync the state column of
|
|
||||||
the group's PRs table with GitHub for **every** row, not only your own:
|
|
||||||
read each row's PR (`gh pr view <n> --json state,isDraft`) and set
|
|
||||||
Merged / In review / Draft. The table drifts when other people merge.
|
|
||||||
|
|
||||||
## Output
|
|
||||||
|
|
||||||
- Branch with 2 commits (controls, SCSS) plus any `:bug:` commit.
|
|
||||||
- Visual spec block with zero-tolerance shots.
|
|
||||||
- Compare image in the scratch folder.
|
|
||||||
- After the push: draft PR, row and QA comment in the group issue.
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
"""Pixel diff of two folders of PNG snapshots with the same file names.
|
|
||||||
|
|
||||||
Usage: python3 -I diff.py <before-dir> <after-dir>
|
|
||||||
Prints, per file, the number of differing pixels and their bounding box,
|
|
||||||
or the two sizes when they differ.
|
|
||||||
"""
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
from PIL import Image, ImageChops
|
|
||||||
|
|
||||||
before, after = sys.argv[1], sys.argv[2]
|
|
||||||
for name in sorted(os.listdir(before)):
|
|
||||||
other = os.path.join(after, name)
|
|
||||||
if not os.path.exists(other):
|
|
||||||
print(name, "missing in", after)
|
|
||||||
continue
|
|
||||||
a = Image.open(os.path.join(before, name)).convert("RGB")
|
|
||||||
b = Image.open(other).convert("RGB")
|
|
||||||
if a.size != b.size:
|
|
||||||
print(name, "size", a.size, b.size)
|
|
||||||
continue
|
|
||||||
diff = ImageChops.difference(a, b)
|
|
||||||
count = sum(1 for p in diff.getdata() if p != (0, 0, 0))
|
|
||||||
print(name, count, diff.getbbox())
|
|
||||||
@ -1,33 +0,0 @@
|
|||||||
"""Before | after | red diff image, one row per snapshot.
|
|
||||||
|
|
||||||
Usage: python3 -I trip.py <before-dir> <after-dir> <out.png> <scale>
|
|
||||||
Both folders hold PNGs with the same names (crop them first if needed).
|
|
||||||
"""
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
|
|
||||||
from PIL import Image, ImageChops
|
|
||||||
|
|
||||||
before, after, out, scale = sys.argv[1], sys.argv[2], sys.argv[3], int(sys.argv[4])
|
|
||||||
rows = []
|
|
||||||
for name in sorted(os.listdir(before)):
|
|
||||||
a = Image.open(os.path.join(before, name)).convert("RGB")
|
|
||||||
b = Image.open(os.path.join(after, name)).convert("RGB")
|
|
||||||
w, h = max(a.width, b.width), max(a.height, b.height)
|
|
||||||
pad_a = Image.new("RGB", (w, h), (200, 200, 200)); pad_a.paste(a, (0, 0))
|
|
||||||
pad_b = Image.new("RGB", (w, h), (200, 200, 200)); pad_b.paste(b, (0, 0))
|
|
||||||
mask = ImageChops.difference(pad_a, pad_b).convert("L").point(lambda v: 255 if v else 0)
|
|
||||||
red = Image.new("RGB", (w, h), (255, 255, 255))
|
|
||||||
red.paste((255, 0, 0), mask=mask)
|
|
||||||
row = Image.new("RGB", (w * 3 + 20, h), (200, 200, 200))
|
|
||||||
for i, im in enumerate([pad_a, pad_b, red]):
|
|
||||||
row.paste(im, (i * (w + 10), 0))
|
|
||||||
rows.append(row.resize((row.width * scale, row.height * scale), Image.NEAREST))
|
|
||||||
width = max(r.width for r in rows)
|
|
||||||
height = sum(r.height + 10 for r in rows)
|
|
||||||
canvas = Image.new("RGB", (width, height), (255, 255, 255))
|
|
||||||
y = 0
|
|
||||||
for r in rows:
|
|
||||||
canvas.paste(r, (0, y))
|
|
||||||
y += r.height + 10
|
|
||||||
canvas.save(out)
|
|
||||||
@ -1,43 +0,0 @@
|
|||||||
---
|
|
||||||
name: nrepl-eval
|
|
||||||
description: Evaluate Clojure code via nREPL using the standalone scripts/nrepl-eval.mjs CLI tool.
|
|
||||||
---
|
|
||||||
|
|
||||||
# nREPL Eval
|
|
||||||
|
|
||||||
Evaluate Clojure (or ClojureScript) code via a running nREPL server using
|
|
||||||
`scripts/nrepl-eval.mjs`.
|
|
||||||
|
|
||||||
Full documentation: `mem:scripts/nrepl-eval` (file: `.serena/memories/scripts/nrepl-eval.md`)
|
|
||||||
|
|
||||||
## When to use
|
|
||||||
|
|
||||||
- Evaluating Clojure or ClojureScript code against the running nREPL
|
|
||||||
sessions (backend 6064, frontend 3447) — live inspection, patching, or
|
|
||||||
debugging.
|
|
||||||
|
|
||||||
## Quick Reference
|
|
||||||
|
|
||||||
```bash
|
|
||||||
./scripts/nrepl-eval.mjs [options] [<code>]
|
|
||||||
```
|
|
||||||
|
|
||||||
| Flag | Description | Default |
|
|
||||||
|------|-------------|---------|
|
|
||||||
| `--backend` | Connect to backend nREPL (port 6064) | — |
|
|
||||||
| `--frontend` | Connect to frontend nREPL (port 3447) | — |
|
|
||||||
| `-p, --port PORT` | nREPL server port | `6064` |
|
|
||||||
| `-H, --host HOST` | nREPL server host | `127.0.0.1` |
|
|
||||||
| `-t, --timeout MS` | Timeout in milliseconds | `120000` |
|
|
||||||
| `--reset-session` | Discard stored session and start fresh | — |
|
|
||||||
| `-e, --last-error` | Evaluate `*e` to retrieve the last exception | — |
|
|
||||||
| `-h, --help` | Show help message | — |
|
|
||||||
|
|
||||||
## Examples
|
|
||||||
|
|
||||||
```bash
|
|
||||||
./scripts/nrepl-eval.mjs '(+ 1 2 3)'
|
|
||||||
./scripts/nrepl-eval.mjs --backend '(+ 1 2 3)'
|
|
||||||
./scripts/nrepl-eval.mjs --frontend '(js/alert "hi")'
|
|
||||||
./scripts/nrepl-eval.mjs -e
|
|
||||||
```
|
|
||||||
@ -1,315 +0,0 @@
|
|||||||
---
|
|
||||||
name: plan-review-criteria
|
|
||||||
description: Plan review criteria — the six review axes, severity rubric, approval standard, and output format for reviewing implementation plans. Loaded by the reviewer subagent of the review-plan flow. Not a user-facing flow — to review a plan, use the review-plan flow.
|
|
||||||
---
|
|
||||||
|
|
||||||
# Plan Review Criteria
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
|
|
||||||
Multi-dimensional plan review with quality gates. Every plan gets reviewed before implementation starts — no exceptions. Review covers six axes: completeness, task quality, architecture & sequencing, risk coverage, actionability, and proposed code quality.
|
|
||||||
|
|
||||||
**The approval standard:** Approve a plan when it is specific enough that a skilled implementer could execute it without guessing, the task ordering is sound, and risks are acknowledged. Perfect plans don't exist — the goal is confidence that implementation won't derail. Don't block a plan because it isn't exactly how you would have structured it. If it's executable and well-organized, approve it.
|
|
||||||
|
|
||||||
## When to Use
|
|
||||||
|
|
||||||
- The reviewer subagent of the `review-plan` flow loads this skill to perform
|
|
||||||
the review of a plan.
|
|
||||||
- To review a plan, always go through the `review-plan` flow — never load this
|
|
||||||
skill directly for that. This is the criteria reference, not the flow.
|
|
||||||
|
|
||||||
**Do NOT use for:** Single-file changes with obvious scope, or when the task is trivial enough to just do.
|
|
||||||
|
|
||||||
## The Six-Axis Review
|
|
||||||
|
|
||||||
Every plan gets evaluated across these dimensions:
|
|
||||||
|
|
||||||
### 1. Completeness
|
|
||||||
|
|
||||||
Does the plan cover everything needed to implement successfully?
|
|
||||||
|
|
||||||
- Is the **context** clear? (What problem, why now, what's the goal?)
|
|
||||||
- Are **affected modules** identified with paths?
|
|
||||||
- Are **architecture decisions** documented with rationale?
|
|
||||||
- Is there a **testing strategy**?
|
|
||||||
- Are **verification commands** explicit (not "run the tests")?
|
|
||||||
- Are **open questions** listed (not buried in someone's head)?
|
|
||||||
- Is there a **parallelization** assessment for multi-task plans?
|
|
||||||
|
|
||||||
**Missing any of these is a gap, not a nit.**
|
|
||||||
|
|
||||||
### 2. Task Quality
|
|
||||||
|
|
||||||
Are the tasks well-defined and independently executable?
|
|
||||||
|
|
||||||
- Does every task have **acceptance criteria**? (Testable, not vague)
|
|
||||||
- Does every task have **verification steps**?
|
|
||||||
- Are tasks **sized appropriately**? (XS–M is ideal, L is acceptable, XL must be split)
|
|
||||||
- Are **dependencies** between tasks explicitly stated?
|
|
||||||
- Are **files likely touched** listed?
|
|
||||||
- Is each task a **single, self-contained change**? (Not "implement the whole feature")
|
|
||||||
- Could a skilled implementer pick up any task and execute it without asking clarifying questions?
|
|
||||||
|
|
||||||
### 3. Architecture & Sequencing
|
|
||||||
|
|
||||||
Is the plan structured so implementation flows correctly?
|
|
||||||
|
|
||||||
- Does implementation order follow the **dependency graph** (foundations first)?
|
|
||||||
- Are tasks **vertically sliced** (feature paths) rather than horizontally layered?
|
|
||||||
- Does each task leave the system in a **working state**?
|
|
||||||
- Are there **checkpoints** between major phases?
|
|
||||||
- Are **high-risk tasks early** (fail fast)?
|
|
||||||
- Is the total plan a reasonable number of tasks? (More than ~15 tasks suggests the scope should be split into multiple plans)
|
|
||||||
|
|
||||||
### 4. Risk Coverage
|
|
||||||
|
|
||||||
Are the hard parts acknowledged and mitigated?
|
|
||||||
|
|
||||||
- Are **edge cases** identified?
|
|
||||||
- Are **breaking changes** or **migration concerns** noted?
|
|
||||||
- Are **security implications** considered?
|
|
||||||
- Are **performance implications** considered?
|
|
||||||
- Are **external dependencies** or integration risks flagged?
|
|
||||||
- Is there a plan for **rollback** if something goes wrong?
|
|
||||||
- Are **data integrity** risks addressed (what happens if a migration fails mid-way)?
|
|
||||||
|
|
||||||
### 5. Actionability
|
|
||||||
|
|
||||||
Can an implementer actually execute this?
|
|
||||||
|
|
||||||
- Are **file paths** specific (not "update the relevant files")?
|
|
||||||
- Are **function/method names** mentioned where applicable?
|
|
||||||
- Are **verification commands** copy-pasteable (not "run the linter")?
|
|
||||||
- Are **test commands** project-specific (not generic)?
|
|
||||||
- Is the **code shape** described where the implementation isn't obvious?
|
|
||||||
- Are **conventions** referenced (naming, patterns, existing utilities to reuse)?
|
|
||||||
- Does the plan reference **existing code** the implementer should read first?
|
|
||||||
|
|
||||||
### 6. Proposed Code Quality *(when the plan includes implementation details)*
|
|
||||||
|
|
||||||
If the plan proposes code shapes, function signatures, data structures, or API designs, evaluate those proposals against `code-review-criteria`:
|
|
||||||
|
|
||||||
- **Correctness:** Do the proposed types/signatures handle edge cases (null, empty, boundaries)?
|
|
||||||
- **Readability:** Are proposed names descriptive and consistent with project conventions?
|
|
||||||
- **Architecture:** Do proposed abstractions follow existing patterns? Are they justified (not over-engineered)?
|
|
||||||
- **Security:** Do proposed APIs validate input at boundaries? Any injection/XSS vectors in the design?
|
|
||||||
- **Performance:** Do proposed data structures avoid N+1 patterns? Any unbounded operations in the design?
|
|
||||||
|
|
||||||
**When to apply:** Only when the plan includes specific code snippets, type definitions, API contracts, or function signatures. Plans that only describe "what" without showing "how" skip this axis.
|
|
||||||
|
|
||||||
## Structural Remedies
|
|
||||||
|
|
||||||
When you flag a structural problem in a plan, propose the fix — not just the problem:
|
|
||||||
|
|
||||||
- **A task is too large (XL):** Split it into vertical slices. Each slice should be independently testable.
|
|
||||||
- **Missing acceptance criteria:** Draft 2–3 specific, testable conditions for the task.
|
|
||||||
- **Wrong sequencing:** Identify the dependency and propose the correct order.
|
|
||||||
- **No checkpoints:** Suggest where checkpoints should go (typically after every 2–3 tasks).
|
|
||||||
- **Vague verification:** Replace "run tests" with the actual project command.
|
|
||||||
- **Horizontal slicing:** Restructure into vertical feature paths.
|
|
||||||
- **Missing risk section:** Draft the risks you can identify from the plan content.
|
|
||||||
|
|
||||||
Prefer the remedy that makes the plan immediately actionable over one that just flags the gap.
|
|
||||||
|
|
||||||
## Plan Sizing
|
|
||||||
|
|
||||||
Plans should be scoped to a single deliverable:
|
|
||||||
|
|
||||||
```
|
|
||||||
1–5 tasks → Good. A focused feature or bug fix.
|
|
||||||
6–10 tasks → Acceptable for a moderate feature.
|
|
||||||
11–15 tasks → Large. Consider splitting into phases.
|
|
||||||
15+ tasks → Too large. Split into multiple plans.
|
|
||||||
```
|
|
||||||
|
|
||||||
**What counts as "one plan":** A self-contained set of changes that delivers a single coherent capability. If you can describe the goal in one sentence, it's one plan.
|
|
||||||
|
|
||||||
## Categorize Findings
|
|
||||||
|
|
||||||
Label every comment with its severity so the author knows what's required vs optional:
|
|
||||||
|
|
||||||
| Prefix | Meaning | Author Action |
|
|
||||||
|--------|---------|---------------|
|
|
||||||
| *(no prefix)* | Required change | Must address before implementation starts |
|
|
||||||
| **Critical:** | Blocks implementation | Missing security consideration, data integrity risk, fundamentally wrong approach |
|
|
||||||
| **Nit:** | Minor, optional | Author may ignore — wording, formatting |
|
|
||||||
| **Optional:** / **Consider:** | Suggestion | Worth considering but not required |
|
|
||||||
| **FYI** | Informational only | No action needed — context for future reference |
|
|
||||||
|
|
||||||
**Lead with what matters.** Order findings by leverage: missing risks and wrong sequencing first, then task quality gaps, then completeness, then nits. If you have one critical sequencing problem and ten nits, the sequencing problem *is* the review.
|
|
||||||
|
|
||||||
## Review Process
|
|
||||||
|
|
||||||
### Step 1: Understand the Goal
|
|
||||||
|
|
||||||
Before evaluating structure, understand intent:
|
|
||||||
|
|
||||||
```
|
|
||||||
- What is this plan trying to accomplish?
|
|
||||||
- What problem does it solve?
|
|
||||||
- What does "done" look like?
|
|
||||||
```
|
|
||||||
|
|
||||||
### Step 2: Check Completeness First
|
|
||||||
|
|
||||||
Scan for missing sections before diving into content:
|
|
||||||
|
|
||||||
```
|
|
||||||
- Context present?
|
|
||||||
- Affected modules listed?
|
|
||||||
- Architecture decisions documented?
|
|
||||||
- Risks acknowledged?
|
|
||||||
- Testing strategy defined?
|
|
||||||
- Verification commands explicit?
|
|
||||||
```
|
|
||||||
|
|
||||||
### Step 3: Review Task Quality
|
|
||||||
|
|
||||||
Walk through each task:
|
|
||||||
|
|
||||||
```
|
|
||||||
For each task:
|
|
||||||
1. Can I tell exactly what to build?
|
|
||||||
2. Are acceptance criteria specific and testable?
|
|
||||||
3. Is the size reasonable (not XL)?
|
|
||||||
4. Are dependencies clear?
|
|
||||||
5. Would I know which files to touch?
|
|
||||||
```
|
|
||||||
|
|
||||||
### Step 4: Validate Sequencing
|
|
||||||
|
|
||||||
Check the dependency graph:
|
|
||||||
|
|
||||||
```
|
|
||||||
- Are foundations built first?
|
|
||||||
- Does each task leave the system working?
|
|
||||||
- Are checkpoints placed correctly?
|
|
||||||
- Are high-risk items early?
|
|
||||||
- Is it vertically sliced?
|
|
||||||
```
|
|
||||||
|
|
||||||
### Step 5: Assess Actionability
|
|
||||||
|
|
||||||
Put yourself in the implementer's shoes:
|
|
||||||
|
|
||||||
```
|
|
||||||
- Could I pick up task 1 and start coding without asking any questions?
|
|
||||||
- Are the verification commands copy-pasteable?
|
|
||||||
- Are file paths and function names specific?
|
|
||||||
- Is existing code referenced where I'd need to read it?
|
|
||||||
```
|
|
||||||
|
|
||||||
### Step 6: Verify the Verification Story
|
|
||||||
|
|
||||||
Check that the plan can actually confirm it worked:
|
|
||||||
|
|
||||||
```
|
|
||||||
- What tests should pass after implementation?
|
|
||||||
- What build/compile commands are relevant?
|
|
||||||
- What manual checks are needed?
|
|
||||||
- How do we know the feature works end-to-end?
|
|
||||||
```
|
|
||||||
|
|
||||||
### Step 7: Evaluate Proposed Code Quality *(if applicable)*
|
|
||||||
|
|
||||||
If the plan includes code snippets, types, or API designs:
|
|
||||||
|
|
||||||
```
|
|
||||||
- Load code-review-criteria skill for criteria
|
|
||||||
- Check proposed signatures for edge cases
|
|
||||||
- Verify naming follows project conventions
|
|
||||||
- Confirm abstractions follow existing patterns
|
|
||||||
- Scan for security vectors in proposed APIs
|
|
||||||
- Check for performance issues in proposed data structures
|
|
||||||
```
|
|
||||||
|
|
||||||
## Review Checklist
|
|
||||||
|
|
||||||
```markdown
|
|
||||||
## Review: [Plan title]
|
|
||||||
|
|
||||||
### Completeness
|
|
||||||
- [ ] Context explains the problem and goal
|
|
||||||
- [ ] Affected modules are listed with paths
|
|
||||||
- [ ] Architecture decisions have rationale
|
|
||||||
- [ ] Testing strategy is defined
|
|
||||||
- [ ] Verification commands are explicit and project-specific
|
|
||||||
- [ ] Open questions are listed
|
|
||||||
|
|
||||||
### Task Quality
|
|
||||||
- [ ] Every task has acceptance criteria
|
|
||||||
- [ ] Every task has verification steps
|
|
||||||
- [ ] Tasks are sized XS–M (L acceptable, XL must be split)
|
|
||||||
- [ ] Task dependencies are stated
|
|
||||||
- [ ] Files likely touched are listed
|
|
||||||
|
|
||||||
### Architecture & Sequencing
|
|
||||||
- [ ] Order follows dependency graph (foundations first)
|
|
||||||
- [ ] Vertically sliced (not horizontal layers)
|
|
||||||
- [ ] Each task leaves system working
|
|
||||||
- [ ] Checkpoints exist between phases
|
|
||||||
- [ ] High-risk tasks are early
|
|
||||||
|
|
||||||
### Risk Coverage
|
|
||||||
- [ ] Edge cases identified
|
|
||||||
- [ ] Breaking changes / migrations noted
|
|
||||||
- [ ] Security implications considered
|
|
||||||
- [ ] Performance implications considered
|
|
||||||
- [ ] Rollback strategy exists (if applicable)
|
|
||||||
|
|
||||||
### Actionability
|
|
||||||
- [ ] File paths are specific
|
|
||||||
- [ ] Verification commands are copy-pasteable
|
|
||||||
- [ ] Existing code to read is referenced
|
|
||||||
- [ ] Conventions and patterns are noted
|
|
||||||
|
|
||||||
### Proposed Code Quality *(if plan includes implementation details)*
|
|
||||||
- [ ] Proposed types/signatures handle edge cases
|
|
||||||
- [ ] Proposed names follow project conventions
|
|
||||||
- [ ] Proposed abstractions follow existing patterns
|
|
||||||
- [ ] No security vectors in proposed APIs
|
|
||||||
- [ ] No performance issues in proposed structures
|
|
||||||
|
|
||||||
### Verdict
|
|
||||||
- [ ] **Approve** — Ready to implement
|
|
||||||
- [ ] **Request changes** — Gaps must be addressed
|
|
||||||
```
|
|
||||||
|
|
||||||
## Common Rationalizations
|
|
||||||
|
|
||||||
| Rationalization | Reality |
|
|
||||||
|---|---|
|
|
||||||
| "I'll figure out the details during implementation" | That's how you discover blocking dependencies mid-task. Surface them now. |
|
|
||||||
| "The tasks are obvious, no need for criteria" | Write them anyway. Explicit criteria surface hidden assumptions. |
|
|
||||||
| "It's just a small feature, it doesn't need a plan" | Small features have edge cases too. 3 tasks with criteria takes 5 minutes. |
|
|
||||||
| "The plan is good enough" | "Good enough" without acceptance criteria means the implementer defines "done" — and they might define it differently. |
|
|
||||||
| "I'll add verification steps later" | Later never comes. The plan is the contract — define verification now. |
|
|
||||||
| "Risks are minimal" | Every change has risks. If you can't name them, you haven't thought about them. |
|
|
||||||
| "The file paths are obvious" | They're obvious to the author. The implementer might not know the codebase. |
|
|
||||||
| "The code in the plan is fine, it'll get reviewed later" | Plan-level code review catches design problems before implementation — fixing them after coding is more expensive. |
|
|
||||||
|
|
||||||
## Red Flags
|
|
||||||
|
|
||||||
- No acceptance criteria on any task
|
|
||||||
- Tasks that say "implement the feature" without specifics
|
|
||||||
- No verification steps anywhere in the plan
|
|
||||||
- All tasks are XL-sized
|
|
||||||
- No checkpoints between phases
|
|
||||||
- Dependency order isn't considered (e.g., API handler before domain model)
|
|
||||||
- No testing strategy
|
|
||||||
- Verification commands are generic ("run tests") instead of project-specific
|
|
||||||
- Plan has 20+ tasks (scope too large for one plan)
|
|
||||||
- No risk section on a plan with migrations, breaking changes, or security implications
|
|
||||||
- Horizontal slicing (all domain, then all services, then all API)
|
|
||||||
- File paths are vague ("update the relevant files")
|
|
||||||
- Missing open questions section despite stated unknowns
|
|
||||||
- Proposed code ignores project conventions or existing patterns
|
|
||||||
- Proposed types use gratuitous `any`/`unknown`/optional without justification
|
|
||||||
- Proposed APIs don't validate input at boundaries
|
|
||||||
|
|
||||||
## See Also
|
|
||||||
|
|
||||||
- For producing plans, use the `planner` skill
|
|
||||||
- For reviewing implemented code, use `code-review-criteria` — also the criteria source for axis 6
|
|
||||||
- For security-specific concerns, see `security-and-hardening`
|
|
||||||
- For testing strategy guidance, see `testing`
|
|
||||||
@ -1,265 +0,0 @@
|
|||||||
---
|
|
||||||
name: planner
|
|
||||||
description: Read-only planning and architecture analysis — produce a structured implementation plan with task breakdown, acceptance criteria, sizing, and checkpoints. Always output to the user with the plan, suggested save path and the next steps.
|
|
||||||
---
|
|
||||||
|
|
||||||
# Planner
|
|
||||||
|
|
||||||
Produce a plan that another engineer or agent can execute without guessing.
|
|
||||||
|
|
||||||
## When to Use
|
|
||||||
|
|
||||||
- The user asks for a plan, design, or analysis of a feature or bug.
|
|
||||||
- The user wants to understand which parts of the codebase a task will touch.
|
|
||||||
- The user needs a step-by-step implementation plan with file paths, function
|
|
||||||
names, and test strategy.
|
|
||||||
- The user asks "how would I implement X?" or "what's involved in fixing Y?".
|
|
||||||
- The user is about to start non-trivial work and wants a bite-sized task
|
|
||||||
breakdown.
|
|
||||||
- A task feels too large or vague to start.
|
|
||||||
- Work needs to be parallelized across multiple agents or sessions.
|
|
||||||
|
|
||||||
Do not use for a small change with obvious scope or an existing executable plan.
|
|
||||||
|
|
||||||
## CRITICAL: Required Reading Before Planning
|
|
||||||
|
|
||||||
Before drafting any plan, work through the project's own guidance:
|
|
||||||
|
|
||||||
1. Read `critical-info` (`.serena/memories/critical-info.md`) — the entry point
|
|
||||||
that describes the monorepo structure and module dependency graph.
|
|
||||||
2. From `critical-info`, identify which modules your task affects.
|
|
||||||
3. Read each affected module's core memory, e.g. `mem:frontend/core`,
|
|
||||||
`mem:backend/core`, `mem:common/core`, `mem:exporter/core`,
|
|
||||||
`mem:render-wasm/core`. Follow `mem:` references deeper as needed.
|
|
||||||
4. For each affected module, note its lint, format, and test commands so the
|
|
||||||
plan can include concrete verification steps.
|
|
||||||
|
|
||||||
Skipping this step is the #1 cause of incorrect or incomplete plans.
|
|
||||||
|
|
||||||
## Constraints
|
|
||||||
|
|
||||||
- You are **analysis-only** — never create, edit, or delete source code. The
|
|
||||||
only file you may write is the plan itself, and only when the command or
|
|
||||||
user explicitly instructs you to save it.
|
|
||||||
- You do **not** run builds, tests, linters, or any commands that modify state.
|
|
||||||
- You do **not** create git commits or interact with version control.
|
|
||||||
- You do **not** execute shell commands beyond read-only searches (`rg`, `ls`,
|
|
||||||
`find`, `cat`, `bat`).
|
|
||||||
- Your output is a structured plan or analysis, ready for handoff to an
|
|
||||||
engineer agent or developer.
|
|
||||||
|
|
||||||
## Planning Process
|
|
||||||
|
|
||||||
1. Define the problem, desired outcome, constraints, and exclusions.
|
|
||||||
2. Trace the current behavior through the affected modules.
|
|
||||||
3. Map dependencies and choose an implementation order that builds foundations
|
|
||||||
before their consumers.
|
|
||||||
4. Identify open product or architecture decisions. Resolve implementation
|
|
||||||
details from existing conventions when they do not affect public behavior.
|
|
||||||
5. Identify edge cases, security and data risks, performance bounds, breaking
|
|
||||||
changes, and external dependencies.
|
|
||||||
6. Split the work into small, ordered tasks. Prefer complete testable slices
|
|
||||||
over unrelated layer-wide batches. Apply DRY and KISS to the proposed
|
|
||||||
implementation.
|
|
||||||
7. Define exact acceptance criteria and verification for every task.
|
|
||||||
8. Add a checkpoint after every two or three tasks in a longer plan.
|
|
||||||
9. State which tasks can run in parallel and which must remain sequential.
|
|
||||||
|
|
||||||
## Task Format
|
|
||||||
|
|
||||||
Each task follows this structure:
|
|
||||||
|
|
||||||
```markdown
|
|
||||||
### Task [N]: [Short descriptive title]
|
|
||||||
|
|
||||||
**Description:** One or two paragraphs explaining what this task accomplishes.
|
|
||||||
Should be clear and concise.
|
|
||||||
|
|
||||||
**Rationale:** Why this task exists and why this approach over the obvious
|
|
||||||
alternatives — design decisions, trade-offs, constraints discovered during
|
|
||||||
analysis. One or two sentences; skip only if genuinely trivial.
|
|
||||||
|
|
||||||
**Code sketch (optional):** Signature-, type-, or shape-level example when the
|
|
||||||
intended interface is non-obvious. Keep it short — a skeleton that fixes the
|
|
||||||
contract (function signature, model fields, error shape), never a full
|
|
||||||
implementation. Omit when the task is mechanical.
|
|
||||||
|
|
||||||
**Acceptance criteria:**
|
|
||||||
- [ ] [Specific, testable condition]
|
|
||||||
- [ ] [Specific, testable condition]
|
|
||||||
|
|
||||||
**Verification:**
|
|
||||||
- [ ] Relevant tests pass (module-specific test command).
|
|
||||||
- [ ] Lint/formatter passes (module-specific check command), if applicable.
|
|
||||||
- [ ] The core flow works end-to-end, if applicable.
|
|
||||||
|
|
||||||
**Dependencies:** [Task numbers this depends on, or "None"]
|
|
||||||
|
|
||||||
**Files likely touched:**
|
|
||||||
- `path/to/file.clj`
|
|
||||||
- `path/to/file_test.clj`
|
|
||||||
|
|
||||||
**Estimated scope:** [XS: 1 file | S: 1-2 files | M: 3-5 files | L: 5+ files]
|
|
||||||
```
|
|
||||||
|
|
||||||
Use commands from `mem:testing` and affected module memories. Never substitute
|
|
||||||
generic text such as "run the tests" when the project documents an exact
|
|
||||||
command.
|
|
||||||
|
|
||||||
When possible, design each task with TDD in mind: acceptance criteria double as a test
|
|
||||||
list, and the natural first step of the task is writing those tests before the
|
|
||||||
implementation. Some tasks resist this (config, migrations, pure wiring) — for those, keep
|
|
||||||
the usual verification steps.
|
|
||||||
|
|
||||||
## Task Sizing
|
|
||||||
|
|
||||||
| Size | Files | Scope | Example |
|
|
||||||
|------|-------|-------|---------|
|
|
||||||
| **XS** | 1 | Single function, config change, or schema tweak | Add a validation rule |
|
|
||||||
| **S** | 1-2 | One handler or component method | Add a new RPC endpoint |
|
|
||||||
| **M** | 3-5 | One vertical feature slice | Bookmark CRUD with tests |
|
|
||||||
| **L** | 5-8 | Multi-component feature | Search with filtering and pagination |
|
|
||||||
| **XL** | 8+ | **Too large — break it down further** | — |
|
|
||||||
|
|
||||||
Split a task when it contains independent outcomes, spans unrelated systems, or cannot be
|
|
||||||
completed and verified in one focused session (if a task is XL, it should be broken into
|
|
||||||
smaller tasks; agents perform best on S and M tasks).
|
|
||||||
|
|
||||||
## Task order and checkpoints
|
|
||||||
|
|
||||||
Arrange tasks so that:
|
|
||||||
|
|
||||||
1. Dependencies are satisfied (build foundation first)
|
|
||||||
2. Each task leaves the system in a working state
|
|
||||||
3. Verification checkpoints occur after every 2-3 tasks
|
|
||||||
4. High-risk tasks are early (fail fast)
|
|
||||||
|
|
||||||
Add explicit checkpoints with the relevant module commands:
|
|
||||||
|
|
||||||
```markdown
|
|
||||||
### Checkpoint: After Tasks 1-3
|
|
||||||
- [ ] Relevant tests pass (module-specific command).
|
|
||||||
- [ ] The relevant build or compilation passes, if applicable.
|
|
||||||
- [ ] The core flow works end-to-end.
|
|
||||||
```
|
|
||||||
|
|
||||||
## Output Format
|
|
||||||
|
|
||||||
The plan is always delivered in the response so the user sees it regardless
|
|
||||||
of which agent is running the skill. File writes follow `Constraints` —
|
|
||||||
by default announce the path instead of writing.
|
|
||||||
|
|
||||||
Announce the save path `.agents/plans/YYYY-MM-DD-<slug>.md` (today's date,
|
|
||||||
lowercase hyphen-separated slug, e.g. `2026-09-10-add-batch-get-profiles`;
|
|
||||||
an explicit user path wins).
|
|
||||||
|
|
||||||
### Derived plans
|
|
||||||
|
|
||||||
Never invent a fresh slug when the plan derives from an existing one.
|
|
||||||
The derived name is `<parent-basename>` plus one suffix per level,
|
|
||||||
joined with `--` (double hyphen; single hyphens already separate
|
|
||||||
slug words, so `--` marks where the derivation starts). The parent
|
|
||||||
name is never edited, and no new date is added — the parent prefix
|
|
||||||
already carries its date, which keeps parent and derivatives adjacent
|
|
||||||
in `ls`. Record the real creation date inside the plan (`Created:`).
|
|
||||||
|
|
||||||
Valid names match:
|
|
||||||
|
|
||||||
```
|
|
||||||
^\d{4}-\d{2}-\d{2}-[a-z0-9-]+(--(review-\d{2}|task-\d{2})(-[a-z0-9-]+)?)*\.md$
|
|
||||||
```
|
|
||||||
|
|
||||||
- `review-NN` — a new plan addressing findings of a `review-code` or
|
|
||||||
`review-plan` on already-implemented work. `NN` counts reviews of
|
|
||||||
that parent from `01`. Example: parent
|
|
||||||
`2026-09-14-paste-before-init-crash.md` →
|
|
||||||
`2026-09-14-paste-before-init-crash--review-01.md`,
|
|
||||||
then `--review-02.md`.
|
|
||||||
- `task-NN-<short-slug>` — sub-plan for task `NN` of a high-level
|
|
||||||
roadmap plan. `NN` is the roadmap task number. Example: parent
|
|
||||||
`2026-09-20-upload-pipeline-roadmap.md` →
|
|
||||||
`2026-09-20-upload-pipeline-roadmap--task-01-chunk-upload.md`.
|
|
||||||
Levels chain: `...--task-02-gc--review-01.md`.
|
|
||||||
|
|
||||||
Never use `v2`, `final`, `new`, or `fix2` as suffixes. Keep the
|
|
||||||
optional short slug to 3-4 lowercase hyphen-separated words.
|
|
||||||
|
|
||||||
Every derived plan opens its `Context` with:
|
|
||||||
|
|
||||||
```markdown
|
|
||||||
Parent: `<parent-basename>.md`
|
|
||||||
Source: review-code over `<commit>` (branch `<branch>`) | task `NN` of roadmap `<parent-basename>.md`
|
|
||||||
Created: YYYY-MM-DD
|
|
||||||
```
|
|
||||||
|
|
||||||
End the response by suggesting the next steps: `/review-plan` to get a second
|
|
||||||
opinion on the plan and `/implement-plan` to execute it.
|
|
||||||
|
|
||||||
### Plan Structure
|
|
||||||
|
|
||||||
Use this document shape:
|
|
||||||
|
|
||||||
```markdown
|
|
||||||
# Plan: Title
|
|
||||||
|
|
||||||
Status: draft | reviewed | done
|
|
||||||
Review Log:
|
|
||||||
- YYYY-MM-DDTHH:MM:SSZ — <what changed and why, one line per entry>
|
|
||||||
|
|
||||||
## Context
|
|
||||||
## Affected Modules
|
|
||||||
## Architecture Decisions
|
|
||||||
## Risks and Considerations
|
|
||||||
## Approach
|
|
||||||
## Task List
|
|
||||||
## Verification and Testing
|
|
||||||
## Parallelization
|
|
||||||
## Open Questions
|
|
||||||
```
|
|
||||||
|
|
||||||
`Status` and `Review Log` are write-restricted metadata, not free text:
|
|
||||||
|
|
||||||
- `make-a-plan` creates every plan with `Status: draft` and an empty
|
|
||||||
log. `reviewed` never means "a review was emitted" — it means
|
|
||||||
"review feedback was incorporated". A plan approved with no changes
|
|
||||||
goes `draft` → `done` without passing through `reviewed`.
|
|
||||||
- Only a user-triggered apply step writes them before implementation:
|
|
||||||
when the user says to apply `review-plan` findings, `make-a-plan`
|
|
||||||
applies the changes, flips to `reviewed`, and appends one UTC
|
|
||||||
ISO 8601 line describing what changed.
|
|
||||||
- `implement-plan` flips to `done` on completion and appends one line
|
|
||||||
with the issue URL when one exists (standalone mode); otherwise
|
|
||||||
just `done`. Never record commit hashes — they rot on amend/rebase
|
|
||||||
and git already links the commit.
|
|
||||||
- The log is append-only: never rewrite or delete lines.
|
|
||||||
- `review-plan` and `review-code` never write these fields.
|
|
||||||
|
|
||||||
Omit empty sections only when they do not apply. Every implementation task
|
|
||||||
still requires acceptance criteria, verification, dependencies, likely files,
|
|
||||||
and scope.
|
|
||||||
|
|
||||||
When the plan is purely analytical (e.g. a code review or feasibility study
|
|
||||||
with no implementation), skip the **Approach** and **Task List** sections and
|
|
||||||
lead with **Findings** instead, keeping the rest of the structure.
|
|
||||||
|
|
||||||
## Common Rationalizations
|
|
||||||
|
|
||||||
| Rationalization | Reality |
|
|
||||||
|---|---|
|
|
||||||
| "I'll figure it out as I go" | That's how you end up with a tangled mess and rework. 10 minutes of planning saves hours. |
|
|
||||||
| "The tasks are obvious" | Write them down anyway. Explicit tasks surface hidden dependencies and forgotten edge cases. |
|
|
||||||
| "Planning is overhead" | Planning is the task. Implementation without a plan is just typing. |
|
|
||||||
| "I can hold it all in my head" | Context windows are finite. Written plans survive session boundaries and compaction. |
|
|
||||||
|
|
||||||
## Verification Checklist
|
|
||||||
|
|
||||||
Before delivering the plan, confirm:
|
|
||||||
|
|
||||||
- [ ] Every task has acceptance criteria
|
|
||||||
- [ ] Every task has a verification step
|
|
||||||
- [ ] Task dependencies are identified and ordered correctly
|
|
||||||
- [ ] No task is XL or larger — break it down instead
|
|
||||||
- [ ] Checkpoints exist after every 2-3 tasks
|
|
||||||
- [ ] The response states the plan's path (saved or suggested) and suggests
|
|
||||||
`/review-plan` and `/implement-plan`
|
|
||||||
- [ ] The plan is ready for human review
|
|
||||||
@ -1,421 +0,0 @@
|
|||||||
---
|
|
||||||
name: refactor-scss
|
|
||||||
description: Migrate one Penpot SCSS module off the deprecated styles under frontend/resources/styles/common/refactor/ to the current Design System (ds/ tokens, mixins and px2rem). Pure refactor, no visual change. Use when the user asks to refactor, migrate or clean up a .scss file to the DS.
|
|
||||||
---
|
|
||||||
|
|
||||||
# Skill: refactor-scss
|
|
||||||
|
|
||||||
Refactor a single SCSS file so that it no longer depends on the deprecated
|
|
||||||
styling system, using the current Design System instead.
|
|
||||||
|
|
||||||
This is a **pure refactor**. Do NOT introduce visual or behavioral changes.
|
|
||||||
Preserve the generated CSS behavior exactly unless a rule below requires
|
|
||||||
otherwise. The rules that allow a small visible change (closest DS
|
|
||||||
typography, DS border width) want it shown in the visual check and listed
|
|
||||||
in the report and the commit body.
|
|
||||||
|
|
||||||
Reviewers read every line of the result. A line that is
|
|
||||||
copied but does nothing, a bare element selector or a raw z-index comes
|
|
||||||
back as a review comment, so the rules below are strict about them.
|
|
||||||
|
|
||||||
## Input
|
|
||||||
|
|
||||||
- The path to one `.scss` file (e.g. `frontend/src/app/main/ui/foo/bar.scss`).
|
|
||||||
- If no path is given, ask for it. Do not pick a file yourself.
|
|
||||||
|
|
||||||
## Workflow
|
|
||||||
|
|
||||||
1. Read the target `.scss` file and the `.cljs` file with the same name next
|
|
||||||
to it.
|
|
||||||
2. Read every deprecated source the file uses, so you inline real values,
|
|
||||||
never remembered ones:
|
|
||||||
- `frontend/resources/styles/common/refactor/mixins.scss`
|
|
||||||
- `frontend/resources/styles/common/refactor/design-tokens.scss`
|
|
||||||
- `frontend/resources/styles/common/refactor/spacing.scss`
|
|
||||||
- any other file under `frontend/resources/styles/common/refactor/` that
|
|
||||||
the stylesheet pulls in (placeholders, borders, z-index, fonts...).
|
|
||||||
3. Read the DS modules you will map to:
|
|
||||||
- `frontend/src/app/main/ui/ds/_utils.scss` (`px2rem()`)
|
|
||||||
- `frontend/src/app/main/ui/ds/spacing.scss`
|
|
||||||
- `frontend/src/app/main/ui/ds/_sizes.scss`
|
|
||||||
- `frontend/src/app/main/ui/ds/typography.scss` (`use-typography()`)
|
|
||||||
- `frontend/src/app/main/ui/ds/_borders.scss`
|
|
||||||
- `frontend/src/app/main/ui/ds/z-index.scss`
|
|
||||||
4. Apply the rules below and edit the file in place.
|
|
||||||
5. Verify (see **Verification** and **Visual check**).
|
|
||||||
6. Report (see **Output**). Do not commit. When the refactor goes with other
|
|
||||||
changes, it belongs in its own commit, after the task's commits.
|
|
||||||
|
|
||||||
## Primary goal
|
|
||||||
|
|
||||||
After the refactor, the SCSS file must not depend on anything under
|
|
||||||
`frontend/resources/styles/common/refactor/`. This includes imports, mixins,
|
|
||||||
placeholder selectors, functions, deprecated variables and design-token
|
|
||||||
aliases.
|
|
||||||
|
|
||||||
### Partial refactor
|
|
||||||
|
|
||||||
Some placeholders stand for a whole component family that will move to the DS
|
|
||||||
in its own PR: `%input-element`, `%input-with-label`, `%input-checkbox`,
|
|
||||||
`%modal-*`, `%menu-dropdown`, `%menu-item-base`, `%shortcut-*` and similar.
|
|
||||||
Inlining them in a small task produces big, risky diffs. In that case:
|
|
||||||
|
|
||||||
- migrate everything else (tokens, sizes, spacing, small mixins);
|
|
||||||
- keep the `refactor/` import only for those placeholders;
|
|
||||||
- list each remaining dependency and the selectors that use it in the report,
|
|
||||||
so the user can plan it as a separate PR.
|
|
||||||
|
|
||||||
## General rules
|
|
||||||
|
|
||||||
- Keep the resulting SCSS as small and readable as possible.
|
|
||||||
- Avoid duplicated declarations and duplicated selectors.
|
|
||||||
- Do not change class names.
|
|
||||||
- Do not change DOM structure.
|
|
||||||
- Do not change specificity unless required.
|
|
||||||
- Follow the project's SCSS formatting (Prettier, see **Verification**).
|
|
||||||
|
|
||||||
## Imports
|
|
||||||
|
|
||||||
Use the DS modules. Import them with `as *` when they expose mixins,
|
|
||||||
variables or functions:
|
|
||||||
|
|
||||||
```scss
|
|
||||||
@use "ds/_utils.scss" as *;
|
|
||||||
```
|
|
||||||
|
|
||||||
not
|
|
||||||
|
|
||||||
```scss
|
|
||||||
@use "ds/_utils.scss" as utils;
|
|
||||||
```
|
|
||||||
|
|
||||||
Do not introduce namespaces such as `utils.`, `typography.`, `borders.`,
|
|
||||||
`spacing.` or `sizes.` unless a module explicitly requires one.
|
|
||||||
|
|
||||||
Remove every unused import.
|
|
||||||
|
|
||||||
## Deprecated mixins
|
|
||||||
|
|
||||||
If the stylesheet uses mixins from
|
|
||||||
`frontend/resources/styles/common/refactor/mixins.scss`:
|
|
||||||
|
|
||||||
- locate the mixin;
|
|
||||||
- inline its generated CSS (then apply the rest of these rules to it);
|
|
||||||
- remove the `@include`;
|
|
||||||
- remove the import.
|
|
||||||
|
|
||||||
Do not leave deprecated mixins.
|
|
||||||
|
|
||||||
## Placeholders
|
|
||||||
|
|
||||||
Replace every `@extend %placeholder` with the generated CSS. Remove every
|
|
||||||
deprecated placeholder, except the component-family ones described in
|
|
||||||
**Partial refactor**.
|
|
||||||
|
|
||||||
Inline only what does something on that element. Do not paste a
|
|
||||||
placeholder (or mixin) body as it is. For each property, check:
|
|
||||||
|
|
||||||
- **It applies to the element.** `fill`, `stroke` and `stroke-width` only
|
|
||||||
act on SVG shapes: drop them from a `span`, `div` or `button`.
|
|
||||||
`color: transparent` on a wrapper that only holds an icon does nothing
|
|
||||||
useful: drop it and set the real color.
|
|
||||||
- **It is not the default or already given.** `stroke-width: 1px` is the
|
|
||||||
SVG default; `fill: none` and `stroke: currentColor` are already set by
|
|
||||||
the DS `icon*` (`.icon`). Drop them.
|
|
||||||
- **A later rule does not override it.**
|
|
||||||
- **It is not a stroke width on a DS icon.** DS icons keep the DS
|
|
||||||
stroke width; drop any `stroke-width` that only imitates the legacy
|
|
||||||
icon (1.33px, 2.25px...).
|
|
||||||
|
|
||||||
`%button-icon` is the usual case: on a wrapper it leaves `color:
|
|
||||||
transparent; fill: none; stroke-width: 1px`, and none of the three is
|
|
||||||
needed.
|
|
||||||
|
|
||||||
## Element selectors
|
|
||||||
|
|
||||||
Do not style HTML elements directly (`svg {}`, `h3 {}`, `button {}`,
|
|
||||||
`input.x {}`, or `.component { svg {} }`).
|
|
||||||
|
|
||||||
When no class exists, **add one in the `.cljs`**: a DS component takes
|
|
||||||
`:class (stl/css :x)` (`icon*`, `heading*`, `button*`…), and a plain
|
|
||||||
element takes `{:class (stl/css :x)}`. Touching the `.cljs` for this is
|
|
||||||
part of the refactor. A comment like "the icon has no class" is not an
|
|
||||||
answer.
|
|
||||||
|
|
||||||
Prefer the DS component when one fits: `heading*` for `h1`–`h6`
|
|
||||||
(`:level`, `:typography`), `text*` for text, `icon*` for icons.
|
|
||||||
|
|
||||||
`element.class` (e.g. `input.element-title`) is not needed to beat the
|
|
||||||
input defaults: try the class alone and check it in the visual check.
|
|
||||||
|
|
||||||
An element selector stays only for markup you cannot reach (injected
|
|
||||||
HTML, third-party widgets), with a comment saying so.
|
|
||||||
|
|
||||||
**Icon colors.** A DS icon draws with `stroke: currentColor`. Set
|
|
||||||
`color` on the icon class or its parent, never `stroke`/`fill` on an
|
|
||||||
`svg` selector.
|
|
||||||
|
|
||||||
## Color variables
|
|
||||||
|
|
||||||
Whenever a color changes across states, introduce a component-local CSS
|
|
||||||
variable.
|
|
||||||
|
|
||||||
Instead of
|
|
||||||
|
|
||||||
```scss
|
|
||||||
.button {
|
|
||||||
color: var(--color-foreground-primary);
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
color: var(--color-accent-primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
&:disabled {
|
|
||||||
color: var(--color-foreground-disabled);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
write
|
|
||||||
|
|
||||||
```scss
|
|
||||||
.button {
|
|
||||||
--button-foreground-color: var(--color-foreground-primary);
|
|
||||||
|
|
||||||
color: var(--button-foreground-color);
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
--button-foreground-color: var(--color-accent-primary);
|
|
||||||
}
|
|
||||||
|
|
||||||
&:disabled {
|
|
||||||
--button-foreground-color: var(--color-foreground-disabled);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Use this pattern for `color`, `background-color`, `border-color`,
|
|
||||||
`outline-color`, `fill`, `stroke` and any similar property.
|
|
||||||
|
|
||||||
## Design token aliases
|
|
||||||
|
|
||||||
Remove every alias defined in
|
|
||||||
`frontend/resources/styles/common/refactor/design-tokens.scss`. Resolve each
|
|
||||||
alias to its final DS token. Do not keep intermediate aliases.
|
|
||||||
|
|
||||||
Instead of `color: var(--button-foreground-hover);` write
|
|
||||||
`color: var(--color-accent-primary);`.
|
|
||||||
|
|
||||||
## Spacing
|
|
||||||
|
|
||||||
Replace deprecated spacing variables using
|
|
||||||
`frontend/src/app/main/ui/ds/spacing.scss` for `margin`, `padding`, `gap` and
|
|
||||||
`inset`.
|
|
||||||
|
|
||||||
If no exact spacing token exists, use `px2rem()`. Do not approximate with the
|
|
||||||
closest token.
|
|
||||||
|
|
||||||
## Sizes
|
|
||||||
|
|
||||||
Replace deprecated size variables using
|
|
||||||
`frontend/src/app/main/ui/ds/_sizes.scss` for `inline-size`, `block-size`,
|
|
||||||
`width`, `height` and min/max sizes.
|
|
||||||
|
|
||||||
If no exact size exists, use `px2rem()` from
|
|
||||||
`frontend/src/app/main/ui/ds/_utils.scss`. Do not leave hardcoded pixel values
|
|
||||||
unless absolutely necessary.
|
|
||||||
|
|
||||||
## Typography
|
|
||||||
|
|
||||||
When any of `font-size`, `font-weight`, `line-height`, `font-family` or
|
|
||||||
`letter-spacing` appear, check whether together they match one of the
|
|
||||||
definitions in `frontend/src/app/main/ui/ds/typography.scss`.
|
|
||||||
|
|
||||||
If they match, replace all the individual declarations with:
|
|
||||||
|
|
||||||
```scss
|
|
||||||
@include use-typography("<typography-name>");
|
|
||||||
```
|
|
||||||
|
|
||||||
If there is no exact match, use the **closest DS typography** (same role:
|
|
||||||
a panel title in uppercase → `headline-small`, body text → `body-*`),
|
|
||||||
even when more than one detail differs. Show the change in the visual
|
|
||||||
check and state it in the report and in the commit body (e.g. "11px
|
|
||||||
regular → 12px medium").
|
|
||||||
|
|
||||||
Keep the original declarations only when no DS typography fits the role
|
|
||||||
(e.g. a 32px display number in a 14px-only area); then leave a TODO
|
|
||||||
naming the closest one and ask the user.
|
|
||||||
|
|
||||||
## Borders
|
|
||||||
|
|
||||||
Replace deprecated border radius and border width values using
|
|
||||||
`frontend/src/app/main/ui/ds/_borders.scss`. A raw width close to a token
|
|
||||||
(`1.75px`) takes the token (`$b-2`); say so in the report. If nothing is
|
|
||||||
close, use `px2rem()`.
|
|
||||||
|
|
||||||
## Logical properties
|
|
||||||
|
|
||||||
Prefer logical properties whenever they preserve the existing behavior:
|
|
||||||
|
|
||||||
- `width` → `inline-size`
|
|
||||||
- `height` → `block-size`
|
|
||||||
- `max-width` → `max-inline-size`
|
|
||||||
- `margin-left` → `margin-inline-start`
|
|
||||||
- `padding-right` → `padding-inline-end`
|
|
||||||
- `top` → `inset-block-start`
|
|
||||||
- `left` → `inset-inline-start`
|
|
||||||
|
|
||||||
## Z-index
|
|
||||||
|
|
||||||
Never leave magic z-index values. Use tokens from
|
|
||||||
`frontend/src/app/main/ui/ds/z-index.scss`, and pick the token **by what
|
|
||||||
the element is, not by its number**: a dropdown, menu or select →
|
|
||||||
`--z-index-dropdown`; a toolbar, palette, sidebar or panel →
|
|
||||||
`--z-index-panels`; and so on (read the comments in that file). A raw `4`
|
|
||||||
on a dropdown becomes `var(--z-index-dropdown)` even though the number
|
|
||||||
changes. Check the visual check for overlap.
|
|
||||||
|
|
||||||
Leave a TODO only when the element fits no token's purpose.
|
|
||||||
|
|
||||||
Legacy z-index values between sibling elements that do not overlap can be
|
|
||||||
removed, but only when the **Visual check** shows no pixel change in every
|
|
||||||
state that matters (open menus, collapsed, hidden). Say so in the report.
|
|
||||||
|
|
||||||
## Duplicated properties
|
|
||||||
|
|
||||||
Within the same selector, avoid duplicated properties, duplicated CSS
|
|
||||||
variables and duplicated declarations introduced by the refactor. Allow
|
|
||||||
duplicates only when they are intentional browser fallbacks.
|
|
||||||
|
|
||||||
## Unused classes
|
|
||||||
|
|
||||||
Open the `.cljs` file with the same name as the SCSS file and check whether
|
|
||||||
every CSS class is referenced (as `(stl/css :class-name)`,
|
|
||||||
`(stl/css-case :class-name ...)` or similar).
|
|
||||||
|
|
||||||
CSS modules prefix every class with its module
|
|
||||||
(`main_ui_<path>__<class>`), so only the `.cljs` of the same module can use
|
|
||||||
it. Before calling a selector unused, also search the whole `frontend/src`
|
|
||||||
for the class name as a string, a `:global` use, or a dynamic class built
|
|
||||||
at runtime.
|
|
||||||
|
|
||||||
If a selector is unused after that check:
|
|
||||||
|
|
||||||
- delete it (do not leave it commented out, do not add a TODO);
|
|
||||||
- list every deleted selector in the report and in the commit body.
|
|
||||||
|
|
||||||
A rule that matches nothing because the markup changed (e.g. `.icon svg`
|
|
||||||
when the DS icon is the `svg` itself) is deleted the same way. Before
|
|
||||||
deleting a descendant rule, check every element it matched, not only
|
|
||||||
the one you changed: `.placeholder .icon svg` can also color a second
|
|
||||||
icon, which then has no color (in the devenv it shows in the debug
|
|
||||||
yellow).
|
|
||||||
|
|
||||||
Every DS icon needs a color of its own (`color` on its class or on a
|
|
||||||
parent with a defined color): an icon that inherits nothing shows in
|
|
||||||
the debug yellow in the devenv.
|
|
||||||
|
|
||||||
Classes used by markup injected from outside (e.g. an external widget)
|
|
||||||
stay, with a comment saying so.
|
|
||||||
|
|
||||||
Also check the other direction: every class the `.cljs` passes to
|
|
||||||
`stl/css` / `stl/css-case` must exist in the `.scss`. A missing one silently
|
|
||||||
does nothing; report it.
|
|
||||||
|
|
||||||
## Sass and CSS pitfalls
|
|
||||||
|
|
||||||
- Sass does not evaluate functions inside CSS custom properties. Write
|
|
||||||
`--button-height: calc(var(--height) - #{px2rem(16)});`, not
|
|
||||||
`... - px2rem(16))`, or the browser gets the literal `px2rem(16)`.
|
|
||||||
- A `/` between Sass size variables is read as a division
|
|
||||||
(`grid-template: $sz-32 / auto` breaks). Split it into
|
|
||||||
`grid-template-rows` / `grid-template-columns` (or areas).
|
|
||||||
- A CSS-wide keyword cannot be part of a shorthand: `inset-inline: unset 0`
|
|
||||||
is invalid and stylelint does not catch it. Use the longhands.
|
|
||||||
- After editing, check the compiled CSS for any of these
|
|
||||||
(`frontend/resources/public/css/main.css`, search the module class).
|
|
||||||
|
|
||||||
## Uncertainty
|
|
||||||
|
|
||||||
If any transformation is uncertain, never guess. Leave a TODO in the code
|
|
||||||
and explain why in the report.
|
|
||||||
|
|
||||||
## Self-review
|
|
||||||
|
|
||||||
Before the report, read the final diff as the reviewer would and search
|
|
||||||
the file for these; each hit must be fixed or have a real reason:
|
|
||||||
|
|
||||||
```bash
|
|
||||||
rg -n 'svg \{|^\s*(h[1-6]|p|hr|input|button|span|a)\b[^-_]|[a-z]\.[a-z-]+ \{' <file>
|
|
||||||
rg -n 'stroke-width|color: transparent|fill: none|z-index: [0-9]|TODO' <file>
|
|
||||||
rg -n '[0-9]\.[0-9]+px|[^(]\b[0-9]+px' <file>
|
|
||||||
```
|
|
||||||
|
|
||||||
- an element selector → add a class (see **Element selectors**);
|
|
||||||
- a property that does not apply or is a default → drop it (see
|
|
||||||
**Placeholders**);
|
|
||||||
- a raw z-index → token by purpose;
|
|
||||||
- a typography TODO → closest DS typography;
|
|
||||||
- a raw px value → token or `px2rem()`.
|
|
||||||
|
|
||||||
## Verification
|
|
||||||
|
|
||||||
Run the project scripts from `frontend/` inside the devenv container
|
|
||||||
(`penpot-devenv-ws<N>-main` for workspace `wsN`; never run `pnpm` on the
|
|
||||||
host), writing output to a file first (never pipe lint output into
|
|
||||||
filters):
|
|
||||||
|
|
||||||
```bash
|
|
||||||
docker exec -u penpot -w /home/penpot/penpot/frontend penpot-devenv-ws<N>-main \
|
|
||||||
bash -lc 'pnpm run lint:scss; echo LINT=$?; pnpm run check-fmt:scss; echo FMT=$?' \
|
|
||||||
> <scratch>/scss-check.txt 2>&1
|
|
||||||
```
|
|
||||||
|
|
||||||
If the format check fails, run `pnpm run fmt:scss` and check again.
|
|
||||||
|
|
||||||
**Dependency check.** A grep for `refactor/` is not enough. For the final
|
|
||||||
file, check:
|
|
||||||
|
|
||||||
- `@use` / `@import` sources: all must be `ds/...` (or the sidebar common
|
|
||||||
module, which is DS-only);
|
|
||||||
- every `@include`, `@extend` and `%placeholder`;
|
|
||||||
- every `$variable`: which imported module defines it (`$br-*` exists in both
|
|
||||||
`ds/_borders.scss` and `refactor/borders.scss`; the `@use` decides);
|
|
||||||
- every `var(--token)`: defined in the DS (colors, spacing, sizes) or only as a
|
|
||||||
`refactor/` alias.
|
|
||||||
|
|
||||||
Report any failure as it is; do not hide it.
|
|
||||||
|
|
||||||
## Visual check
|
|
||||||
|
|
||||||
"No visual change" must be shown, not assumed. When a visual spec covers the
|
|
||||||
component (`frontend/playwright/ui/visual-specs/`, project `ds`), or one can be
|
|
||||||
added:
|
|
||||||
|
|
||||||
1. Capture before (base branch styles) and after with
|
|
||||||
`pnpm exec playwright test --project=ds -g "<test>" --update-snapshots=all`
|
|
||||||
in the container. `=all` is required: plain `--update-snapshots` only
|
|
||||||
rewrites past the 0.5% tolerance, so a real diff can look like 0.
|
|
||||||
2. Before each capture, wait until the compiled CSS/JS shows the expected
|
|
||||||
version (search `main.css` for the changed rule).
|
|
||||||
3. Compare with zero tolerance. If pixels change, build the before | after |
|
|
||||||
diff (red) image and explain every change in the report.
|
|
||||||
|
|
||||||
## Output
|
|
||||||
|
|
||||||
1. The diff of the file (`git diff -- <file>`).
|
|
||||||
2. A summary with:
|
|
||||||
- removed imports;
|
|
||||||
- removed deprecated mixins;
|
|
||||||
- removed placeholders;
|
|
||||||
- typography replacements;
|
|
||||||
- design-token aliases removed;
|
|
||||||
- logical properties introduced;
|
|
||||||
- deleted unused selectors;
|
|
||||||
- TODOs requiring manual review, each with its reason;
|
|
||||||
- remaining `refactor/` dependencies (partial refactor) and where they are
|
|
||||||
used;
|
|
||||||
- classes missing from the `.scss`, if any.
|
|
||||||
3. The verification results, including the visual check (pixel count, or why
|
|
||||||
it was not possible).
|
|
||||||
@ -1,134 +0,0 @@
|
|||||||
---
|
|
||||||
name: refine-prompt
|
|
||||||
description: Refine and improve a user-supplied prompt for maximum clarity and effectiveness using prompt-engineering best practices and Penpot project context. Outputs a rewritten prompt (and brief rationale); never executes the prompt.
|
|
||||||
---
|
|
||||||
|
|
||||||
# Refine Prompt
|
|
||||||
|
|
||||||
Expert prompt-engineering pass on a user-supplied prompt. Takes a draft prompt
|
|
||||||
and returns a clearer, more effective, well-structured version — ready to be
|
|
||||||
used with any AI model. Never executes the prompt itself.
|
|
||||||
|
|
||||||
## When to Use
|
|
||||||
|
|
||||||
- The user shares a prompt and asks to improve, refine, polish, or rewrite it.
|
|
||||||
- The user asks "make this prompt better" or "can you clean this up?".
|
|
||||||
- The user wants to add structure, constraints, examples, or output format to
|
|
||||||
a vague prompt.
|
|
||||||
- The user wants a prompt adapted for a specific target model, audience, or
|
|
||||||
task type.
|
|
||||||
|
|
||||||
Do **not** use this skill to actually answer the prompt or do the task — it
|
|
||||||
only rewrites the prompt.
|
|
||||||
|
|
||||||
## Role
|
|
||||||
|
|
||||||
You are an expert Prompt Engineer with strong knowledge of Penpot. Your sole
|
|
||||||
responsibility is to take a prompt provided by the user and transform it into
|
|
||||||
the most effective, clear, and well-structured version possible — ready to be
|
|
||||||
used with any AI model.
|
|
||||||
|
|
||||||
You do **not** execute tasks. You do **not** write code. You only design and
|
|
||||||
refine prompts.
|
|
||||||
|
|
||||||
## Required Reading Before Refining
|
|
||||||
|
|
||||||
Before rewriting, internalize the project context the prompt will likely run
|
|
||||||
against:
|
|
||||||
|
|
||||||
1. Read `AGENTS.md` (root) for the project-level rules and conventions.
|
|
||||||
2. Read `.serena/memories/critical-info.md` (or the equivalent entry point) to
|
|
||||||
understand the module layout (`frontend`, `backend`, `common`,
|
|
||||||
`render-wasm`, `exporter`, `mcp`, `plugins`, `library`).
|
|
||||||
3. Skim the relevant module's core memory (`mem:frontend/core`,
|
|
||||||
`mem:backend/core`, etc.) when the prompt targets a specific module — this
|
|
||||||
lets you inject precise vocabulary, file conventions, and test commands
|
|
||||||
into the refined prompt.
|
|
||||||
|
|
||||||
This step matters most when the user is preparing a prompt *about* the
|
|
||||||
Penpot codebase. For generic prompts, focus on prompt-engineering principles
|
|
||||||
and only weave in Penpot context when it is clearly relevant.
|
|
||||||
|
|
||||||
## Requirements
|
|
||||||
|
|
||||||
- Analyze the original prompt: identify its intent, target audience,
|
|
||||||
ambiguities, missing context, and structural weaknesses.
|
|
||||||
- Ask clarifying questions if the intent is unclear or if critical information
|
|
||||||
is missing (e.g. target model, expected output format, tone, constraints).
|
|
||||||
Keep questions concise and grouped. Prefer to ask 1–4 questions at once
|
|
||||||
rather than one at a time. **Use the `question` tool** to ask them so the
|
|
||||||
user gets a structured multi-choice UI; reserve a plain `## Clarifying
|
|
||||||
questions` markdown section for cases where the `question` tool is
|
|
||||||
unavailable or the question is genuinely open-ended.
|
|
||||||
- Rewrite the prompt using prompt-engineering best practices (see below).
|
|
||||||
- Preserve the user's original intent — do not change the underlying task.
|
|
||||||
- When the user provides Penpot project context, weave in the relevant
|
|
||||||
conventions, module paths, and tooling.
|
|
||||||
|
|
||||||
## Prompt Engineering Principles
|
|
||||||
|
|
||||||
Apply these techniques when refining prompts:
|
|
||||||
|
|
||||||
- **Be specific and explicit**: Replace vague instructions with precise ones.
|
|
||||||
- **Set the context**: Include background information the model needs to
|
|
||||||
perform well.
|
|
||||||
- **Specify the output format**: State the desired structure, length, tone,
|
|
||||||
or format (e.g. bullet list, JSON, step-by-step).
|
|
||||||
- **Add constraints**: Include what the model should avoid or not do.
|
|
||||||
- **Use examples** (few-shot): When applicable, suggest adding examples to
|
|
||||||
anchor the model's behaviour.
|
|
||||||
- **Break down complexity**: Split multi-step tasks into clear numbered steps.
|
|
||||||
- **Avoid ambiguity**: Remove pronouns and references that could be
|
|
||||||
misinterpreted.
|
|
||||||
- **Chain of thought**: For reasoning tasks, include "Think step by step."
|
|
||||||
- **Role framing**: When helpful, give the model a clear role
|
|
||||||
("You are a senior backend engineer...").
|
|
||||||
- **Tool awareness**: When the prompt targets an agentic model, mention
|
|
||||||
relevant tools (`grep`, `glob`, `read`, `bash`, etc.) so the model uses the
|
|
||||||
right surface.
|
|
||||||
|
|
||||||
## Constraints
|
|
||||||
|
|
||||||
- Do **not** execute the prompt yourself.
|
|
||||||
- Do **not** answer the question inside the prompt.
|
|
||||||
- Do **not** add unnecessary verbosity — prompts should be as short as they
|
|
||||||
can be while remaining complete.
|
|
||||||
- Always preserve the user's original intent.
|
|
||||||
- If the user provides Penpot project context, prefer Penpot-specific
|
|
||||||
vocabulary over generic terms (e.g. name actual modules and `mem:`
|
|
||||||
references instead of "the codebase").
|
|
||||||
|
|
||||||
## Output Format
|
|
||||||
|
|
||||||
Deliver the result in the response as two clearly separated blocks:
|
|
||||||
|
|
||||||
1. **Refined prompt** — a single fenced code block (markdown ```) containing
|
|
||||||
the rewritten prompt, ready to copy and use.
|
|
||||||
2. **What changed (brief)** — a short bulleted list of the most important
|
|
||||||
changes you made and why (3–7 bullets max). Skip the rationale if the
|
|
||||||
changes are trivial.
|
|
||||||
|
|
||||||
If you asked clarifying questions via the `question` tool, stop and wait for
|
|
||||||
the answers before producing a refined prompt. If the `question` tool was not
|
|
||||||
available and you asked the questions in chat, list them in a separate
|
|
||||||
**Clarifying questions** section above the refined prompt and stop — do not
|
|
||||||
produce a refined prompt until the user answers. If the user explicitly told
|
|
||||||
you to proceed without questions (e.g. "just rewrite it"), make reasonable
|
|
||||||
assumptions and note them under **Assumptions made** in the rationale block.
|
|
||||||
|
|
||||||
## File Persistence
|
|
||||||
|
|
||||||
Always persist the refined prompt to disk so it can be re-used later, versioned
|
|
||||||
in git, and shared with other agents. The response still contains the prompt
|
|
||||||
and rationale blocks; the file is an additional artifact, not a replacement.
|
|
||||||
|
|
||||||
- Save the refined prompt (the body inside the fenced code block, **without**
|
|
||||||
the surrounding ``` fences) to `.opencode/prompts/<descriptive-name>.md`.
|
|
||||||
- Use a **kebab-case** filename that summarises the task, e.g.
|
|
||||||
`add-error-reports-management-rpc.md`, `backend-rpc-security-audit.md`. No
|
|
||||||
spaces, no uppercase, no version numbers or dates in the filename.
|
|
||||||
- If `.opencode/prompts/` does not exist, create it before writing.
|
|
||||||
- If a file with the same name already exists, overwrite it (the file is the
|
|
||||||
refined prompt, not a log).
|
|
||||||
- Only skip the file write when the user explicitly opts out (e.g. "don't save
|
|
||||||
this one", "just show it in the chat"). When in doubt, save it.
|
|
||||||
@ -1,47 +0,0 @@
|
|||||||
---
|
|
||||||
name: resolve-git-conflicts
|
|
||||||
description: Conflict resolution flow — understand the local git conflicts, present a resolution plan, and resolve them after the user approves it. Never continues the rebase. Use it when the repo has unresolved conflicts (rebase, merge, cherry-pick) or the user asks to resolve them.
|
|
||||||
---
|
|
||||||
|
|
||||||
# Resolve Git Conflicts
|
|
||||||
|
|
||||||
Resolve conflicts in the local repository. The user handles finishing the
|
|
||||||
rebase themselves — you must **never** run `git rebase --continue`,
|
|
||||||
`git rebase --skip`, `git merge --continue`, or anything similar.
|
|
||||||
|
|
||||||
## When to use
|
|
||||||
|
|
||||||
- The repository has unresolved conflicts — during a rebase, merge, or
|
|
||||||
cherry-pick — whether the user asks about them or not.
|
|
||||||
- The user asks to resolve conflicts, in any phrasing: "fix the merge
|
|
||||||
conflicts", "resolve these", "what's conflicting here?".
|
|
||||||
|
|
||||||
## Phase 1 — Understand the problem (read-only)
|
|
||||||
|
|
||||||
1. Run `git status` to detect the conflict state (rebase, merge, cherry-pick, etc.) and list conflicted files.
|
|
||||||
2. For each conflicted (unmerged) file, understand the situation **without modifying anything**:
|
|
||||||
- Read the file and identify the conflict markers (`<<<<<<<`, `=======`, `>>>>>>>`).
|
|
||||||
- Inspect both sides — `git show <ours>:<file>` and `git show <theirs>:<file>` — plus `git log`/`git show` on the commits involved to understand intent.
|
|
||||||
- Identify what each side changed and why, and how they should be combined.
|
|
||||||
|
|
||||||
## Phase 2 — Present the resolution plan
|
|
||||||
|
|
||||||
3. **Present a clear plan to the user before touching any file.** For each conflicted file, state:
|
|
||||||
- What each side changed and why.
|
|
||||||
- Your proposed resolution and the reasoning behind it.
|
|
||||||
- How the two sides are combined (both additive → merge; both modify the same code → keep the semantically correct version, merging intent from both sides when clear from code and context).
|
|
||||||
4. **Ask the user only when genuinely unclear.** Do not ask about anything you can determine yourself from the code, commit messages, or context. Only decisions that are not determinable and change the outcome (e.g. conflicting product decisions, which side to discard) warrant a question. **Collect all such questions together in an "Open Questions" section at the end of the plan**, so the user has full context to answer them properly.
|
|
||||||
5. **Wait for the user to accept the plan** (and answer any open questions) before editing, staging, or otherwise modifying anything.
|
|
||||||
|
|
||||||
## Phase 3 — Execute
|
|
||||||
|
|
||||||
6. Resolve each conflicted file by editing the file to the agreed merged content and removing all conflict markers.
|
|
||||||
|
|
||||||
## Phase 4 — Stage and verify
|
|
||||||
|
|
||||||
7. **Stage every resolved file** with `git add <file>`. Do not stage unrelated untracked files unless clearly part of the resolution.
|
|
||||||
8. Verify no conflict markers remain (search for `<<<<<<<` / `>>>>>>>` in resolved files) and that `git status` shows no unmerged paths.
|
|
||||||
|
|
||||||
## Phase 5 — Report
|
|
||||||
|
|
||||||
9. Briefly report the conflict state, how each conflicted file was resolved (and any answers received to open questions), and stop — do **not** run `git rebase --continue` or any other continuation command.
|
|
||||||
@ -1,79 +0,0 @@
|
|||||||
---
|
|
||||||
name: review-code
|
|
||||||
description: Code review flow — review a diff, PR, or code change, delegating the review to a subagent that follows the code-review-criteria skill. Use it when the user asks to review code or a PR, in any phrasing.
|
|
||||||
slash: true
|
|
||||||
---
|
|
||||||
|
|
||||||
# Review Code
|
|
||||||
|
|
||||||
Act as a senior software engineer and perform a thorough code review.
|
|
||||||
|
|
||||||
## When to use
|
|
||||||
|
|
||||||
- The user asks to review code, in any phrasing: "review this diff",
|
|
||||||
"review the PR", "check my changes", "code review" — or runs
|
|
||||||
`/review-code`.
|
|
||||||
- A commit, branch, PR, or diff is ready and the user wants it assessed
|
|
||||||
before merge.
|
|
||||||
|
|
||||||
## Instructions
|
|
||||||
|
|
||||||
1. **Determine what is being reviewed** from the user context: a working-tree
|
|
||||||
diff, a commit range, a branch, a PR (number or URL), or specific files. If
|
|
||||||
the target is ambiguous, ask before reviewing.
|
|
||||||
2. Delegate the review to the `general` subagent (via the task tool), unless the
|
|
||||||
user specifies another agent. The prompt carries the **`code-review-criteria`**
|
|
||||||
skill name, all user context, and these requirements:
|
|
||||||
- Load `code-review-criteria` and follow its process and output format.
|
|
||||||
- Read `AGENTS.md` (if present) and the module memories it points to for the
|
|
||||||
code being reviewed.
|
|
||||||
- Return the COMPLETE review, verbatim, exactly as the skill instructs it to
|
|
||||||
be produced. Never summarize it.
|
|
||||||
- Read-only: modify no file and create no commit. Reviewing never writes.
|
|
||||||
- Do not invent problems: every finding must be real and actionable.
|
|
||||||
- Missing tests are an issue, not a suggestion — a severity-tagged finding.
|
|
||||||
- Prioritize by impact: one structural issue outweighs ten nits, and "this
|
|
||||||
could be better" is not a finding — say why and how.
|
|
||||||
- Skip generated files, lockfile-only changes and unrelated modifications
|
|
||||||
unless they introduce security risks.
|
|
||||||
3. When the subagent returns, output the review to the user verbatim. Do not
|
|
||||||
summarize it and do not act on its findings.
|
|
||||||
4. Right after the review, suggest how to proceed based on the findings. These
|
|
||||||
are suggestions — the user decides:
|
|
||||||
- **Approve (no required changes):** say so — there is nothing to address.
|
|
||||||
- **Minor findings (nits):** applying them directly as-is is fine once the
|
|
||||||
review is done — no plan needed.
|
|
||||||
- **Substantive findings:** suggest `/make-a-plan` to make a plan to address
|
|
||||||
them.
|
|
||||||
|
|
||||||
### Hard rule — read-only while reviewing
|
|
||||||
|
|
||||||
This flow is read-only **for the duration of the review**: from the moment it
|
|
||||||
starts until the user considers the review finished (including any feedback,
|
|
||||||
questions, or clarifications about it). During that period, never fix,
|
|
||||||
implement, edit files or create commits — not even "obvious" fixes derived from
|
|
||||||
the findings. Once the user explicitly states the review is done (or moves on to
|
|
||||||
a different task), this rule no longer applies and you act as a normal build
|
|
||||||
agent again.
|
|
||||||
|
|
||||||
## Posting as a GitHub comment
|
|
||||||
|
|
||||||
Post only when the user asks for it explicitly; otherwise keep the review in the
|
|
||||||
session. PR comments go in English, with this minimal structure:
|
|
||||||
|
|
||||||
1. **Intro line** — one sentence: what was found and the overall tone. No
|
|
||||||
greetings.
|
|
||||||
2. **`## Main issues`** — one subsection per required finding: what breaks, the
|
|
||||||
failure circumstances, and the minimal fix (code snippet when useful). A
|
|
||||||
missing test belongs here, not under minor suggestions.
|
|
||||||
3. **`## Minor suggestions`** — one bullet per minor finding: file/function,
|
|
||||||
problem, concrete remedy.
|
|
||||||
4. **Closing** — optional and short. Cut it when it adds nothing.
|
|
||||||
|
|
||||||
Reference every finding by its ID (`R1`, `M1`, `S1`, … from
|
|
||||||
`code-review-criteria`) so follow-up replies can point to findings
|
|
||||||
unambiguously.
|
|
||||||
|
|
||||||
## User input, overrides and additional context
|
|
||||||
|
|
||||||
$ARGUMENTS
|
|
||||||
@ -1,46 +0,0 @@
|
|||||||
---
|
|
||||||
name: review-plan
|
|
||||||
description: Plan review flow — evaluate an implementation plan before it is executed, delegating the review to a subagent that follows the plan-review-criteria skill. Use it when the user asks to review a plan, in any phrasing.
|
|
||||||
slash: true
|
|
||||||
---
|
|
||||||
|
|
||||||
# Review Plan
|
|
||||||
|
|
||||||
Act as a senior software engineer and perform a thorough review of an implementation plan.
|
|
||||||
|
|
||||||
## When to use
|
|
||||||
|
|
||||||
- The user asks to review a plan, in any phrasing: "review this plan", "does this plan look right?", "second opinion on the plan" — or runs `/review-plan`.
|
|
||||||
- A plan was just produced (typically by `/make-a-plan`) and the user wants it evaluated before executing it.
|
|
||||||
|
|
||||||
## Instructions
|
|
||||||
|
|
||||||
1. **Determine the plan under review** from the session context (for example, a plan just produced by `/make-a-plan`) or from a plan file path given by the user (typically under `.agents/plans/`). If a file path is given, read the file first so the complete plan is in context.
|
|
||||||
2. Delegate the review to the `general` subagent (via the task tool), unless the user specifies another agent. Include in the prompt the **`plan-review-criteria`** skill name and all user context.
|
|
||||||
3. When the subagent returns, output the review to the user verbatim. Do not summarize it and do not act on its findings.
|
|
||||||
4. Right after the review, suggest the next step based on the verdict. These are suggestions — the user decides, and any instruction overrides them:
|
|
||||||
- **Approve** → suggest `/implement-plan` to execute it.
|
|
||||||
- **Request changes** → suggest `/make-a-plan` to make a plan to address the findings.
|
|
||||||
|
|
||||||
### Hard rule — read-only while reviewing
|
|
||||||
|
|
||||||
This flow is read-only **for the duration of the review**: from the moment it starts until the user considers the review finished (including any feedback, questions, or clarifications about it). During that period, never fix, implement, edit files or create commits — not even "obvious" fixes derived from the findings. Once the user explicitly states the review is done (or moves on to a different task), this rule no longer applies and you act as a normal build agent again.
|
|
||||||
|
|
||||||
## Instructions for the subagent
|
|
||||||
|
|
||||||
1. Load the **`plan-review-criteria`** skill and follow its process and output format.
|
|
||||||
2. Read `AGENTS.md` (if present) and follow its instructions for finding and reading all related documentation and testing memories before reviewing.
|
|
||||||
3. Cada hallazgo debe tener un identificador único y estable, con el formato `F1`, `F2`, etc. El identificador debe aparecer en el título del hallazgo y no debe reutilizarse dentro de la misma revisión. Esto permite que el usuario pueda responder sobre un hallazgo concreto.
|
|
||||||
4. Return in your final message the COMPLETE review, verbatim, exactly as the skill instructs it to be produced. Do not summarize it — include the full structured review.
|
|
||||||
|
|
||||||
### Strong rules for the subagent
|
|
||||||
|
|
||||||
1. Do not invent problems. Every finding must be real and actionable.
|
|
||||||
2. Read-only: do not modify any file and do not create a commit — reviewing never writes.
|
|
||||||
3. Be specific and constructive. "This could be better" is not helpful — explain why and how.
|
|
||||||
4. Prioritize by impact. One structural issue outweighs ten nits.
|
|
||||||
5. Judge the plan as the implementer would: every task executable without guessing, ordering follows the dependency graph, risks named.
|
|
||||||
|
|
||||||
## User input, overrides and additional context
|
|
||||||
|
|
||||||
$ARGUMENTS
|
|
||||||
@ -1,38 +0,0 @@
|
|||||||
---
|
|
||||||
name: rewrite-commit-message
|
|
||||||
description: Rewrite HEAD's commit message (typically a squash that concatenated old messages) into one proper title plus description following Penpot commit conventions, preserving every distinct AI-assisted-by attribution. Amends in place, never pushes.
|
|
||||||
slash: true
|
|
||||||
---
|
|
||||||
|
|
||||||
# Skill: rewrite-commit-message
|
|
||||||
|
|
||||||
HEAD's message is a concatenation of older messages (typical after a
|
|
||||||
squash): several subjects, bodies and repeated trailers stacked in a
|
|
||||||
single message. Replace it with one proper message and amend HEAD.
|
|
||||||
|
|
||||||
## When to Use
|
|
||||||
|
|
||||||
- The user asks to rewrite, retitle or fix the last commit message
|
|
||||||
- After a squash left HEAD with stacked messages and trailer repeats
|
|
||||||
|
|
||||||
## Steps
|
|
||||||
|
|
||||||
1. Read the full current message (`git log -1 --format=%B HEAD`) and
|
|
||||||
the branch diff (`git diff develop..HEAD --stat`, plus the code
|
|
||||||
when the summary needs grounding).
|
|
||||||
2. Collect every DISTINCT `AI-assisted-by:` value in the current
|
|
||||||
message. All of them survive into the new message, one line each:
|
|
||||||
attributions are never dropped in a rewrite, even when most of
|
|
||||||
the old text is.
|
|
||||||
3. Draft one message per `mem:workflow/creating-commits` (read it
|
|
||||||
end-to-end first): single subject (imperative, capitalized, no
|
|
||||||
trailing period, ≤80 chars), blank line, body wrapped at ≤80
|
|
||||||
chars covering the whole diff (not the old per-commit slices),
|
|
||||||
then the preserved trailers.
|
|
||||||
4. Write it to a file (a heredoc keeps real newlines; inline `-m`
|
|
||||||
with `\n` does not) and `git commit --amend -F <file>`.
|
|
||||||
5. Run `./scripts/check-commit` and require exit code 0. A non-zero
|
|
||||||
exit is a hard blocker: fix the message, amend again.
|
|
||||||
6. Report the new hash. Never push: the user pushes from their own
|
|
||||||
shell. Warn when local history was rewritten over pushed commits
|
|
||||||
(the push will need force — their call, not yours).
|
|
||||||
@ -1,457 +0,0 @@
|
|||||||
---
|
|
||||||
name: security-and-hardening
|
|
||||||
description: Hardens code against vulnerabilities. Use when handling user input, authentication, data storage, or external integrations. Use when building any feature that accepts untrusted data, manages user sessions, or interacts with third-party services.
|
|
||||||
---
|
|
||||||
|
|
||||||
# Security and Hardening
|
|
||||||
|
|
||||||
## Overview
|
|
||||||
|
|
||||||
Security-first development practices for web applications. Treat every external input as hostile, every secret as sacred, and every authorization check as mandatory. Security isn't a phase — it's a constraint on every line of code that touches user data, authentication, or external systems.
|
|
||||||
|
|
||||||
## When to Use
|
|
||||||
|
|
||||||
- Building anything that accepts user input
|
|
||||||
- Implementing authentication or authorization
|
|
||||||
- Storing or transmitting sensitive data
|
|
||||||
- Integrating with external APIs or services
|
|
||||||
- Adding file uploads, webhooks, or callbacks
|
|
||||||
- Handling payment or PII data
|
|
||||||
|
|
||||||
## Process: Threat Model First
|
|
||||||
|
|
||||||
Controls bolted on without a threat model are guesses. Before hardening, spend five minutes thinking like an attacker:
|
|
||||||
|
|
||||||
1. **Map the trust boundaries.** Where does untrusted data cross into your system? HTTP requests, form fields, file uploads, webhooks, third-party APIs, message queues, and **LLM output**. Every boundary is attack surface.
|
|
||||||
2. **Name the assets.** What's worth stealing or breaking? Credentials, PII, payment data, admin actions, money movement.
|
|
||||||
3. **Run STRIDE over each boundary** — a quick lens, not a ceremony:
|
|
||||||
|
|
||||||
| Threat | Ask | Typical mitigation |
|
|
||||||
|---|---|---|
|
|
||||||
| **S**poofing | Can someone impersonate a user/service? | Authentication, signature verification |
|
|
||||||
| **T**ampering | Can data be altered in transit or at rest? | Integrity checks, parameterized queries, HTTPS |
|
|
||||||
| **R**epudiation | Can an action be denied later? | Audit logging of security events |
|
|
||||||
| **I**nformation disclosure | Can data leak? | Encryption, field allowlists, generic errors |
|
|
||||||
| **D**enial of service | Can it be overwhelmed? | Rate limiting, input size caps, timeouts |
|
|
||||||
| **E**levation of privilege | Can a user gain rights they shouldn't? | Authorization checks, least privilege |
|
|
||||||
|
|
||||||
4. **Write abuse cases next to use cases.** For each feature, ask "how would I misuse this?" — then make that your first test.
|
|
||||||
|
|
||||||
If you can't name the trust boundaries for a feature, you're not ready to secure it. This is OWASP **A04: Insecure Design** — most breaches begin in design, not code.
|
|
||||||
|
|
||||||
## The Three-Tier Boundary System
|
|
||||||
|
|
||||||
### Always Do (No Exceptions)
|
|
||||||
|
|
||||||
- **Validate all external input** at the system boundary (API routes, form handlers)
|
|
||||||
- **Parameterize all database queries** — never concatenate user input into SQL
|
|
||||||
- **Encode output** to prevent XSS (use framework auto-escaping, don't bypass it)
|
|
||||||
- **Use HTTPS** for all external communication
|
|
||||||
- **Hash passwords** with bcrypt/scrypt/argon2 (never store plaintext)
|
|
||||||
- **Set security headers** (CSP, HSTS, X-Frame-Options, X-Content-Type-Options)
|
|
||||||
- **Use httpOnly, secure, sameSite cookies** for sessions
|
|
||||||
- **Run `npm audit`** (or equivalent) before every release
|
|
||||||
|
|
||||||
### Ask First (Requires Human Approval)
|
|
||||||
|
|
||||||
- Adding new authentication flows or changing auth logic
|
|
||||||
- Storing new categories of sensitive data (PII, payment info)
|
|
||||||
- Adding new external service integrations
|
|
||||||
- Changing CORS configuration
|
|
||||||
- Adding file upload handlers
|
|
||||||
- Modifying rate limiting or throttling
|
|
||||||
- Granting elevated permissions or roles
|
|
||||||
|
|
||||||
### Never Do
|
|
||||||
|
|
||||||
- **Never commit secrets** to version control (API keys, passwords, tokens)
|
|
||||||
- **Never log sensitive data** (passwords, tokens, full credit card numbers)
|
|
||||||
- **Never trust client-side validation** as a security boundary
|
|
||||||
- **Never disable security headers** for convenience
|
|
||||||
- **Never use `eval()` or `innerHTML`** with user-provided data
|
|
||||||
- **Never store sessions in client-accessible storage** (localStorage for auth tokens)
|
|
||||||
- **Never expose stack traces** or internal error details to users
|
|
||||||
|
|
||||||
## OWASP Top 10 Prevention Patterns
|
|
||||||
|
|
||||||
These are prevention patterns, not a ranking. For the 2021 ordering, see the quick-reference table in `references/security-checklist.md`.
|
|
||||||
|
|
||||||
### Injection (SQL, NoSQL, OS Command)
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
// BAD: SQL injection via string concatenation
|
|
||||||
const query = `SELECT * FROM users WHERE id = '${userId}'`;
|
|
||||||
|
|
||||||
// GOOD: Parameterized query
|
|
||||||
const user = await db.query('SELECT * FROM users WHERE id = $1', [userId]);
|
|
||||||
|
|
||||||
// GOOD: ORM with parameterized input
|
|
||||||
const user = await prisma.user.findUnique({ where: { id: userId } });
|
|
||||||
```
|
|
||||||
|
|
||||||
### Broken Authentication
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
// Password hashing
|
|
||||||
import { hash, compare } from 'bcrypt';
|
|
||||||
|
|
||||||
const SALT_ROUNDS = 12;
|
|
||||||
const hashedPassword = await hash(plaintext, SALT_ROUNDS);
|
|
||||||
const isValid = await compare(plaintext, hashedPassword);
|
|
||||||
|
|
||||||
// Session management
|
|
||||||
app.use(session({
|
|
||||||
secret: process.env.SESSION_SECRET, // From environment, not code
|
|
||||||
resave: false,
|
|
||||||
saveUninitialized: false,
|
|
||||||
cookie: {
|
|
||||||
httpOnly: true, // Not accessible via JavaScript
|
|
||||||
secure: true, // HTTPS only
|
|
||||||
sameSite: 'lax', // CSRF protection
|
|
||||||
maxAge: 24 * 60 * 60 * 1000, // 24 hours
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
```
|
|
||||||
|
|
||||||
### Cross-Site Scripting (XSS)
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
// BAD: Rendering user input as HTML
|
|
||||||
element.innerHTML = userInput;
|
|
||||||
|
|
||||||
// GOOD: Use framework auto-escaping (React does this by default)
|
|
||||||
return <div>{userInput}</div>;
|
|
||||||
|
|
||||||
// If you MUST render HTML, sanitize first
|
|
||||||
import DOMPurify from 'dompurify';
|
|
||||||
const clean = DOMPurify.sanitize(userInput);
|
|
||||||
```
|
|
||||||
|
|
||||||
### Broken Access Control
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
// Always check authorization, not just authentication
|
|
||||||
app.patch('/api/tasks/:id', authenticate, async (req, res) => {
|
|
||||||
const task = await taskService.findById(req.params.id);
|
|
||||||
|
|
||||||
// Check that the authenticated user owns this resource
|
|
||||||
if (task.ownerId !== req.user.id) {
|
|
||||||
return res.status(403).json({
|
|
||||||
error: { code: 'FORBIDDEN', message: 'Not authorized to modify this task' }
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
// Proceed with update
|
|
||||||
const updated = await taskService.update(req.params.id, req.body);
|
|
||||||
return res.json(updated);
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
### Security Misconfiguration
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
// Security headers (use helmet for Express)
|
|
||||||
import helmet from 'helmet';
|
|
||||||
app.use(helmet());
|
|
||||||
|
|
||||||
// Content Security Policy
|
|
||||||
app.use(helmet.contentSecurityPolicy({
|
|
||||||
directives: {
|
|
||||||
defaultSrc: ["'self'"],
|
|
||||||
scriptSrc: ["'self'"],
|
|
||||||
styleSrc: ["'self'", "'unsafe-inline'"], // Tighten if possible
|
|
||||||
imgSrc: ["'self'", 'data:', 'https:'],
|
|
||||||
connectSrc: ["'self'"],
|
|
||||||
},
|
|
||||||
}));
|
|
||||||
|
|
||||||
// CORS — restrict to known origins
|
|
||||||
app.use(cors({
|
|
||||||
origin: process.env.ALLOWED_ORIGINS?.split(',') || 'http://localhost:3000',
|
|
||||||
credentials: true,
|
|
||||||
}));
|
|
||||||
```
|
|
||||||
|
|
||||||
### Sensitive Data Exposure
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
// Never return sensitive fields in API responses
|
|
||||||
function sanitizeUser(user: UserRecord): PublicUser {
|
|
||||||
const { passwordHash, resetToken, ...publicFields } = user;
|
|
||||||
return publicFields;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Use environment variables for secrets
|
|
||||||
const API_KEY = process.env.STRIPE_API_KEY;
|
|
||||||
if (!API_KEY) throw new Error('STRIPE_API_KEY not configured');
|
|
||||||
```
|
|
||||||
|
|
||||||
### Server-Side Request Forgery (SSRF)
|
|
||||||
|
|
||||||
Any time the server fetches a URL the user influenced — webhooks, "import from URL", image proxies, link previews — an attacker can aim it at internal services (cloud metadata, `localhost`, private IPs).
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
// BAD: fetch whatever the user gives you
|
|
||||||
await fetch(req.body.webhookUrl);
|
|
||||||
|
|
||||||
// GOOD: allowlist scheme + host, reject if ANY resolved IP is private, forbid redirects
|
|
||||||
import { lookup } from 'node:dns/promises';
|
|
||||||
import ipaddr from 'ipaddr.js';
|
|
||||||
|
|
||||||
const ALLOWED_HOSTS = new Set(['hooks.example.com']);
|
|
||||||
|
|
||||||
async function assertSafeUrl(raw: string): Promise<URL> {
|
|
||||||
const url = new URL(raw);
|
|
||||||
if (url.protocol !== 'https:') throw new Error('https only');
|
|
||||||
if (!ALLOWED_HOSTS.has(url.hostname)) throw new Error('host not allowed');
|
|
||||||
// Resolve ALL records; a single private/reserved address fails the check.
|
|
||||||
const addrs = await lookup(url.hostname, { all: true });
|
|
||||||
if (addrs.some((a) => ipaddr.parse(a.address).range() !== 'unicast')) {
|
|
||||||
throw new Error('private/reserved IP');
|
|
||||||
}
|
|
||||||
return url;
|
|
||||||
}
|
|
||||||
|
|
||||||
await fetch(await assertSafeUrl(req.body.webhookUrl), { redirect: 'error' });
|
|
||||||
```
|
|
||||||
|
|
||||||
The `range() !== 'unicast'` check covers loopback, link-local `169.254.169.254` (cloud metadata, the #1 SSRF target), private, and unique-local ranges across IPv4 and IPv6.
|
|
||||||
|
|
||||||
**Caveat — this still has a TOCTOU gap.** `fetch` resolves DNS again after the check, so an attacker using a short-TTL record can rebind to an internal IP between validation and connection. For high-risk surfaces, resolve once and connect to the pinned IP, or put a filtering agent in front (`request-filtering-agent` / `ssrf-req-filter`).
|
|
||||||
|
|
||||||
## Input Validation Patterns
|
|
||||||
|
|
||||||
### Schema Validation at Boundaries
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
import { z } from 'zod';
|
|
||||||
|
|
||||||
const CreateTaskSchema = z.object({
|
|
||||||
title: z.string().min(1).max(200).trim(),
|
|
||||||
description: z.string().max(2000).optional(),
|
|
||||||
priority: z.enum(['low', 'medium', 'high']).default('medium'),
|
|
||||||
dueDate: z.string().datetime().optional(),
|
|
||||||
});
|
|
||||||
|
|
||||||
// Validate at the route handler
|
|
||||||
app.post('/api/tasks', async (req, res) => {
|
|
||||||
const result = CreateTaskSchema.safeParse(req.body);
|
|
||||||
if (!result.success) {
|
|
||||||
return res.status(422).json({
|
|
||||||
error: {
|
|
||||||
code: 'VALIDATION_ERROR',
|
|
||||||
message: 'Invalid input',
|
|
||||||
details: result.error.flatten(),
|
|
||||||
},
|
|
||||||
});
|
|
||||||
}
|
|
||||||
// result.data is now typed and validated
|
|
||||||
const task = await taskService.create(result.data);
|
|
||||||
return res.status(201).json(task);
|
|
||||||
});
|
|
||||||
```
|
|
||||||
|
|
||||||
### File Upload Safety
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
// Restrict file types and sizes
|
|
||||||
const ALLOWED_TYPES = ['image/jpeg', 'image/png', 'image/webp'];
|
|
||||||
const MAX_SIZE = 5 * 1024 * 1024; // 5MB
|
|
||||||
|
|
||||||
function validateUpload(file: UploadedFile) {
|
|
||||||
if (!ALLOWED_TYPES.includes(file.mimetype)) {
|
|
||||||
throw new ValidationError('File type not allowed');
|
|
||||||
}
|
|
||||||
if (file.size > MAX_SIZE) {
|
|
||||||
throw new ValidationError('File too large (max 5MB)');
|
|
||||||
}
|
|
||||||
// Don't trust the file extension — check magic bytes if critical
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
## Triaging npm audit Results
|
|
||||||
|
|
||||||
Not all audit findings require immediate action. Use this decision tree:
|
|
||||||
|
|
||||||
```
|
|
||||||
npm audit reports a vulnerability
|
|
||||||
├── Severity: critical or high
|
|
||||||
│ ├── Is the vulnerable code reachable in your app?
|
|
||||||
│ │ ├── YES --> Fix immediately (update, patch, or replace the dependency)
|
|
||||||
│ │ └── NO (dev-only dep, unused code path) --> Fix soon, but not a blocker
|
|
||||||
│ └── Is a fix available?
|
|
||||||
│ ├── YES --> Update to the patched version
|
|
||||||
│ └── NO --> Check for workarounds, consider replacing the dependency, or add to allowlist with a review date
|
|
||||||
├── Severity: moderate
|
|
||||||
│ ├── Reachable in production? --> Fix in the next release cycle
|
|
||||||
│ └── Dev-only? --> Fix when convenient, track in backlog
|
|
||||||
└── Severity: low
|
|
||||||
└── Track and fix during regular dependency updates
|
|
||||||
```
|
|
||||||
|
|
||||||
**Key questions:**
|
|
||||||
- Is the vulnerable function actually called in your code path?
|
|
||||||
- Is the dependency a runtime dependency or dev-only?
|
|
||||||
- Is the vulnerability exploitable given your deployment context (e.g., a server-side vulnerability in a client-only app)?
|
|
||||||
|
|
||||||
When you defer a fix, document the reason and set a review date.
|
|
||||||
|
|
||||||
### Supply-Chain Hygiene
|
|
||||||
|
|
||||||
`npm audit` catches known CVEs; it won't catch a malicious or typosquatted package. Also:
|
|
||||||
|
|
||||||
- **Commit the lockfile** and install with `npm ci` (not `npm install`) in CI — reproducible builds, no silent version drift.
|
|
||||||
- **Review new dependencies before adding them** — maintenance, download counts, and whether they truly earn their place. Every dependency is attack surface (OWASP **A06: Vulnerable Components**, **LLM03: Supply Chain**).
|
|
||||||
- **Be wary of `postinstall` scripts** in unfamiliar packages — they run arbitrary code at install time.
|
|
||||||
- **Watch for typosquats** — `cross-env` vs `crossenv`, `react-dom` vs `reactdom`.
|
|
||||||
|
|
||||||
## Rate Limiting
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
import rateLimit from 'express-rate-limit';
|
|
||||||
|
|
||||||
// General API rate limit
|
|
||||||
app.use('/api/', rateLimit({
|
|
||||||
windowMs: 15 * 60 * 1000, // 15 minutes
|
|
||||||
max: 100, // 100 requests per window
|
|
||||||
standardHeaders: true,
|
|
||||||
legacyHeaders: false,
|
|
||||||
}));
|
|
||||||
|
|
||||||
// Stricter limit for auth endpoints
|
|
||||||
app.use('/api/auth/', rateLimit({
|
|
||||||
windowMs: 15 * 60 * 1000,
|
|
||||||
max: 10, // 10 attempts per 15 minutes
|
|
||||||
}));
|
|
||||||
```
|
|
||||||
|
|
||||||
## Secrets Management
|
|
||||||
|
|
||||||
```
|
|
||||||
.env files:
|
|
||||||
├── .env.example → Committed (template with placeholder values)
|
|
||||||
├── .env → NOT committed (contains real secrets)
|
|
||||||
└── .env.local → NOT committed (local overrides)
|
|
||||||
|
|
||||||
.gitignore must include:
|
|
||||||
.env
|
|
||||||
.env.local
|
|
||||||
.env.*.local
|
|
||||||
*.pem
|
|
||||||
*.key
|
|
||||||
```
|
|
||||||
|
|
||||||
**Always check before committing:**
|
|
||||||
```bash
|
|
||||||
# Check for accidentally staged secrets
|
|
||||||
git diff --cached | grep -i "password\|secret\|api_key\|token"
|
|
||||||
```
|
|
||||||
|
|
||||||
**If a secret is ever committed, rotate it.** Deleting the line or rewriting history is not enough — assume it's compromised the moment it reaches a remote. Revoke and reissue the key first, then purge it from history.
|
|
||||||
|
|
||||||
## Securing AI / LLM Features
|
|
||||||
|
|
||||||
If your app calls an LLM — chatbots, summarizers, agents, RAG — it inherits a new attack surface. Map it to the [OWASP Top 10 for LLM Applications (2025)](https://genai.owasp.org/llm-top-10/):
|
|
||||||
|
|
||||||
- **Treat all model output as untrusted input (LLM05: Improper Output Handling).** Never pass LLM output straight into `eval`, SQL, a shell, `innerHTML`, or a file path. Validate and encode it exactly as you would raw user input.
|
|
||||||
- **Assume prompts can be hijacked (LLM01: Prompt Injection).** Untrusted text in the context window — a user message, a fetched web page, a PDF — can carry instructions. The system prompt is not a security boundary; enforce permissions in code, not in the prompt.
|
|
||||||
- **Keep secrets and other users' data out of prompts (LLM02 / LLM07).** Anything in the context can be echoed back. Don't put API keys, cross-tenant data, or the full system prompt where the model can repeat it.
|
|
||||||
- **Constrain tool and agent permissions (LLM06: Excessive Agency).** Scope tools to the minimum, require confirmation for destructive or irreversible actions, and validate every tool argument.
|
|
||||||
- **Bound consumption (LLM10: Unbounded Consumption).** Cap tokens, request rate, and loop/recursion depth so a crafted input can't run up cost or hang the system.
|
|
||||||
- **Isolate retrieval data (LLM08: Vector and Embedding Weaknesses).** In RAG, treat the vector store as a trust boundary: partition embeddings per tenant so one user can't retrieve another's data, and validate documents before indexing so poisoned content can't steer answers.
|
|
||||||
|
|
||||||
```typescript
|
|
||||||
// BAD: trusting model output as a command or as markup
|
|
||||||
const sql = await llm.generate(`Write SQL for: ${userQuestion}`);
|
|
||||||
await db.query(sql); // arbitrary query execution
|
|
||||||
container.innerHTML = await llm.reply(userMessage); // stored XSS, via the model
|
|
||||||
|
|
||||||
// GOOD: model output is data — parse defensively, then validate, then encode
|
|
||||||
let intent;
|
|
||||||
try {
|
|
||||||
intent = CommandSchema.parse(JSON.parse(await llm.replyJson(userMessage)));
|
|
||||||
} catch {
|
|
||||||
throw new ValidationError('unexpected model output'); // JSON.parse or schema failed
|
|
||||||
}
|
|
||||||
await runAllowlistedAction(intent.action, intent.params);
|
|
||||||
container.textContent = await llm.reply(userMessage);
|
|
||||||
```
|
|
||||||
|
|
||||||
## Security Review Checklist
|
|
||||||
|
|
||||||
```markdown
|
|
||||||
### Authentication
|
|
||||||
- [ ] Passwords hashed with bcrypt/scrypt/argon2 (salt rounds ≥ 12)
|
|
||||||
- [ ] Session tokens are httpOnly, secure, sameSite
|
|
||||||
- [ ] Login has rate limiting
|
|
||||||
- [ ] Password reset tokens expire
|
|
||||||
|
|
||||||
### Authorization
|
|
||||||
- [ ] Every endpoint checks user permissions
|
|
||||||
- [ ] Users can only access their own resources
|
|
||||||
- [ ] Admin actions require admin role verification
|
|
||||||
|
|
||||||
### Input
|
|
||||||
- [ ] All user input validated at the boundary
|
|
||||||
- [ ] SQL queries are parameterized
|
|
||||||
- [ ] HTML output is encoded/escaped
|
|
||||||
- [ ] Server-side URL fetches are allowlisted (no SSRF to internal services)
|
|
||||||
|
|
||||||
### Data
|
|
||||||
- [ ] No secrets in code or version control
|
|
||||||
- [ ] Sensitive fields excluded from API responses
|
|
||||||
- [ ] PII encrypted at rest (if applicable)
|
|
||||||
|
|
||||||
### Infrastructure
|
|
||||||
- [ ] Security headers configured (CSP, HSTS, etc.)
|
|
||||||
- [ ] CORS restricted to known origins
|
|
||||||
- [ ] Dependencies audited for vulnerabilities
|
|
||||||
- [ ] Error messages don't expose internals
|
|
||||||
|
|
||||||
### Supply Chain
|
|
||||||
- [ ] Lockfile committed; CI installs with `npm ci`
|
|
||||||
- [ ] New dependencies reviewed (maintenance, downloads, postinstall scripts)
|
|
||||||
|
|
||||||
### AI / LLM (if used)
|
|
||||||
- [ ] Model output treated as untrusted (no eval/SQL/innerHTML/shell)
|
|
||||||
- [ ] Secrets and other users' data kept out of prompts
|
|
||||||
- [ ] Tool/agent permissions scoped; destructive actions require confirmation
|
|
||||||
```
|
|
||||||
## Common Rationalizations
|
|
||||||
|
|
||||||
| Rationalization | Reality |
|
|
||||||
|---|---|
|
|
||||||
| "This is an internal tool, security doesn't matter" | Internal tools get compromised. Attackers target the weakest link. |
|
|
||||||
| "We'll add security later" | Security retrofitting is 10x harder than building it in. Add it now. |
|
|
||||||
| "No one would try to exploit this" | Automated scanners will find it. Security by obscurity is not security. |
|
|
||||||
| "The framework handles security" | Frameworks provide tools, not guarantees. You still need to use them correctly. |
|
|
||||||
| "It's just a prototype" | Prototypes become production. Security habits from day one. |
|
|
||||||
| "Threat modeling is overkill here" | Five minutes of "how would I attack this?" prevents the design flaws no control can patch later. |
|
|
||||||
| "It's just LLM output, it's only text" | That "text" can be a SQL statement, a script tag, or a shell command. Treat it like any untrusted input. |
|
|
||||||
|
|
||||||
## Red Flags
|
|
||||||
|
|
||||||
- User input passed directly to database queries, shell commands, or HTML rendering
|
|
||||||
- Secrets in source code or commit history
|
|
||||||
- API endpoints without authentication or authorization checks
|
|
||||||
- Missing CORS configuration or wildcard (`*`) origins
|
|
||||||
- No rate limiting on authentication endpoints
|
|
||||||
- Stack traces or internal errors exposed to users
|
|
||||||
- Dependencies with known critical vulnerabilities
|
|
||||||
- Server fetches user-supplied URLs without an allowlist (SSRF)
|
|
||||||
- LLM/model output passed into a query, the DOM, a shell, or `eval`
|
|
||||||
- Secrets, PII, or the full system prompt placed inside an LLM context window
|
|
||||||
|
|
||||||
## Verification
|
|
||||||
|
|
||||||
After implementing security-relevant code:
|
|
||||||
|
|
||||||
- [ ] `npm audit` shows no critical or high vulnerabilities
|
|
||||||
- [ ] No secrets in source code or git history
|
|
||||||
- [ ] All user input validated at system boundaries
|
|
||||||
- [ ] Authentication and authorization checked on every protected endpoint
|
|
||||||
- [ ] Security headers present in response (check with browser DevTools)
|
|
||||||
- [ ] Error responses don't expose internal details
|
|
||||||
- [ ] Rate limiting active on auth endpoints
|
|
||||||
- [ ] Server-side URL fetches validated against an allowlist (no SSRF)
|
|
||||||
- [ ] LLM/model output validated and encoded before use (if AI features present)
|
|
||||||
@ -1,85 +0,0 @@
|
|||||||
---
|
|
||||||
name: ste
|
|
||||||
description: Write or rewrite text in ASD-STE100 Simplified Technical English. ONLY use this skill when the user explicitly invokes it by name — i.e. they type "/ste" or literally write "use the ste skill" / "apply ASD-STE100". Do NOT trigger it on paraphrased intent such as "simplify this", "make it clearer", "write technical documentation", or "shorter sentences please" — the user has deliberately scoped this skill to explicit invocation only. For those requests, respond normally without loading this skill unless they name it.
|
|
||||||
---
|
|
||||||
|
|
||||||
# ASD-STE100 Simplified Technical English
|
|
||||||
|
|
||||||
Apply the ASD-STE100 standard to all prose you produce in this task. Do not announce that you use STE, do not name the standard, and do not explain the style unless the user asks. If the user later asks you to "write more naturally," ask one short question to confirm they want to leave STE before you drop it.
|
|
||||||
|
|
||||||
Compliance note (for you, not for output): the official specification and its dictionary are copyright ASD. This skill encodes paraphrased rules and a publicly sourced word list. For certified aerospace/defense deliverables, tell the user that full compliance requires the free official specification (asd-ste100.org) and a human sign-off. Never claim certified compliance.
|
|
||||||
|
|
||||||
## When to use
|
|
||||||
|
|
||||||
Only when the user explicitly invokes it: they type `/ste`, or say "use
|
|
||||||
the ste skill" / "apply ASD-STE100". Requests like "simplify this",
|
|
||||||
"make it clearer", or "shorter sentences" do NOT invoke it — respond
|
|
||||||
normally unless it is named.
|
|
||||||
|
|
||||||
## Step 0 — Classify the text
|
|
||||||
|
|
||||||
Before writing a single sentence, decide: is this **procedural** text (instructions someone follows) or **descriptive** text (explanation, background, description)? Every limit below depends on this. Mixed documents get classified section by section.
|
|
||||||
|
|
||||||
## Core rules
|
|
||||||
|
|
||||||
### Sentences
|
|
||||||
- Procedural: maximum **20 words** per sentence.
|
|
||||||
- Descriptive: maximum **25 words** per sentence.
|
|
||||||
- Maximum **6 sentences** per paragraph. One topic per paragraph.
|
|
||||||
- One instruction per sentence. Two actions in one sentence only if they occur at the same time.
|
|
||||||
- Put a condition BEFORE its command: "If the pressure decreases, close the valve."
|
|
||||||
- Do not omit articles, subjects, or verbs to save words. "Ensure file exists" is wrong; "Make sure that the file exists" is correct. Keep the word "that" after verbs like "make sure."
|
|
||||||
- Numbers, units with numbers, abbreviations, quoted strings, code identifiers, and proper nouns each count as one word.
|
|
||||||
|
|
||||||
### Verbs
|
|
||||||
- Allowed forms only: infinitive, imperative, simple present, simple past, simple future, and past participle used as an adjective.
|
|
||||||
- Never use present perfect or continuous forms. "We have received" → "We received." "is being tested" → a simple form.
|
|
||||||
- Never use an -ing form as a verb. An -ing word is allowed only inside a technical name ("the mounting bracket," "logging").
|
|
||||||
- Active voice. Passive is allowed only in descriptive text when the agent is unknown or unimportant.
|
|
||||||
- Instructions use the imperative: "Open the panel," not "You must open the panel" or "The panel should be opened."
|
|
||||||
- Express actions as verbs, not nouns: "compress the file," not "perform compression of the file."
|
|
||||||
- Modals: use **can** (possibility), **will** (future), **must** (requirement). Do not use should, would, could, may, might. A hedge becomes a fact or a "can": "an explosion can occur."
|
|
||||||
- No phrasal verbs: "go down" → "decrease," "set up" → "install," "carry out" → "do."
|
|
||||||
|
|
||||||
### Words
|
|
||||||
- One word, one meaning, one part of speech, used consistently. Never rotate synonyms: pick one name for a thing and repeat it.
|
|
||||||
- Before drafting, replace unapproved vocabulary. Read `references/word-substitutions.md` and apply it; it is the working dictionary for this skill.
|
|
||||||
- Domain-specific nouns (part names, tool names, product names, UI labels) and domain verbs (drill, ream, boot, compile) are your **technical nouns/verbs** — keep them as-is, use each consistently, and do not verb a noun or noun a verb.
|
|
||||||
- Noun clusters: maximum **3 words** ("overhead panel light" is the limit). Longer clusters get decomposed with prepositions or hyphenated on first use: "main-gear-door retraction-winch handle."
|
|
||||||
- American English spelling.
|
|
||||||
- No Latin abbreviations: "e.g." → "for example," "i.e." → "that is," delete "etc."
|
|
||||||
|
|
||||||
### Punctuation
|
|
||||||
- No semicolons — write two sentences.
|
|
||||||
- Parentheses only for references, abbreviations, and item numbers.
|
|
||||||
- Hyphenate words that act as one unit; a hyphenated word counts as one word.
|
|
||||||
- No contractions.
|
|
||||||
|
|
||||||
### Warnings, cautions, notes
|
|
||||||
- **WARNING** = risk of injury or death. **CAUTION** = risk of damage. **NOTE** = information only, never an instruction.
|
|
||||||
- Start a warning or caution with the command or condition, then give the risk:
|
|
||||||
"WARNING: Do not touch the terminal. The terminal has a dangerous voltage."
|
|
||||||
- Notes obey the 25-word descriptive limit.
|
|
||||||
|
|
||||||
## Step 2 — Self-check pass
|
|
||||||
|
|
||||||
After drafting, scan your text once for each of these and fix every hit before you respond:
|
|
||||||
|
|
||||||
1. Any sentence over the 20/25-word limit for its type
|
|
||||||
2. Contractions, semicolons
|
|
||||||
3. "should," "would," "could," "may," "might"
|
|
||||||
4. "has been," "have been," "had been," "is being," "was being"
|
|
||||||
5. -ing words used as verbs
|
|
||||||
6. Missing articles (a/an/the/this) before nouns
|
|
||||||
7. Synonym rotation (the same object under two names)
|
|
||||||
8. Any word in the unapproved column of `references/word-substitutions.md`
|
|
||||||
9. Warnings that state the risk before the command
|
|
||||||
|
|
||||||
## Reference files
|
|
||||||
|
|
||||||
- `references/word-substitutions.md` — unapproved → approved word mappings and one-meaning rulings. Read it before drafting; it is short.
|
|
||||||
- `references/examples.md` — worked before/after rewrites (procedural, descriptive, warnings, common mistakes). Read it when rewriting existing text or when unsure how a rule applies.
|
|
||||||
|
|
||||||
## What NOT to touch
|
|
||||||
|
|
||||||
Code blocks, command strings, file paths, error messages, quoted UI text, and proper nouns stay exactly as written. STE applies to the prose around them.
|
|
||||||
@ -1,67 +0,0 @@
|
|||||||
# Worked before/after examples
|
|
||||||
|
|
||||||
## Verb forms
|
|
||||||
|
|
||||||
| Before | After |
|
|
||||||
|---|---|
|
|
||||||
| We have received the technical reports from HQ. | We received the technical reports from HQ. |
|
|
||||||
| This device has been being used at Boeing since 2005. | Boeing started to use this device in 2005. |
|
|
||||||
| The test is continued by the operator. | Continue the test. |
|
|
||||||
| The screws should be replaced. | Replace the screws. |
|
|
||||||
| The system is currently running diagnostics. | The system does diagnostic tests now. |
|
|
||||||
|
|
||||||
## Vocabulary and phrasing
|
|
||||||
|
|
||||||
| Before | After |
|
|
||||||
|---|---|
|
|
||||||
| Ensure file exists before running. | Make sure that the file exists before you run the command. |
|
|
||||||
| Rotate the cover until the jacks are accessible. | Turn the cover until you can get access to the jacks. |
|
|
||||||
| Extend the jack until the wheels are clear of the ground. | Extend the jack until the wheels do not touch the ground. |
|
|
||||||
| Make sure that these steps are followed. | Obey these steps. |
|
|
||||||
| Utilize approximately 3 liters of water. | Use about 3 liters of water. |
|
|
||||||
| Perform a compression of the log files prior to upload. | Compress the log files before you upload them. |
|
|
||||||
|
|
||||||
## Noun clusters
|
|
||||||
|
|
||||||
| Before | After |
|
|
||||||
|---|---|
|
|
||||||
| Main gear door retraction winch handle | Main-gear-door retraction-winch handle |
|
|
||||||
| Runway light connection resistance calibration | Calibration of the resistance of the runway light connection |
|
|
||||||
| Remove the engine transmission housing attachment bolts. | Remove the bolts that attach the transmission housing to the engine. |
|
|
||||||
|
|
||||||
## Procedural rewrite (condition first, one instruction per sentence)
|
|
||||||
|
|
||||||
Before:
|
|
||||||
> You should check that the reservoir has been filled with the correct fluid and, after attaching a clear tube to the bleed screw while ensuring its free end is submerged, the pedal can be pumped and held so that opening the screw releases trapped air.
|
|
||||||
|
|
||||||
After:
|
|
||||||
> 1. Fill the reservoir with the correct fluid.
|
|
||||||
> 2. Attach a clear tube to the bleed screw.
|
|
||||||
> 3. Put the free end of the tube in a container of fluid.
|
|
||||||
> 4. Push the pedal three times. Hold the pedal down.
|
|
||||||
> 5. Open the bleed screw one half turn. Air and fluid flow into the tube.
|
|
||||||
> 6. Close the bleed screw. Release the pedal.
|
|
||||||
> 7. If air continues to come out, do steps 4 thru 6 again.
|
|
||||||
|
|
||||||
## Warnings and cautions (command first, then risk)
|
|
||||||
|
|
||||||
Before:
|
|
||||||
> Note that serious data loss may potentially occur if the --force flag is used against production.
|
|
||||||
|
|
||||||
After:
|
|
||||||
> CAUTION: Do not use the --force flag on the production database. The flag deletes the rows that do not match the source.
|
|
||||||
|
|
||||||
Before:
|
|
||||||
> Touching the terminal could result in electrocution.
|
|
||||||
|
|
||||||
After:
|
|
||||||
> WARNING: Do not touch the terminal. The terminal has a dangerous voltage.
|
|
||||||
|
|
||||||
## Common mistakes checklist
|
|
||||||
|
|
||||||
- Dropped articles: "Insert pin in bracket" → "Insert the pin in the bracket."
|
|
||||||
- Synonym rotation: check/verify/confirm for the same action → one term, everywhere.
|
|
||||||
- Hedges: "you may want to," "it is recommended that" → an imperative or "must."
|
|
||||||
- Instruction buried in a NOTE: notes never instruct. Move the instruction to a numbered step.
|
|
||||||
- Semicolon joining two clauses → two sentences.
|
|
||||||
- "There are three bolts on the panel" → "The panel has three bolts."
|
|
||||||
@ -1,68 +0,0 @@
|
|||||||
# Word substitutions and one-meaning rulings
|
|
||||||
|
|
||||||
Compiled from public secondary sources (STEMG/ASD public pages, TechScribe, Acrolinx, training materials). This is a working approximation, not the official ASD dictionary. When a word is not listed here and feels formal or Latin-derived, prefer the shortest common alternative.
|
|
||||||
|
|
||||||
## Unapproved → approved
|
|
||||||
|
|
||||||
| Do not use | Use instead |
|
|
||||||
|---|---|
|
|
||||||
| utilize, leverage, employ | use |
|
|
||||||
| commence, initiate, begin, originate | start |
|
|
||||||
| terminate, cease, conclude | stop, end |
|
|
||||||
| ensure, verify, confirm, validate, check | make sure (that), examine |
|
|
||||||
| perform, conduct, execute, carry out | do |
|
|
||||||
| facilitate, assist | help |
|
|
||||||
| obtain, acquire, procure | get |
|
|
||||||
| sufficient, adequate | enough |
|
|
||||||
| approximately | about |
|
|
||||||
| prior to | before |
|
|
||||||
| subsequent to, following (prep.) | after |
|
|
||||||
| adjacent to | near |
|
|
||||||
| accomplish | do |
|
|
||||||
| additional, supplementary | more |
|
|
||||||
| attempt | try |
|
|
||||||
| require, necessitate | need, must |
|
|
||||||
| mandatory | necessary |
|
|
||||||
| indicate, signify | show |
|
|
||||||
| observe (=watch) | look at, examine |
|
|
||||||
| rotate | turn |
|
|
||||||
| deactivate | turn off, set to off |
|
|
||||||
| activate, energize (unless technical verb) | turn on, start |
|
|
||||||
| toxic | poisonous |
|
|
||||||
| in order to | to |
|
|
||||||
| via, by means of | through, with |
|
|
||||||
| due to, owing to | because of |
|
|
||||||
| in the event of/that | if |
|
|
||||||
| accessible | (rewrite: "you can get access to") |
|
|
||||||
| remainder | rest |
|
|
||||||
| demonstrate | show |
|
|
||||||
| modify, alter | change |
|
|
||||||
| construct, fabricate, build | assemble, make |
|
|
||||||
| retain | keep |
|
|
||||||
| locate (=find) | find |
|
|
||||||
| depress (a button) | push, press |
|
|
||||||
| proceed | continue, go |
|
|
||||||
|
|
||||||
## One meaning, one part of speech (canonical rulings)
|
|
||||||
|
|
||||||
- **close** — verb only: to move to a position that stops flow, or to operate a circuit breaker. The adjective is unapproved → use **near** ("do not go near the propeller").
|
|
||||||
- **test** — noun only: "do a test," never "test the system."
|
|
||||||
- **check** — do not use as a verb for verification → "make sure that" or "examine."
|
|
||||||
- **follow** — means only "come after." For rules and steps use **obey**: "Obey the safety instructions."
|
|
||||||
- **fall** — means only "move down by gravity." For quantities use **decrease**. Never the season.
|
|
||||||
- **oil** — noun only. "Oil the bearing" → "Put oil on the bearing" / "Lubricate the bearing."
|
|
||||||
- **right** — direction only, never "correct."
|
|
||||||
- **clear** — "without blockage." "Wheels are clear of the ground" → "wheels do not touch the ground."
|
|
||||||
- **help** — verb only; the noun is **aid** ("with the aid of a mirror").
|
|
||||||
- **above / below** — physical position only. For quantities: **more than / less than**.
|
|
||||||
- **about** — two approved senses: "approximately" and "on the subject of." Use carefully.
|
|
||||||
- **turn** — the general verb for rotation; "turn on / turn off" for power state is standard.
|
|
||||||
- **level** — approved as noun and adjective (documented exception to the one-POS rule).
|
|
||||||
|
|
||||||
## Frequent-offender function words
|
|
||||||
|
|
||||||
- **should / would / could / may / might** — never. Requirement → **must**. Possibility → **can**. Future → **will**.
|
|
||||||
- **etc.** — delete, or write the full list.
|
|
||||||
- **e.g. / i.e.** — "for example" / "that is."
|
|
||||||
- **any / appropriate / applicable / relevant** as hedges — replace with the specific thing meant.
|
|
||||||
- **there is / there are** openers — rewrite with a real subject: "There are three bolts on the panel" → "The panel has three bolts."
|
|
||||||
@ -1,58 +0,0 @@
|
|||||||
---
|
|
||||||
name: testing
|
|
||||||
description: Enforce TDD workflow and testing best practices for Penpot. Use when implementing features, fixing bugs, or modifying behavior. Reads testing memory for full guidance.
|
|
||||||
---
|
|
||||||
|
|
||||||
# Testing Skill
|
|
||||||
|
|
||||||
Enforces test-driven development and Penpot testing conventions.
|
|
||||||
|
|
||||||
## When to Use
|
|
||||||
|
|
||||||
- Implementing new logic or behavior
|
|
||||||
- Fixing any bug (reproduction test required)
|
|
||||||
- Modifying existing functionality
|
|
||||||
- Adding edge case handling
|
|
||||||
|
|
||||||
**Skip:** Pure configuration changes, documentation updates, or static content with no behavioral impact.
|
|
||||||
|
|
||||||
## Workflow
|
|
||||||
|
|
||||||
Follow TDD (Red → Green → Refactor) whenever practical:
|
|
||||||
|
|
||||||
1. **RED** — Write a failing test first
|
|
||||||
2. **GREEN** — Write minimal code to pass
|
|
||||||
3. **REFACTOR** — Clean up while tests stay green
|
|
||||||
|
|
||||||
For bug fixes, use the Prove-It Pattern: write a test that reproduces the bug, confirm it fails, implement the fix, confirm it passes.
|
|
||||||
|
|
||||||
## Required Reading
|
|
||||||
|
|
||||||
Before writing any test, read:
|
|
||||||
|
|
||||||
1. `.serena/memories/testing.md` — cross-cutting testing principles, TDD workflow, anti-patterns, execution discipline
|
|
||||||
2. Module-specific testing memory for the affected module:
|
|
||||||
- `mem:common/testing` — CLJC unit tests
|
|
||||||
- `mem:frontend/testing` — CLJS unit tests, Playwright E2E
|
|
||||||
- `mem:backend/testing` — JVM clojure.test conventions
|
|
||||||
- `mem:exporter/testing` — exporter unit tests
|
|
||||||
|
|
||||||
## Key Rules
|
|
||||||
|
|
||||||
- Every behavior change needs a test
|
|
||||||
- Test state, not interactions
|
|
||||||
- DAMP over DRY — tests are specifications; duplication is OK if each test is self-contained and readable
|
|
||||||
- Prefer Real > Fake > Stub > Mock
|
|
||||||
- Arrange-Act-Assert structure
|
|
||||||
- One assertion per concept
|
|
||||||
- Never pipe test output to filters — redirect to file first
|
|
||||||
- Register new test files in the module's runner/entrypoint
|
|
||||||
|
|
||||||
## Verification
|
|
||||||
|
|
||||||
After completing implementation:
|
|
||||||
|
|
||||||
- [ ] Every new behavior has a test
|
|
||||||
- [ ] All tests pass for touched modules
|
|
||||||
- [ ] Bug fixes include a reproduction test
|
|
||||||
- [ ] Lint/formatter passes
|
|
||||||
@ -1,61 +0,0 @@
|
|||||||
---
|
|
||||||
name: update-changelog
|
|
||||||
description: Update the project CHANGES.md with issues from a given GitHub milestone, with correct categorization and references.
|
|
||||||
---
|
|
||||||
|
|
||||||
# Skill: update-changelog
|
|
||||||
|
|
||||||
Entry point for all changelog work. All rules — sections, exclusions, entry
|
|
||||||
format, the `:boom:`, `:rocket:` and `:lock:` contracts, pre-flight, and the
|
|
||||||
anomaly report — live in `mem:workflow/updating-changelog` (file:
|
|
||||||
`.serena/memories/workflow/updating-changelog.md`). This skill routes to that
|
|
||||||
memory; it does not repeat it.
|
|
||||||
|
|
||||||
## When to Use
|
|
||||||
|
|
||||||
- Before a new release, to populate the changelog with all fixed issues
|
|
||||||
- When new issues are added to an existing milestone and the changelog needs
|
|
||||||
to be refreshed
|
|
||||||
- To audit or repair an existing version section
|
|
||||||
|
|
||||||
## Prerequisites
|
|
||||||
|
|
||||||
- `gh` CLI authenticated (`gh auth status`)
|
|
||||||
- Python 3.8+
|
|
||||||
- `scripts/gh.py` for GitHub queries, `scripts/changelog.py` for changelog
|
|
||||||
checks (run `python3 scripts/changelog.py <command> --help` for usage)
|
|
||||||
|
|
||||||
## What to Read
|
|
||||||
|
|
||||||
1. `mem:workflow/updating-changelog` — the canonical flow: sources of truth,
|
|
||||||
layout, entry rules, the `## Breaking change note` comment contract, the
|
|
||||||
advisory (`:lock:`) contract, pre-flight checks, anomaly types, and pitfalls.
|
|
||||||
2. `mem:scripts/changelog` — `boom`, `security`, `check-merged`, `cross-ref`,
|
|
||||||
`dev-only-bugs`, `report`.
|
|
||||||
3. `mem:scripts/gh` — `issues`, `issue`, `comments`, `prs`, `advisories`.
|
|
||||||
|
|
||||||
## Commands
|
|
||||||
|
|
||||||
```bash
|
|
||||||
python3 scripts/gh.py issues "<VERSION>" --exclude "no changelog"
|
|
||||||
python3 scripts/gh.py issues "<VERSION>" --label "release blocker" --exclude "no changelog" # closed non-bug residue to review by hand
|
|
||||||
python3 scripts/gh.py advisories --patched-version "<VERSION>"
|
|
||||||
python3 scripts/changelog.py dev-only-bugs "<VERSION>" # list bugs that never reached production
|
|
||||||
python3 scripts/changelog.py dev-only-bugs "<VERSION>" --apply # label the sure ones `no changelog`
|
|
||||||
python3 scripts/changelog.py check-merged <PR numbers...>
|
|
||||||
python3 scripts/changelog.py boom "<VERSION>" # print the :boom: section
|
|
||||||
python3 scripts/changelog.py boom "<VERSION>" --write # replace it in CHANGES.md
|
|
||||||
python3 scripts/changelog.py security "<VERSION>" # print the :lock: section
|
|
||||||
python3 scripts/changelog.py security "<VERSION>" --write # replace it in CHANGES.md
|
|
||||||
python3 scripts/changelog.py cross-ref "<VERSION>"
|
|
||||||
python3 scripts/changelog.py report "<VERSION>"
|
|
||||||
```
|
|
||||||
|
|
||||||
## Hard Rules
|
|
||||||
|
|
||||||
- `CHANGES.md` is edited only on explicit request or during the release process.
|
|
||||||
- Only closed, non-excluded milestone issues are included; the issue is the changelog unit and the PR is inline.
|
|
||||||
- `:boom:` and `:rocket:` are label-generated and `:lock:` is advisory-generated: never hand-edit them; edit the label, the `## Breaking change note` comment or the advisory and re-run the command.
|
|
||||||
- Verify PR merge status before writing; only merged PRs are referenced.
|
|
||||||
- Bugs that never reached production stay out: `dev-only-bugs --apply` labels the sure ones; candidates are the user's call, never label them yourself.
|
|
||||||
- Fill `patched_versions` in the advisories before running `security`; unpublished advisories are valid.
|
|
||||||
@ -9,8 +9,7 @@
|
|||||||
app.common.data.macros/get-in clojure.core/get-in
|
app.common.data.macros/get-in clojure.core/get-in
|
||||||
app.common.data.macros/with-open clojure.core/with-open
|
app.common.data.macros/with-open clojure.core/with-open
|
||||||
app.common.data.macros/select-keys clojure.core/select-keys
|
app.common.data.macros/select-keys clojure.core/select-keys
|
||||||
app.common.logging/with-context clojure.core/do
|
app.common.logging/with-context clojure.core/do}
|
||||||
benches.render-wasm.errors/attempt clojure.core/do}
|
|
||||||
|
|
||||||
:hooks
|
:hooks
|
||||||
{:analyze-call
|
{:analyze-call
|
||||||
@ -23,13 +22,7 @@
|
|||||||
rumext.v2/defc hooks.export/rumext-defc
|
rumext.v2/defc hooks.export/rumext-defc
|
||||||
rumext.v2/lazy-component hooks.export/rumext-lazycomponent
|
rumext.v2/lazy-component hooks.export/rumext-lazycomponent
|
||||||
shadow.lazy/loadable hooks.export/rumext-lazycomponent
|
shadow.lazy/loadable hooks.export/rumext-lazycomponent
|
||||||
app.util.i18n/tr hooks.i18n/tr-dynamic
|
}}
|
||||||
app.common.i18n/tr hooks.i18n/tr-dynamic
|
|
||||||
benches.render-wasm.declarations/defscene hooks.benches/defscene
|
|
||||||
benches.render-wasm.declarations/defcase hooks.benches/defcase
|
|
||||||
benches.render-wasm.runtime.commands/defcommand hooks.benches/defcommand
|
|
||||||
benches.render-wasm.runtime.protocol/resolve-or-reject hooks.benches/resolve-or-reject
|
|
||||||
benches.render-wasm.runtime.protocol/resolve-or-reject-with hooks.benches/resolve-or-reject-with}}
|
|
||||||
|
|
||||||
:output
|
:output
|
||||||
{:exclude-files
|
{:exclude-files
|
||||||
@ -41,7 +34,7 @@
|
|||||||
"^(?:backend|frontend|exporter|common)/deps.edn"
|
"^(?:backend|frontend|exporter|common)/deps.edn"
|
||||||
"^(?:backend|frontend|exporter|common)/scripts/"
|
"^(?:backend|frontend|exporter|common)/scripts/"
|
||||||
"^(?:backend|frontend|exporter|common)/dev/"
|
"^(?:backend|frontend|exporter|common)/dev/"
|
||||||
"^(?:backend|frontend|exporter|common)/test/(?!performance_tests/)"]
|
"^(?:backend|frontend|exporter|common)/test/"]
|
||||||
|
|
||||||
:linter-name true}
|
:linter-name true}
|
||||||
|
|
||||||
@ -52,9 +45,6 @@
|
|||||||
:potok/reify-type
|
:potok/reify-type
|
||||||
{:level :error}
|
{:level :error}
|
||||||
|
|
||||||
:penpot/tr-dynamic
|
|
||||||
{:level :warning}
|
|
||||||
|
|
||||||
:redundant-primitive-coercion
|
:redundant-primitive-coercion
|
||||||
{:level :off}
|
{:level :off}
|
||||||
|
|
||||||
@ -98,12 +88,11 @@
|
|||||||
:dynamic-var-not-earmuffed
|
:dynamic-var-not-earmuffed
|
||||||
{:level :off}
|
{:level :off}
|
||||||
|
|
||||||
:type-mismatch
|
|
||||||
{:level :off}
|
|
||||||
|
|
||||||
:used-underscored-binding
|
:used-underscored-binding
|
||||||
{:level :warning}
|
{:level :warning}
|
||||||
|
|
||||||
:unused-binding
|
:unused-binding
|
||||||
{:exclude-destructured-as true
|
{:exclude-destructured-as true
|
||||||
:exclude-destructured-keys-in-fn-args false}}}
|
:exclude-destructured-keys-in-fn-args false
|
||||||
|
}
|
||||||
|
}}
|
||||||
|
|||||||
@ -1,77 +0,0 @@
|
|||||||
;; This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
||||||
;;
|
|
||||||
;; Copyright (c) KALEIDOS SUBSIDIARY SL
|
|
||||||
|
|
||||||
(ns hooks.benches
|
|
||||||
(:require [clj-kondo.hooks-api :as api]))
|
|
||||||
|
|
||||||
(defn defscene
|
|
||||||
"Analyzes scene options and its compiled builder body."
|
|
||||||
[{:keys [node]}]
|
|
||||||
(let [[_ _ opts argv & body] (:children node)]
|
|
||||||
(if (and argv (api/vector-node? argv))
|
|
||||||
{:node (api/list-node [(api/token-node (quote do)) opts
|
|
||||||
(api/list-node (into [(api/token-node (quote fn)) argv] body))])}
|
|
||||||
{:node node})))
|
|
||||||
|
|
||||||
(defn defcase
|
|
||||||
"Analyzes case options and its compiled operation body."
|
|
||||||
[{:keys [node]}]
|
|
||||||
(let [[_ _ opts argv & body] (:children node)]
|
|
||||||
(if (and (seq body) argv (api/vector-node? argv))
|
|
||||||
{:node (api/list-node [(api/token-node (quote do)) opts
|
|
||||||
(api/list-node (into [(api/token-node (quote fn)) argv] body))])}
|
|
||||||
{:node node})))
|
|
||||||
|
|
||||||
(defn defcommand
|
|
||||||
"Analyzes command options and both generated functions."
|
|
||||||
[{:keys [node]}]
|
|
||||||
(let [[_ command & forms] (:children node)
|
|
||||||
[doc forms] (if (string? (api/sexpr (first forms)))
|
|
||||||
[(first forms) (next forms)]
|
|
||||||
[nil forms])
|
|
||||||
[options forms] (if (api/map-node? (first forms))
|
|
||||||
[(first forms) (next forms)]
|
|
||||||
[nil forms])
|
|
||||||
[argv & body] forms
|
|
||||||
[conditions body] (if (and (api/map-node? (first body)) (next body))
|
|
||||||
[(first body) (next body)]
|
|
||||||
[nil body])
|
|
||||||
handlers (:async (some-> options api/sexpr))
|
|
||||||
core (api/list-node
|
|
||||||
(into [(api/token-node 'fn)
|
|
||||||
(api/vector-node (mapv api/token-node handlers))]
|
|
||||||
body))
|
|
||||||
starred (api/token-node (symbol (str (api/sexpr command) "*")))
|
|
||||||
measured (get (some-> options api/sexpr) :measured-variant true)
|
|
||||||
definition (api/list-node
|
|
||||||
(into [(api/token-node 'defn) command]
|
|
||||||
(concat (when doc [doc]) [argv]
|
|
||||||
(when conditions [conditions]) [core])))]
|
|
||||||
{:node (api/list-node
|
|
||||||
(into [(api/token-node 'do)]
|
|
||||||
(concat (when options [(api/coerce (dissoc (api/sexpr options) :async))])
|
|
||||||
[definition]
|
|
||||||
(when measured
|
|
||||||
[(api/list-node [(api/token-node 'def)
|
|
||||||
starred command])]))))}))
|
|
||||||
|
|
||||||
(defn resolve-or-reject
|
|
||||||
"Analyzes the body of a Promise-returning form."
|
|
||||||
[{:keys [node]}]
|
|
||||||
(let [[_ & body] (:children node)]
|
|
||||||
{:node (api/list-node (into [(api/token-node (quote do))] body))}))
|
|
||||||
|
|
||||||
(defn resolve-or-reject-with
|
|
||||||
"Analyzes the cause handler and body. Binds `cause` in the handler only."
|
|
||||||
[{:keys [node]}]
|
|
||||||
(let [[_ cause on-error & body] (:children node)]
|
|
||||||
{:node (api/list-node
|
|
||||||
(into [(api/token-node (quote do))
|
|
||||||
(api/list-node
|
|
||||||
[(api/token-node (quote let))
|
|
||||||
(api/vector-node [cause (api/token-node nil)])
|
|
||||||
on-error])]
|
|
||||||
body))}))
|
|
||||||
@ -1,9 +1,3 @@
|
|||||||
;; This Source Code Form is subject to the terms of the Mozilla Public
|
|
||||||
;; License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
||||||
;; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
||||||
;;
|
|
||||||
;; Copyright (c) KALEIDOS SUBSIDIARY SL
|
|
||||||
|
|
||||||
(ns hooks.export
|
(ns hooks.export
|
||||||
(:require [clj-kondo.hooks-api :as api]))
|
(:require [clj-kondo.hooks-api :as api]))
|
||||||
|
|
||||||
|
|||||||
@ -1,17 +0,0 @@
|
|||||||
(ns hooks.i18n
|
|
||||||
(:require [clj-kondo.hooks-api :as api]))
|
|
||||||
|
|
||||||
(defn tr-dynamic
|
|
||||||
[{:keys [:node]}]
|
|
||||||
(let [[_ code & _] (:children node)]
|
|
||||||
(when (and (some? code)
|
|
||||||
(not (api/string-node? code)))
|
|
||||||
(let [{:keys [:row :col :end-row :end-col]} (meta code)]
|
|
||||||
(api/reg-finding! {:message "dynamic key in (tr ...) is invisible to rehash; use a string literal or declare it with ;; (tr \"key\")"
|
|
||||||
:type :penpot/tr-dynamic
|
|
||||||
:row row
|
|
||||||
:col col
|
|
||||||
;; end positions are required for #_:clj-kondo/ignore to match
|
|
||||||
:end-row end-row
|
|
||||||
:end-col end-col}))))
|
|
||||||
{:node node})
|
|
||||||
@ -10,7 +10,5 @@
|
|||||||
:extra-indents {rumext.v2/fnc [[:inner 0]]
|
:extra-indents {rumext.v2/fnc [[:inner 0]]
|
||||||
cljs.test/async [[:inner 0]]
|
cljs.test/async [[:inner 0]]
|
||||||
promesa.exec/thread [[:inner 0]]
|
promesa.exec/thread [[:inner 0]]
|
||||||
specify! [[:inner 0] [:inner 1]]
|
specify! [[:inner 0] [:inner 1]]}
|
||||||
benches.render-wasm.runtime.commands/defcommand [[:inner 0]]
|
|
||||||
benches.render-wasm.runtime.protocol/resolve-or-reject-with [[:inner 0]]}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -52,7 +52,7 @@ built fresh from `shared/codex.toml` + `templates/codex.toml` at launch.
|
|||||||
`manage.sh`.
|
`manage.sh`.
|
||||||
* **`mcp/`** (Claude Code, opencode) is the result of merging `shared/` with
|
* **`mcp/`** (Claude Code, opencode) is the result of merging `shared/` with
|
||||||
the port-substituted `templates/`. `manage.sh` writes these on every
|
the port-substituted `templates/`. `manage.sh` writes these on every
|
||||||
`run-devenv --agentic` pass. Gitignored, dedicated paths with no developer
|
`run-devenv-agentic` pass. Gitignored, dedicated paths with no developer
|
||||||
content — never edit by hand, your edits will be overwritten on the next
|
content — never edit by hand, your edits will be overwritten on the next
|
||||||
reconcile.
|
reconcile.
|
||||||
* **`.vscode/mcp.json`** is the same merge, but written to the path VS Code
|
* **`.vscode/mcp.json`** is the same merge, but written to the path VS Code
|
||||||
@ -85,10 +85,6 @@ target instance is running and its MCP config has been generated:
|
|||||||
# 'main', 'ws1' and similar spellings are rejected.
|
# 'main', 'ws1' and similar spellings are rejected.
|
||||||
./manage.sh start-coding-agent claude --ws 1
|
./manage.sh start-coding-agent claude --ws 1
|
||||||
./manage.sh start-coding-agent opencode --ws 2
|
./manage.sh start-coding-agent opencode --ws 2
|
||||||
|
|
||||||
# Run a different executable (e.g. a wrapper script) with the same MCP
|
|
||||||
# wiring. --ws and --bin may come in any order.
|
|
||||||
./manage.sh start-coding-agent claude --bin claude-alt
|
|
||||||
```
|
```
|
||||||
|
|
||||||
Equivalents by hand (run from inside the workspace directory):
|
Equivalents by hand (run from inside the workspace directory):
|
||||||
|
|||||||
@ -1,3 +0,0 @@
|
|||||||
# Penpot API configuration for error-reports CLI tool
|
|
||||||
PENPOT_API_URI=http://localhost:3450
|
|
||||||
PENPOT_ACCESS_TOKEN=your-access-token-here
|
|
||||||
9
.github/CODEOWNERS
vendored
9
.github/CODEOWNERS
vendored
@ -1,9 +0,0 @@
|
|||||||
# Changes to workflows, CI configuration and repository automation need
|
|
||||||
# review from the ci-maintainers team. Issue and PR templates do not.
|
|
||||||
/.github/workflows/ @penpot/ci-maintainers
|
|
||||||
/.github/actions/ @penpot/ci-maintainers
|
|
||||||
/.github/scripts/ @penpot/ci-maintainers
|
|
||||||
/.github/dependabot.yml @penpot/ci-maintainers
|
|
||||||
/.github/zizmor.yml @penpot/ci-maintainers
|
|
||||||
/.github/actionlint.yaml @penpot/ci-maintainers
|
|
||||||
/.github/CODEOWNERS @penpot/ci-maintainers
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
description: An unexpected problem or behavior
|
description: Create a report to help us improve
|
||||||
labels: ["needs triage"]
|
name: Bug report
|
||||||
name: Bug
|
|
||||||
type: Bug
|
type: Bug
|
||||||
|
labels: ["needs triage"]
|
||||||
|
|
||||||
body:
|
body:
|
||||||
- type: markdown
|
- type: markdown
|
||||||
@ -15,7 +15,7 @@ body:
|
|||||||
- type: textarea
|
- type: textarea
|
||||||
attributes:
|
attributes:
|
||||||
label: Steps To Reproduce
|
label: Steps To Reproduce
|
||||||
description: Steps to reproduce the behavior
|
description: Steps to reproduce the behavior.
|
||||||
placeholder: |
|
placeholder: |
|
||||||
Steps to reproduce the behavior:
|
Steps to reproduce the behavior:
|
||||||
1. Go to '...'
|
1. Go to '...'
|
||||||
@ -26,22 +26,22 @@ body:
|
|||||||
- type: textarea
|
- type: textarea
|
||||||
id: expected
|
id: expected
|
||||||
attributes:
|
attributes:
|
||||||
|
description: A clear and concise description of what you expected to happen.
|
||||||
label: Expected behavior
|
label: Expected behavior
|
||||||
description: A clear and concise description of what you expected to happen
|
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: actual
|
id: actual
|
||||||
attributes:
|
attributes:
|
||||||
|
description: A clear and concise description of what happens instead; what the bug is.
|
||||||
label: Actual behavior
|
label: Actual behavior
|
||||||
description: A clear and concise description of what happens instead; what the bug is
|
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: screenshots
|
id: screenshots
|
||||||
attributes:
|
attributes:
|
||||||
|
description: If applicable, add screenshots to help explain your problem.
|
||||||
label: Screenshots or video
|
label: Screenshots or video
|
||||||
description: If applicable, add screenshots to help explain your problem
|
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: desktop
|
id: desktop
|
||||||
attributes:
|
attributes:
|
||||||
@ -87,4 +87,4 @@ body:
|
|||||||
id: additional-context
|
id: additional-context
|
||||||
attributes:
|
attributes:
|
||||||
label: Additional context
|
label: Additional context
|
||||||
description: Add any other context or screenshots about the bug here
|
description: Any other context about the problem.
|
||||||
2
.github/ISSUE_TEMPLATE/config.yml
vendored
2
.github/ISSUE_TEMPLATE/config.yml
vendored
@ -1 +1 @@
|
|||||||
blank_issues_enabled: false
|
blank_issues_enabled: true
|
||||||
|
|||||||
38
.github/ISSUE_TEMPLATE/enhancement.yml
vendored
38
.github/ISSUE_TEMPLATE/enhancement.yml
vendored
@ -1,38 +0,0 @@
|
|||||||
description: Improvement to existing behavior
|
|
||||||
labels: ["needs triage"]
|
|
||||||
name: "Enhancement"
|
|
||||||
type: Enhancement
|
|
||||||
|
|
||||||
body:
|
|
||||||
- type: markdown
|
|
||||||
attributes:
|
|
||||||
value: |
|
|
||||||
## Before you start
|
|
||||||
|
|
||||||
Please search our [existing issues](https://github.com/penpot/penpot/issues) and open [pull requests](https://github.com/penpot/penpot/pulls) to lessen the change of filing duplicate issues or feature requests. Thank you.
|
|
||||||
|
|
||||||
---
|
|
||||||
- type: textarea
|
|
||||||
id: problem
|
|
||||||
attributes:
|
|
||||||
label: Is your feature request related to a problem? Please describe
|
|
||||||
description: A clear and concise description of what the problem is. Ex. I'm always frustrated when (...)
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: solution
|
|
||||||
attributes:
|
|
||||||
label: Describe the solution you'd like
|
|
||||||
description: A clear and concise description of what you want to happen
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: alternatives
|
|
||||||
attributes:
|
|
||||||
label: Describe alternatives you've considered
|
|
||||||
description: A clear and concise description of any alternative solutions or features you've considered
|
|
||||||
- type: textarea
|
|
||||||
id: additional-context
|
|
||||||
attributes:
|
|
||||||
label: Additional context
|
|
||||||
description: Add any other context or screenshots about the enhancement here
|
|
||||||
26
.github/ISSUE_TEMPLATE/epic.yml
vendored
26
.github/ISSUE_TEMPLATE/epic.yml
vendored
@ -1,26 +0,0 @@
|
|||||||
description: An epic is a large user story that cannot be delivered as defined within a single iteration
|
|
||||||
labels: ["needs triage"]
|
|
||||||
name: "EPIC"
|
|
||||||
type: EPIC
|
|
||||||
|
|
||||||
body:
|
|
||||||
- type: markdown
|
|
||||||
attributes:
|
|
||||||
value: |
|
|
||||||
## Before you start
|
|
||||||
|
|
||||||
Please search our [existing issues](https://github.com/penpot/penpot/issues) and open [pull requests](https://github.com/penpot/penpot/pulls) to lessen the change of filing duplicate issues or feature requests. Thank you.
|
|
||||||
|
|
||||||
---
|
|
||||||
- type: textarea
|
|
||||||
id: description
|
|
||||||
attributes:
|
|
||||||
label: Epic description
|
|
||||||
description: Tell us which epic feature do you want to discuss
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: additional-context
|
|
||||||
attributes:
|
|
||||||
label: Additional context
|
|
||||||
description: Add any other context or screenshots about the feature request here
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
description: Suggest an idea for this project
|
description: Suggest an idea for this project.
|
||||||
labels: ["needs triage"]
|
labels: ["needs triage"]
|
||||||
name: "Feature request"
|
name: "Feature request"
|
||||||
type: Feature
|
type: Enhancement
|
||||||
|
|
||||||
body:
|
body:
|
||||||
- type: markdown
|
- type: markdown
|
||||||
@ -15,24 +15,24 @@ body:
|
|||||||
- type: textarea
|
- type: textarea
|
||||||
id: problem
|
id: problem
|
||||||
attributes:
|
attributes:
|
||||||
label: Is your feature request related to a problem? Please describe
|
|
||||||
description: A clear and concise description of what the problem is. Ex. I'm always frustrated when (...)
|
description: A clear and concise description of what the problem is. Ex. I'm always frustrated when (...)
|
||||||
|
label: Is your feature request related to a problem? Please describe.
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: solution
|
id: solution
|
||||||
attributes:
|
attributes:
|
||||||
label: Describe the solution you'd like
|
description: A clear and concise description of what you want to happen.
|
||||||
description: A clear and concise description of what you want to happen
|
label: Describe the solution you'd like.
|
||||||
validations:
|
validations:
|
||||||
required: true
|
required: true
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: alternatives
|
id: alternatives
|
||||||
attributes:
|
attributes:
|
||||||
label: Describe alternatives you've considered
|
label: Describe alternatives you've considered.
|
||||||
description: A clear and concise description of any alternative solutions or features you've considered
|
description: A clear and concise description of any alternative solutions or features you've considered.
|
||||||
- type: textarea
|
- type: textarea
|
||||||
id: additional-context
|
id: additional-context
|
||||||
attributes:
|
attributes:
|
||||||
label: Additional context
|
label: Additional context
|
||||||
description: Add any other context or screenshots about the feature request here
|
description: Add any other context or screenshots about the feature request here.
|
||||||
26
.github/ISSUE_TEMPLATE/task.yml
vendored
26
.github/ISSUE_TEMPLATE/task.yml
vendored
@ -1,26 +0,0 @@
|
|||||||
description: A specific piece of work
|
|
||||||
labels: []
|
|
||||||
name: "Task"
|
|
||||||
type: Task
|
|
||||||
|
|
||||||
body:
|
|
||||||
- type: markdown
|
|
||||||
attributes:
|
|
||||||
value: |
|
|
||||||
## Before you start
|
|
||||||
|
|
||||||
Please search our [existing issues](https://github.com/penpot/penpot/issues) and open [pull requests](https://github.com/penpot/penpot/pulls) to lessen the change of filing duplicate issues or feature requests. Thank you.
|
|
||||||
|
|
||||||
---
|
|
||||||
- type: textarea
|
|
||||||
id: task
|
|
||||||
attributes:
|
|
||||||
description: A clear and concise description of the task
|
|
||||||
label: Please describe
|
|
||||||
validations:
|
|
||||||
required: true
|
|
||||||
- type: textarea
|
|
||||||
id: additional-context
|
|
||||||
attributes:
|
|
||||||
label: Additional context
|
|
||||||
description: Add any other context or screenshots about the task here
|
|
||||||
14
.github/actionlint.yaml
vendored
14
.github/actionlint.yaml
vendored
@ -1,14 +0,0 @@
|
|||||||
# actionlint configuration — https://github.com/rhysd/actionlint/blob/main/docs/config.md
|
|
||||||
self-hosted-runner:
|
|
||||||
labels:
|
|
||||||
- penpot-standar-runner
|
|
||||||
- penpot-extended-runner
|
|
||||||
|
|
||||||
paths:
|
|
||||||
.github/workflows/**/*.{yml,yaml}:
|
|
||||||
ignore:
|
|
||||||
# shellcheck style/info notices that are pervasive in the existing
|
|
||||||
# scripts (unquoted `>> $GITHUB_OUTPUT`, repeated redirects). Real
|
|
||||||
# shellcheck warnings and errors are still reported.
|
|
||||||
- 'SC2086:info'
|
|
||||||
- 'SC2129:style'
|
|
||||||
41
.github/scripts/playwright-summary.jq
vendored
41
.github/scripts/playwright-summary.jq
vendored
@ -1,41 +0,0 @@
|
|||||||
def specs: [.. | objects | select(has("tests") and has("file"))];
|
|
||||||
def dur: [.tests[].results[]?.duration // 0] | add;
|
|
||||||
|
|
||||||
specs as $s
|
|
||||||
| ($s | map(select(any(.tests[]; .status == "unexpected")))) as $failed
|
|
||||||
| ($s | map(select(any(.tests[]; .status == "flaky")))) as $flaky
|
|
||||||
| ($s | map(select(any(.tests[]; .status == "skipped")))) as $skipped
|
|
||||||
| ($s | length) as $total
|
|
||||||
| ($s | map(dur) | add // 0 | . / 1000 | floor) as $cpu
|
|
||||||
| (if ($failed | length) > 0 then "❌"
|
|
||||||
elif ($flaky | length) > 0 then "⚠️"
|
|
||||||
else "✅" end) as $icon
|
|
||||||
|
|
||||||
| "## \($icon) Integration tests\n\n"
|
|
||||||
+ "| Total | Passed | Flaky | Failed | Skipped | Test time |\n"
|
|
||||||
+ "|---|---|---|---|---|---|\n"
|
|
||||||
+ "| \($total) | \($total - ($failed|length) - ($flaky|length) - ($skipped|length)) "
|
|
||||||
+ "| \($flaky|length) | \($failed|length) | \($skipped|length) | \($cpu / 60 | floor)m |\n"
|
|
||||||
|
|
||||||
+ (if ($failed | length) > 0 then
|
|
||||||
"\n### Failed\n\n"
|
|
||||||
+ ($failed | map("- `\(.file):\(.line)` — \(.title)") | join("\n")) + "\n"
|
|
||||||
else "" end)
|
|
||||||
|
|
||||||
+ (if ($flaky | length) > 0 then
|
|
||||||
"\n### Flaky (passed on retry)\n\n"
|
|
||||||
+ ($flaky
|
|
||||||
| map({ t: "`\(.file):\(.line)` — \(.title)",
|
|
||||||
r: ([.tests[].results[]? | select(.status == "failed")] | length) })
|
|
||||||
| sort_by(-.r)
|
|
||||||
| map("- \(.t) _(\(.r) \(if .r == 1 then "retry" else "retries" end))_")
|
|
||||||
| join("\n")) + "\n"
|
|
||||||
else "" end)
|
|
||||||
|
|
||||||
+ (if $total > 0 then
|
|
||||||
"\n<details><summary>Slowest specs</summary>\n\n"
|
|
||||||
+ ($s | map({ t: "`\(.file)` — \(.title)", d: (dur / 1000 | floor) })
|
|
||||||
| sort_by(-.d) | .[0:5]
|
|
||||||
| map("- \(.t) — \(.d)s") | join("\n"))
|
|
||||||
+ "\n\n</details>\n"
|
|
||||||
else "" end)
|
|
||||||
249
.github/workflows/auto-label.yml
vendored
249
.github/workflows/auto-label.yml
vendored
@ -1,249 +0,0 @@
|
|||||||
name: Auto Label and Add to Project
|
|
||||||
|
|
||||||
# pull_request_target is required so the GitHub App secrets are available
|
|
||||||
# for PRs from forks. It is safe here: the job never checks out or runs PR
|
|
||||||
# code, it only reads ids from the event payload.
|
|
||||||
on:
|
|
||||||
issues:
|
|
||||||
types: [opened, closed]
|
|
||||||
pull_request_target:
|
|
||||||
types: [opened]
|
|
||||||
|
|
||||||
permissions: {}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
triage:
|
|
||||||
# The Renovate Dependency Dashboard and Renovate's GitHub Actions PRs do
|
|
||||||
# not need triage. Other Renovate PRs (base images, Node.js, pnpm) do.
|
|
||||||
if: >-
|
|
||||||
!(github.event_name == 'issues'
|
|
||||||
&& github.event.issue.user.login == 'penpot-renovate[bot]')
|
|
||||||
&& !(github.event_name == 'pull_request_target'
|
|
||||||
&& github.event.pull_request.user.login == 'penpot-renovate[bot]'
|
|
||||||
&& github.event.pull_request.head.ref == 'renovate-github-actions')
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Generate GitHub App token
|
|
||||||
id: triage-app-token
|
|
||||||
uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0
|
|
||||||
with:
|
|
||||||
client-id: ${{ secrets.TRIAGE_APP_CLIENT_ID }}
|
|
||||||
private-key: ${{ secrets.TRIAGE_APP_PRIVATE_KEY }}
|
|
||||||
# No owner/repositories: the token is scoped to this repository.
|
|
||||||
# Organization permissions (the project board) still apply.
|
|
||||||
permission-issues: write
|
|
||||||
permission-pull-requests: write
|
|
||||||
permission-organization-projects: write
|
|
||||||
|
|
||||||
- name: Process Issue or PR
|
|
||||||
uses: actions/github-script@3a2844b7e9c422d3c10d287c895573f7108da1b3 # v9.0.0
|
|
||||||
with:
|
|
||||||
github-token: ${{ steps.triage-app-token.outputs.token }}
|
|
||||||
script: |
|
|
||||||
// === 1. CONFIGURATION ===
|
|
||||||
const PROJECT_NUMBER = 8; // <--- Replace with your project board number
|
|
||||||
const IS_ORG = true; // <--- Set to false if this is a personal project, true if an organization
|
|
||||||
const STATUS_FIELD_ID = 'PVTSSF_lADOAcyBPM4BV2pqzhRPY48';
|
|
||||||
const STATUS_BACKLOG = 'f75ad846';
|
|
||||||
const STATUS_TECH_REVIEW = 'b0f45db9';
|
|
||||||
const OWNER = context.repo.owner;
|
|
||||||
const REPO = context.repo.repo;
|
|
||||||
|
|
||||||
const issueNumber = context.issue.number;
|
|
||||||
const isPR = !!context.payload.pull_request;
|
|
||||||
const contentId = isPR ? context.payload.pull_request.node_id : context.payload.issue.node_id;
|
|
||||||
|
|
||||||
// A completed issue is already closed by GitHub. Route its Main
|
|
||||||
// project status according to whether QA needs to verify it.
|
|
||||||
if (context.eventName === 'issues' && context.payload.action === 'closed') {
|
|
||||||
const issue = context.payload.issue;
|
|
||||||
if (issue.state_reason !== 'completed') {
|
|
||||||
console.log(`Issue #${issue.number} was closed as ${issue.state_reason}; leaving project status unchanged.`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const targetStatus = issue.labels.some(({ name }) => name === 'team-qa')
|
|
||||||
? 'Ready for QA'
|
|
||||||
: 'Product Review';
|
|
||||||
|
|
||||||
const projectQuery = `
|
|
||||||
query($owner: String!, $number: Int!) {
|
|
||||||
organization(login: $owner) {
|
|
||||||
projectV2(number: $number) {
|
|
||||||
id
|
|
||||||
fields(first: 100) {
|
|
||||||
nodes {
|
|
||||||
... on ProjectV2SingleSelectField {
|
|
||||||
id
|
|
||||||
name
|
|
||||||
options { id name }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
const projectRes = await github.graphql(projectQuery, {
|
|
||||||
owner: OWNER,
|
|
||||||
number: PROJECT_NUMBER
|
|
||||||
});
|
|
||||||
const project = projectRes.organization.projectV2;
|
|
||||||
if (!project) {
|
|
||||||
throw new Error(`Could not find Main project #${PROJECT_NUMBER}.`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const statusField = project.fields.nodes.find(({ name }) => name === 'Status');
|
|
||||||
const statusOption = statusField?.options.find(({ name }) => name === targetStatus);
|
|
||||||
if (!statusField || !statusOption) {
|
|
||||||
throw new Error(`Could not find Status option "${targetStatus}" in Main.`);
|
|
||||||
}
|
|
||||||
|
|
||||||
const issueProjectItemsQuery = `
|
|
||||||
query($issueId: ID!) {
|
|
||||||
node(id: $issueId) {
|
|
||||||
... on Issue {
|
|
||||||
projectItems(first: 100) {
|
|
||||||
nodes {
|
|
||||||
id
|
|
||||||
project { id }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
const issueProjectItemsRes = await github.graphql(issueProjectItemsQuery, {
|
|
||||||
issueId: contentId
|
|
||||||
});
|
|
||||||
const projectItems = issueProjectItemsRes.node?.projectItems?.nodes || [];
|
|
||||||
const projectItem = projectItems.find(
|
|
||||||
({ project: itemProject }) => itemProject.id === project.id
|
|
||||||
);
|
|
||||||
if (!projectItem) {
|
|
||||||
console.log(`Issue #${issue.number} is not in Main project #${PROJECT_NUMBER}; skipping status update.`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const updateStatusMutation = `
|
|
||||||
mutation($projectId: ID!, $itemId: ID!, $fieldId: ID!, $optionId: String!) {
|
|
||||||
updateProjectV2ItemFieldValue(input: {
|
|
||||||
projectId: $projectId
|
|
||||||
itemId: $itemId
|
|
||||||
fieldId: $fieldId
|
|
||||||
value: { singleSelectOptionId: $optionId }
|
|
||||||
}) {
|
|
||||||
projectV2Item { id }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
await github.graphql(updateStatusMutation, {
|
|
||||||
projectId: project.id,
|
|
||||||
itemId: projectItem.id,
|
|
||||||
fieldId: statusField.id,
|
|
||||||
optionId: statusOption.id
|
|
||||||
});
|
|
||||||
console.log(`Issue #${issue.number} closed; Main status set to "${targetStatus}".`);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Define your labels here
|
|
||||||
const labelToApply = 'needs triage';
|
|
||||||
|
|
||||||
// === 2. APPLY THE LABEL ===
|
|
||||||
console.log(`Applying label "${labelToApply}" to ${isPR ? 'PR' : 'Issue'} #${issueNumber}...`);
|
|
||||||
await github.rest.issues.addLabels({
|
|
||||||
issue_number: issueNumber,
|
|
||||||
owner: OWNER,
|
|
||||||
repo: REPO,
|
|
||||||
labels: [labelToApply]
|
|
||||||
});
|
|
||||||
|
|
||||||
// === 3. ADD TO PROJECT BOARD ===
|
|
||||||
console.log(`Fetching Project #${PROJECT_NUMBER} ID...`);
|
|
||||||
const projectQuery = `
|
|
||||||
query($owner: String!, $number: Int!) {
|
|
||||||
${IS_ORG ? 'organization' : 'user'}(login: $owner) {
|
|
||||||
projectV2(number: $number) {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
const projectRes = await github.graphql(projectQuery, { owner: OWNER, number: PROJECT_NUMBER });
|
|
||||||
const projectId = IS_ORG ? projectRes.organization.projectV2.id : projectRes.user.projectV2.id;
|
|
||||||
|
|
||||||
console.log(`Adding item to project board...`);
|
|
||||||
const addToProjectMutation = `
|
|
||||||
mutation($projectId: ID!, $contentId: ID!) {
|
|
||||||
addProjectV2ItemById(input: {projectId: $projectId, contentId: $contentId}) {
|
|
||||||
item {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
`;
|
|
||||||
|
|
||||||
let itemId;
|
|
||||||
try {
|
|
||||||
const addRes = await github.graphql(addToProjectMutation, { projectId, contentId });
|
|
||||||
itemId = addRes.addProjectV2ItemById.item.id;
|
|
||||||
} catch (error) {
|
|
||||||
const messages = [
|
|
||||||
error && error.message,
|
|
||||||
...(Array.isArray(error && error.errors)
|
|
||||||
? error.errors.map(e => e && e.message)
|
|
||||||
: [])
|
|
||||||
].filter(Boolean).join('\n');
|
|
||||||
if (!messages.includes('Content already exists in this project')) {
|
|
||||||
throw error;
|
|
||||||
}
|
|
||||||
console.log('Item already in project, fetching existing item...');
|
|
||||||
const existing = await github.graphql(
|
|
||||||
`query($contentId: ID!) {
|
|
||||||
node(id: $contentId) {
|
|
||||||
... on Issue {
|
|
||||||
projectItems(first: 50) {
|
|
||||||
nodes { id project { id } }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
... on PullRequest {
|
|
||||||
projectItems(first: 50) {
|
|
||||||
nodes { id project { id } }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}`,
|
|
||||||
{ contentId }
|
|
||||||
);
|
|
||||||
const nodes = (existing.node && existing.node.projectItems && existing.node.projectItems.nodes) || [];
|
|
||||||
const match = nodes.find(n => n.project.id === projectId);
|
|
||||||
if (!match) {
|
|
||||||
throw new Error(`Item already in a project, but not found in project ${projectId}`);
|
|
||||||
}
|
|
||||||
itemId = match.id;
|
|
||||||
}
|
|
||||||
|
|
||||||
// === 4. SET PROJECT STATUS ===
|
|
||||||
const statusOptionId = isPR ? STATUS_TECH_REVIEW : STATUS_BACKLOG;
|
|
||||||
const statusName = isPR ? 'Tech Review' : 'Backlog';
|
|
||||||
console.log(`Setting status to "${statusName}" for ${isPR ? 'PR' : 'Issue'} #${issueNumber}...`);
|
|
||||||
await github.graphql(
|
|
||||||
`mutation($projectId: ID!, $itemId: ID!, $fieldId: ID!, $optionId: String!) {
|
|
||||||
updateProjectV2ItemFieldValue(input: {
|
|
||||||
projectId: $projectId,
|
|
||||||
itemId: $itemId,
|
|
||||||
fieldId: $fieldId,
|
|
||||||
value: { singleSelectOptionId: $optionId }
|
|
||||||
}) {
|
|
||||||
projectV2Item {
|
|
||||||
id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}`,
|
|
||||||
{ projectId, itemId, fieldId: STATUS_FIELD_ID, optionId: statusOptionId }
|
|
||||||
);
|
|
||||||
|
|
||||||
console.log("Automation successfully completed!");
|
|
||||||
|
|
||||||
69
.github/workflows/build-adhoc.yml
vendored
69
.github/workflows/build-adhoc.yml
vendored
@ -1,69 +0,0 @@
|
|||||||
name: _ADHOC
|
|
||||||
|
|
||||||
run-name: >-
|
|
||||||
_ADHOC (${{ inputs.gh_ref }}${{ inputs.nitrate_ref != '' && format(' / nitrate:{0}', inputs.nitrate_ref) || '' }})
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
gh_ref:
|
|
||||||
description: 'Branch/ref to build in penpot/penpot'
|
|
||||||
type: string
|
|
||||||
required: true
|
|
||||||
nitrate_ref:
|
|
||||||
description: 'Branch/ref to build admin-console in penpot/penpot-nitrate (defaults to gh_ref)'
|
|
||||||
type: string
|
|
||||||
required: false
|
|
||||||
force:
|
|
||||||
description: 'Rebuild and overwrite even if already built/promoted'
|
|
||||||
type: boolean
|
|
||||||
required: false
|
|
||||||
default: false
|
|
||||||
|
|
||||||
permissions: {}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-bundle:
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
uses: ./.github/workflows/build-bundle.yml
|
|
||||||
secrets:
|
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
||||||
AWS_REGION: ${{ secrets.AWS_REGION }}
|
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
||||||
MATTERMOST_WEBHOOK: ${{ secrets.MATTERMOST_WEBHOOK }}
|
|
||||||
S3_BUCKET: ${{ secrets.S3_BUCKET }}
|
|
||||||
with:
|
|
||||||
gh_ref: ${{ inputs.gh_ref }}
|
|
||||||
force: ${{ inputs.force }}
|
|
||||||
|
|
||||||
build-docker:
|
|
||||||
needs: build-bundle
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
uses: ./.github/workflows/build-docker.yml
|
|
||||||
secrets:
|
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
||||||
AWS_REGION: ${{ secrets.AWS_REGION }}
|
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
||||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
|
|
||||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
MATTERMOST_WEBHOOK: ${{ secrets.MATTERMOST_WEBHOOK }}
|
|
||||||
PUB_DOCKER_PASSWORD: ${{ secrets.PUB_DOCKER_PASSWORD }}
|
|
||||||
PUB_DOCKER_USERNAME: ${{ secrets.PUB_DOCKER_USERNAME }}
|
|
||||||
S3_BUCKET: ${{ secrets.S3_BUCKET }}
|
|
||||||
with:
|
|
||||||
gh_ref: ${{ inputs.gh_ref }}
|
|
||||||
# Pin build-docker to the commit build-bundle actually bundled.
|
|
||||||
sha: ${{ needs.build-bundle.outputs.sha }}
|
|
||||||
force: ${{ inputs.force }}
|
|
||||||
|
|
||||||
build-docker-admin-console:
|
|
||||||
permissions: {}
|
|
||||||
uses: ./.github/workflows/build-docker-admin-console.yml
|
|
||||||
secrets:
|
|
||||||
ORG_WORKFLOW_TOKEN: ${{ secrets.ORG_WORKFLOW_TOKEN }}
|
|
||||||
with:
|
|
||||||
gh_ref: ${{ inputs.nitrate_ref || inputs.gh_ref }}
|
|
||||||
force: ${{ inputs.force }}
|
|
||||||
194
.github/workflows/build-bundle.yml
vendored
194
.github/workflows/build-bundle.yml
vendored
@ -9,153 +9,60 @@ on:
|
|||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
default: 'develop'
|
default: 'develop'
|
||||||
force:
|
build_wasm:
|
||||||
description: 'Rebuild and overwrite even if this version already exists in S3'
|
description: 'BUILD_WASM. Valid values: yes, no'
|
||||||
type: boolean
|
type: string
|
||||||
required: false
|
required: false
|
||||||
default: false
|
default: 'yes'
|
||||||
|
build_storybook:
|
||||||
|
description: 'BUILD_STORYBOOK. Valid values: yes, no'
|
||||||
|
type: string
|
||||||
|
required: false
|
||||||
|
default: 'yes'
|
||||||
workflow_call:
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
gh_ref:
|
gh_ref:
|
||||||
description: 'Name of the branch or ref'
|
description: 'Name of the branch or ref'
|
||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
force:
|
default: 'develop'
|
||||||
description: 'Rebuild and overwrite even if this version already exists in S3'
|
build_wasm:
|
||||||
type: boolean
|
description: 'BUILD_WASM. Valid values: yes, no'
|
||||||
|
type: string
|
||||||
required: false
|
required: false
|
||||||
default: false
|
default: 'yes'
|
||||||
outputs:
|
build_storybook:
|
||||||
sha:
|
description: 'BUILD_STORYBOOK. Valid values: yes, no'
|
||||||
description: 'Bundled commit, full 40-char SHA.'
|
type: string
|
||||||
value: ${{ jobs.check.outputs.sha }}
|
|
||||||
secrets:
|
|
||||||
AWS_ACCESS_KEY_ID:
|
|
||||||
required: false
|
required: false
|
||||||
AWS_REGION:
|
default: 'yes'
|
||||||
required: false
|
|
||||||
AWS_SECRET_ACCESS_KEY:
|
|
||||||
required: false
|
|
||||||
MATTERMOST_WEBHOOK:
|
|
||||||
required: false
|
|
||||||
S3_BUCKET:
|
|
||||||
required: false
|
|
||||||
|
|
||||||
# Literal group name: under `workflow_call`, `github.workflow` resolves to the
|
|
||||||
# caller's workflow, which put this workflow and the other reusable one called
|
|
||||||
# by the same caller into a single shared group, and left a manual dispatch of
|
|
||||||
# the same ref in a group of its own, free to race on the same artifacts.
|
|
||||||
concurrency:
|
|
||||||
group: build-bundle-${{ inputs.gh_ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# ── 1. Decide whether there is anything to build ───────────────────────
|
build-bundle:
|
||||||
check:
|
name: Build and Upload Penpot Bundle
|
||||||
name: Check current bundle
|
runs-on: penpot-runner-01
|
||||||
runs-on: penpot-standar-runner
|
env:
|
||||||
timeout-minutes: 10
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||||
outputs:
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
gh_ref: ${{ steps.vars.outputs.gh_ref }}
|
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}
|
||||||
bundle_version: ${{ steps.vars.outputs.bundle_version }}
|
|
||||||
build_key: ${{ steps.vars.outputs.build_key }}
|
|
||||||
short_sha: ${{ steps.vars.outputs.short_sha }}
|
|
||||||
sha: ${{ steps.vars.outputs.sha }}
|
|
||||||
commit_title: ${{ steps.vars.outputs.commit_title }}
|
|
||||||
exists: ${{ steps.check.outputs.exists }}
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
ref: ${{ inputs.gh_ref }}
|
ref: ${{ inputs.gh_ref }}
|
||||||
|
|
||||||
- name: Extract some useful variables
|
- name: Extract some useful variables
|
||||||
id: vars
|
id: vars
|
||||||
env:
|
|
||||||
GH_REF: ${{ inputs.gh_ref || github.ref_name }}
|
|
||||||
run: |
|
run: |
|
||||||
# Same command the build uses to stamp version.txt.
|
echo "gh_ref=${{ inputs.gh_ref || github.ref_name }}" >> $GITHUB_OUTPUT
|
||||||
BUNDLE_VERSION=$(./manage.sh version)
|
echo "bundle_version=$(git describe --tags --always)" >> $GITHUB_OUTPUT
|
||||||
SHORT_SHA=$(git rev-parse --short=12 HEAD)
|
|
||||||
# The key takes only the closest tag (--abbrev=0): the sha already
|
|
||||||
# pins the commit, and the full describe output is not stable
|
|
||||||
# across checkouts (its -g<sha> suffix length depends on the
|
|
||||||
# local object count). Must match build-docker.yml.
|
|
||||||
VERSION_TAG=$(git describe --tags --match '*.*.*' --abbrev=0)
|
|
||||||
echo "gh_ref=$GH_REF" >> $GITHUB_OUTPUT
|
|
||||||
echo "bundle_version=$BUNDLE_VERSION" >> $GITHUB_OUTPUT
|
|
||||||
echo "build_key=sha-${SHORT_SHA}-${VERSION_TAG}" >> $GITHUB_OUTPUT
|
|
||||||
echo "short_sha=$SHORT_SHA" >> $GITHUB_OUTPUT
|
|
||||||
echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
|
|
||||||
echo "commit_title=$(git log -1 --pretty=%s)" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
# Keyed by commit sha AND version, same as build-docker.yml's marker
|
|
||||||
# check, so both pipelines agree on what "already built" means. The
|
|
||||||
# version is stamped into the bundle, so a new tag on an already
|
|
||||||
# bundled commit (2.18.1-RC1 -> 2.18.1) must produce a new bundle.
|
|
||||||
# `force` bypasses this check entirely.
|
|
||||||
- name: Check if this bundle is already built
|
|
||||||
id: check
|
|
||||||
env:
|
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
||||||
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}
|
|
||||||
S3_BUCKET: ${{ secrets.S3_BUCKET }}
|
|
||||||
FORCE: ${{ inputs.force }}
|
|
||||||
BUILD_KEY: ${{ steps.vars.outputs.build_key }}
|
|
||||||
run: |
|
|
||||||
if [ "$FORCE" = "true" ]; then
|
|
||||||
echo "exists=false" >> $GITHUB_OUTPUT
|
|
||||||
{
|
|
||||||
echo "### 🔁 Bundle build forced"
|
|
||||||
echo ""
|
|
||||||
echo "\`force: true\` — skipping the S3 sha check."
|
|
||||||
} >> "$GITHUB_STEP_SUMMARY"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
BUNDLE_EXISTS=$(aws s3api head-object \
|
|
||||||
--bucket "$S3_BUCKET" \
|
|
||||||
--key "penpot-${BUILD_KEY}.zip" \
|
|
||||||
> /dev/null 2>&1 && echo "true" || echo "false")
|
|
||||||
|
|
||||||
if [ "$BUNDLE_EXISTS" = "true" ]; then
|
|
||||||
echo "exists=true" >> $GITHUB_OUTPUT
|
|
||||||
{
|
|
||||||
echo "### ⏭️ Bundle build skipped"
|
|
||||||
echo ""
|
|
||||||
echo "The bundle in S3 was already built for \`${BUILD_KEY}\`."
|
|
||||||
} >> "$GITHUB_STEP_SUMMARY"
|
|
||||||
else
|
|
||||||
echo "exists=false" >> $GITHUB_OUTPUT
|
|
||||||
fi
|
|
||||||
|
|
||||||
# ── 2. Build and upload, only when needed ──────────────────────────────
|
|
||||||
build:
|
|
||||||
name: Build and Upload Penpot Bundle
|
|
||||||
runs-on: penpot-standar-runner
|
|
||||||
timeout-minutes: 90
|
|
||||||
needs: check
|
|
||||||
if: needs.check.outputs.exists == 'false'
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
fetch-depth: 0
|
|
||||||
ref: ${{ inputs.gh_ref }}
|
|
||||||
|
|
||||||
- name: Build bundle
|
- name: Build bundle
|
||||||
env:
|
env:
|
||||||
BUILD_WASM: 'yes'
|
BUILD_WASM: ${{ inputs.build_wasm }}
|
||||||
BUILD_STORYBOOK: 'yes'
|
BUILD_STORYBOOK: ${{ inputs.build_storybook }}
|
||||||
run: ./manage.sh build-bundle
|
run: ./manage.sh build-bundle
|
||||||
|
|
||||||
- name: Prepare directories for zipping
|
- name: Prepare directories for zipping
|
||||||
@ -169,49 +76,18 @@ jobs:
|
|||||||
zip -r zips/penpot.zip penpot
|
zip -r zips/penpot.zip penpot
|
||||||
|
|
||||||
- name: Upload Penpot bundle to S3
|
- name: Upload Penpot bundle to S3
|
||||||
env:
|
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
||||||
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}
|
|
||||||
S3_BUCKET: ${{ secrets.S3_BUCKET }}
|
|
||||||
BUILD_KEY: ${{ needs.check.outputs.build_key }}
|
|
||||||
BUNDLE_VERSION: ${{ needs.check.outputs.bundle_version }}
|
|
||||||
run: |
|
run: |
|
||||||
aws s3 cp zips/penpot.zip \
|
aws s3 cp zips/penpot.zip s3://${{ secrets.S3_BUCKET }}/penpot-${{ steps.vars.outputs.gh_ref }}.zip --metadata bundle-version=${{ steps.vars.outputs.bundle_version }}
|
||||||
"s3://${S3_BUCKET}/penpot-${BUILD_KEY}.zip" \
|
|
||||||
--metadata "bundle-version=${BUNDLE_VERSION}"
|
|
||||||
|
|
||||||
- name: Write step summary
|
|
||||||
env:
|
|
||||||
SHORT_SHA: ${{ needs.check.outputs.short_sha }}
|
|
||||||
BUNDLE_VERSION: ${{ needs.check.outputs.bundle_version }}
|
|
||||||
COMMIT_TITLE: ${{ needs.check.outputs.commit_title }}
|
|
||||||
run: |
|
|
||||||
{
|
|
||||||
echo "### ✅ Bundle built"
|
|
||||||
echo ""
|
|
||||||
echo "- Version: \`${BUNDLE_VERSION}\` (\`./manage.sh version\`)"
|
|
||||||
echo "- Commit: [\`${SHORT_SHA}\`](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commit/${SHORT_SHA}) — ${COMMIT_TITLE}"
|
|
||||||
echo "- Built at: $(date -u +'%Y-%m-%d %H:%M:%S UTC')"
|
|
||||||
} >> "$GITHUB_STEP_SUMMARY"
|
|
||||||
|
|
||||||
# ── 3. Single failure notification for the whole workflow ─────────────
|
|
||||||
notify:
|
|
||||||
name: Notify failure
|
|
||||||
runs-on: penpot-standar-runner
|
|
||||||
timeout-minutes: 5
|
|
||||||
needs: [check, build]
|
|
||||||
if: failure()
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Notify Mattermost
|
- name: Notify Mattermost
|
||||||
uses: mattermost/action-mattermost-notify@ae31bb6f9e26a54336e79696f108a2c91cf55b4e # v2.1.0
|
if: failure()
|
||||||
|
uses: mattermost/action-mattermost-notify@master
|
||||||
with:
|
with:
|
||||||
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK }}
|
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK }}
|
||||||
MATTERMOST_CHANNEL: bot-alerts-cicd
|
MATTERMOST_CHANNEL: bot-alerts-cicd
|
||||||
TEXT: |
|
TEXT: |
|
||||||
❌ 📦 *[PENPOT] Error building penpot bundles.*
|
❌ 📦 *[PENPOT] Error building penpot bundles.*
|
||||||
📄 Triggered from ref: `${{ needs.check.outputs.gh_ref || inputs.gh_ref }}`
|
📄 Triggered from ref: `${{ steps.vars.outputs.gh_ref }}`
|
||||||
Bundle version: `${{ needs.check.outputs.bundle_version || 'n/a' }}`
|
Bundle version: `${{ steps.vars.outputs.bundle_version }}`
|
||||||
🔗 Run: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
🔗 Run: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||||
@infra
|
@infra
|
||||||
|
|||||||
53
.github/workflows/build-develop.yml
vendored
53
.github/workflows/build-develop.yml
vendored
@ -1,67 +1,22 @@
|
|||||||
name: _DEVELOP
|
name: _DEVELOP
|
||||||
|
|
||||||
run-name: >-
|
|
||||||
_DEVELOP (develop @ ${{ github.sha }})
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
|
||||||
force:
|
|
||||||
description: 'Rebuild and overwrite even if already built/promoted'
|
|
||||||
type: boolean
|
|
||||||
required: false
|
|
||||||
default: false
|
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '16 5-20 * * 1-5'
|
- cron: '16 5-20 * * 1-5'
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
permissions: {}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-bundle:
|
build-bundle:
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
uses: ./.github/workflows/build-bundle.yml
|
uses: ./.github/workflows/build-bundle.yml
|
||||||
secrets:
|
secrets: inherit
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
||||||
AWS_REGION: ${{ secrets.AWS_REGION }}
|
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
||||||
MATTERMOST_WEBHOOK: ${{ secrets.MATTERMOST_WEBHOOK }}
|
|
||||||
S3_BUCKET: ${{ secrets.S3_BUCKET }}
|
|
||||||
with:
|
with:
|
||||||
gh_ref: "develop"
|
gh_ref: "develop"
|
||||||
force: ${{ inputs.force || false }}
|
build_wasm: "yes"
|
||||||
|
build_storybook: "yes"
|
||||||
|
|
||||||
build-docker:
|
build-docker:
|
||||||
needs: build-bundle
|
needs: build-bundle
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
uses: ./.github/workflows/build-docker.yml
|
uses: ./.github/workflows/build-docker.yml
|
||||||
secrets:
|
secrets: inherit
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
||||||
AWS_REGION: ${{ secrets.AWS_REGION }}
|
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
||||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
|
|
||||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
MATTERMOST_WEBHOOK: ${{ secrets.MATTERMOST_WEBHOOK }}
|
|
||||||
PUB_DOCKER_PASSWORD: ${{ secrets.PUB_DOCKER_PASSWORD }}
|
|
||||||
PUB_DOCKER_USERNAME: ${{ secrets.PUB_DOCKER_USERNAME }}
|
|
||||||
S3_BUCKET: ${{ secrets.S3_BUCKET }}
|
|
||||||
with:
|
with:
|
||||||
gh_ref: "develop"
|
gh_ref: "develop"
|
||||||
# Pin build-docker to the commit build-bundle actually bundled.
|
|
||||||
sha: ${{ needs.build-bundle.outputs.sha }}
|
|
||||||
force: ${{ inputs.force || false }}
|
|
||||||
|
|
||||||
build-docker-admin-console:
|
|
||||||
permissions: {}
|
|
||||||
uses: ./.github/workflows/build-docker-admin-console.yml
|
|
||||||
secrets:
|
|
||||||
ORG_WORKFLOW_TOKEN: ${{ secrets.ORG_WORKFLOW_TOKEN }}
|
|
||||||
with:
|
|
||||||
gh_ref: "develop"
|
|
||||||
force: ${{ inputs.force || false }}
|
|
||||||
|
|||||||
110
.github/workflows/build-docker-admin-console.yml
vendored
110
.github/workflows/build-docker-admin-console.yml
vendored
@ -1,110 +0,0 @@
|
|||||||
name: Admin Console Docker Builder
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
gh_ref:
|
|
||||||
description: 'Name of the branch or ref to build in penpot-nitrate'
|
|
||||||
type: string
|
|
||||||
required: true
|
|
||||||
default: 'develop'
|
|
||||||
dispatch_ref:
|
|
||||||
description: 'Branch of penpot-nitrate from which the workflow definition is read'
|
|
||||||
type: string
|
|
||||||
required: false
|
|
||||||
default: 'develop'
|
|
||||||
force:
|
|
||||||
description: 'Rebuild and overwrite even if already built'
|
|
||||||
type: boolean
|
|
||||||
required: false
|
|
||||||
default: false
|
|
||||||
workflow_call:
|
|
||||||
inputs:
|
|
||||||
gh_ref:
|
|
||||||
description: 'Name of the branch or ref to build in penpot-nitrate'
|
|
||||||
type: string
|
|
||||||
required: true
|
|
||||||
dispatch_ref:
|
|
||||||
description: 'Branch of penpot-nitrate from which the workflow definition is read'
|
|
||||||
type: string
|
|
||||||
required: false
|
|
||||||
default: 'develop'
|
|
||||||
force:
|
|
||||||
description: 'Rebuild and overwrite even if already built'
|
|
||||||
type: boolean
|
|
||||||
required: false
|
|
||||||
default: false
|
|
||||||
secrets:
|
|
||||||
ORG_WORKFLOW_TOKEN:
|
|
||||||
description: 'Token with Actions write access on penpot-nitrate'
|
|
||||||
required: true
|
|
||||||
|
|
||||||
permissions: {}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-nitrate-docker:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.ORG_WORKFLOW_TOKEN }}
|
|
||||||
REPO: penpot/penpot-nitrate
|
|
||||||
WORKFLOW: build-docker-admin-console.yml
|
|
||||||
GH_REF: ${{ inputs.gh_ref }}
|
|
||||||
DISPATCH_REF: ${{ inputs.dispatch_ref }}
|
|
||||||
FORCE: ${{ inputs.force }}
|
|
||||||
steps:
|
|
||||||
- name: Trigger nitrate docker build
|
|
||||||
id: dispatch
|
|
||||||
run: |
|
|
||||||
DISTINCT_ID="${GITHUB_RUN_ID}-${GITHUB_RUN_ATTEMPT}"
|
|
||||||
CALLER_URL="${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}"
|
|
||||||
|
|
||||||
gh workflow run "$WORKFLOW" --repo "$REPO" --ref "$DISPATCH_REF" \
|
|
||||||
-f gh_ref="$GH_REF" \
|
|
||||||
-f force="$FORCE" \
|
|
||||||
-f caller_run_id="$DISTINCT_ID" \
|
|
||||||
-f caller_run_url="$CALLER_URL"
|
|
||||||
|
|
||||||
# Locate the dispatched run using the correlation id embedded in its run-name
|
|
||||||
RUN_ID=""
|
|
||||||
for _ in $(seq 1 24); do
|
|
||||||
sleep 5
|
|
||||||
RUN_ID=$(gh run list --repo "$REPO" --workflow "$WORKFLOW" \
|
|
||||||
--limit 10 --json databaseId,displayTitle \
|
|
||||||
--jq ".[] | select(.displayTitle | contains(\"$DISTINCT_ID\")) | .databaseId" \
|
|
||||||
| head -n1)
|
|
||||||
[ -n "$RUN_ID" ] && break
|
|
||||||
done
|
|
||||||
|
|
||||||
if [ -z "$RUN_ID" ]; then
|
|
||||||
echo "::error::Could not locate the dispatched run in $REPO"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
RUN_URL="https://github.com/$REPO/actions/runs/$RUN_ID"
|
|
||||||
echo "run_id=$RUN_ID" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "run_url=$RUN_URL" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "::notice title=Nitrate docker build::$RUN_URL"
|
|
||||||
|
|
||||||
- name: Wait for nitrate docker build
|
|
||||||
env:
|
|
||||||
RUN_ID: ${{ steps.dispatch.outputs.run_id }}
|
|
||||||
run: |
|
|
||||||
gh run watch "$RUN_ID" \
|
|
||||||
--repo "$REPO" \
|
|
||||||
--interval 30 \
|
|
||||||
--exit-status
|
|
||||||
|
|
||||||
- name: Report result
|
|
||||||
if: always() && steps.dispatch.outputs.run_id != ''
|
|
||||||
env:
|
|
||||||
RUN_ID: ${{ steps.dispatch.outputs.run_id }}
|
|
||||||
RUN_URL: ${{ steps.dispatch.outputs.run_url }}
|
|
||||||
run: |
|
|
||||||
CONCLUSION=$(gh run view "$RUN_ID" \
|
|
||||||
--repo "$REPO" --json conclusion --jq '.conclusion')
|
|
||||||
{
|
|
||||||
echo "### 🐳 Nitrate docker build"
|
|
||||||
echo ""
|
|
||||||
echo "- Result: \`${CONCLUSION:-in_progress}\`"
|
|
||||||
echo "- Run: ${RUN_URL}"
|
|
||||||
} >> "$GITHUB_STEP_SUMMARY"
|
|
||||||
55
.github/workflows/build-docker-devenv.yml
vendored
55
.github/workflows/build-docker-devenv.yml
vendored
@ -3,81 +3,48 @@ name: DevEnv Docker Image Builder
|
|||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: build-docker-devenv
|
|
||||||
cancel-in-progress: false
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-push:
|
build-and-push:
|
||||||
name: Build and push DevEnv Docker image
|
name: Build and push DevEnv Docker image
|
||||||
runs-on: penpot-standar-runner
|
runs-on: penpot-runner-02
|
||||||
timeout-minutes: 90
|
|
||||||
env:
|
|
||||||
DOCKER_IMAGE: 'penpotapp/devenv'
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Set common environment variables
|
- name: Set common environment variables
|
||||||
run: |
|
run: |
|
||||||
# Each job execution will use its own docker configuration.
|
# Each job execution will use its own docker configuration.
|
||||||
echo "DOCKER_CONFIG=${RUNNER_TEMP}/.docker-${GITHUB_RUN_ID}-${GITHUB_JOB}" >> "$GITHUB_ENV"
|
echo "DOCKER_CONFIG=${{ runner.temp }}/.docker-${{ github.run_id }}-${{ github.job }}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
uses: actions/checkout@v6
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4.4.0
|
|
||||||
with:
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
|
uses: docker/setup-buildx-action@v4
|
||||||
|
|
||||||
- name: Login to Docker Registry (push destination)
|
- name: Login to Docker Registry
|
||||||
uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
|
uses: docker/login-action@v4
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.PUB_DOCKER_USERNAME }}
|
username: ${{ secrets.PUB_DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.PUB_DOCKER_PASSWORD }}
|
password: ${{ secrets.PUB_DOCKER_PASSWORD }}
|
||||||
|
|
||||||
- name: Login to Docker Hardened Images registry (base image pull)
|
|
||||||
uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
|
|
||||||
with:
|
|
||||||
registry: dhi.io
|
|
||||||
username: ${{ secrets.PUB_DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.PUB_DOCKER_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Build and push DevEnv Docker image
|
- name: Build and push DevEnv Docker image
|
||||||
uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0
|
uses: docker/build-push-action@v7
|
||||||
|
env:
|
||||||
|
DOCKER_IMAGE: 'penpotapp/devenv'
|
||||||
with:
|
with:
|
||||||
context: ./docker/devenv/
|
context: ./docker/devenv/
|
||||||
file: ./docker/devenv/Dockerfile
|
file: ./docker/devenv/Dockerfile
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
push: true
|
push: true
|
||||||
provenance: mode=max
|
|
||||||
sbom: true
|
|
||||||
tags: ${{ env.DOCKER_IMAGE }}:latest
|
tags: ${{ env.DOCKER_IMAGE }}:latest
|
||||||
cache-from: type=registry,ref=${{ env.DOCKER_IMAGE }}:buildcache
|
cache-from: type=registry,ref=${{ env.DOCKER_IMAGE }}:buildcache
|
||||||
cache-to: type=registry,ref=${{ env.DOCKER_IMAGE }}:buildcache,mode=max
|
cache-to: type=registry,ref=${{ env.DOCKER_IMAGE }}:buildcache,mode=max
|
||||||
|
|
||||||
- name: Notify Mattermost
|
- name: Notify Mattermost
|
||||||
uses: mattermost/action-mattermost-notify@ae31bb6f9e26a54336e79696f108a2c91cf55b4e # v2.1.0
|
uses: mattermost/action-mattermost-notify@master
|
||||||
with:
|
with:
|
||||||
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK }}
|
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK }}
|
||||||
MATTERMOST_CHANNEL: bot-alerts-cicd
|
MATTERMOST_CHANNEL: bot-alerts-cicd
|
||||||
TEXT: |
|
TEXT: |
|
||||||
🚀 *[PENPOT] New devenv available*
|
🚀 *[PENPOT] New devenv available*
|
||||||
📄 You may want to update your devenv.
|
📄 You may want to update your devenv.
|
||||||
|
@alvaro
|
||||||
- name: Notify Mattermost (developers)
|
|
||||||
uses: mattermost/action-mattermost-notify@ae31bb6f9e26a54336e79696f108a2c91cf55b4e # v2.1.0
|
|
||||||
with:
|
|
||||||
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK }}
|
|
||||||
MATTERMOST_CHANNEL: penpotdev
|
|
||||||
TEXT: |
|
|
||||||
🚀 *[PENPOT] New devenv available*
|
|
||||||
📄 You may want to update your devenv.
|
|
||||||
(\cc @alvaro)
|
|
||||||
|
|||||||
479
.github/workflows/build-docker.yml
vendored
479
.github/workflows/build-docker.yml
vendored
@ -8,423 +8,176 @@ on:
|
|||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
default: 'develop'
|
default: 'develop'
|
||||||
force:
|
|
||||||
description: 'Rebuild and overwrite even if this sha is already promoted'
|
|
||||||
type: boolean
|
|
||||||
required: false
|
|
||||||
default: false
|
|
||||||
workflow_call:
|
workflow_call:
|
||||||
inputs:
|
inputs:
|
||||||
gh_ref:
|
gh_ref:
|
||||||
description: 'Name of the branch or ref'
|
description: 'Name of the branch or ref'
|
||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
sha:
|
default: 'develop'
|
||||||
description: >-
|
|
||||||
Exact commit to check out (full 40-char SHA, e.g. from
|
|
||||||
build-bundle.yml). Falls back to gh_ref when empty; gh_ref
|
|
||||||
always still names the branch tag to move.
|
|
||||||
type: string
|
|
||||||
required: false
|
|
||||||
default: ''
|
|
||||||
force:
|
|
||||||
description: 'Rebuild and overwrite even if this sha is already promoted'
|
|
||||||
type: boolean
|
|
||||||
required: false
|
|
||||||
default: false
|
|
||||||
secrets:
|
|
||||||
AWS_ACCESS_KEY_ID:
|
|
||||||
required: false
|
|
||||||
AWS_REGION:
|
|
||||||
required: false
|
|
||||||
AWS_SECRET_ACCESS_KEY:
|
|
||||||
required: false
|
|
||||||
DOCKER_PASSWORD:
|
|
||||||
required: false
|
|
||||||
DOCKER_REGISTRY:
|
|
||||||
required: false
|
|
||||||
DOCKER_USERNAME:
|
|
||||||
required: false
|
|
||||||
MATTERMOST_WEBHOOK:
|
|
||||||
required: false
|
|
||||||
PUB_DOCKER_PASSWORD:
|
|
||||||
required: false
|
|
||||||
PUB_DOCKER_USERNAME:
|
|
||||||
required: false
|
|
||||||
S3_BUCKET:
|
|
||||||
required: false
|
|
||||||
|
|
||||||
# Literal group name: under `workflow_call`, `github.workflow` resolves to the
|
|
||||||
# caller's workflow, which put this workflow and the other reusable one called
|
|
||||||
# by the same caller into a single shared group, and left a manual dispatch of
|
|
||||||
# the same ref in a group of its own, free to race on the same artifacts.
|
|
||||||
concurrency:
|
|
||||||
group: build-docker-${{ inputs.gh_ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
env:
|
|
||||||
ALL_IMAGES: backend frontend exporter storybook mcp
|
|
||||||
# All runner instances live on the same server, so the bundle is
|
|
||||||
# downloaded from S3 once and shared between build jobs through this
|
|
||||||
# host-local directory. Each build job falls back to S3 if the file is
|
|
||||||
# missing (e.g. if runners ever move to separate machines).
|
|
||||||
BUNDLE_CACHE: /var/tmp/penpot-bundle-cache
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
# ── 1. Resolve the build key and check the whole set at once ───────────
|
build-and-push:
|
||||||
prepare:
|
name: Build and Push Penpot Docker Images
|
||||||
name: Prepare
|
runs-on: penpot-runner-02
|
||||||
runs-on: penpot-standar-runner
|
|
||||||
timeout-minutes: 15
|
|
||||||
outputs:
|
|
||||||
gh_ref: ${{ steps.vars.outputs.gh_ref }}
|
|
||||||
ref_slug: ${{ steps.vars.outputs.ref_slug }}
|
|
||||||
bundle_version: ${{ steps.vars.outputs.bundle_version }}
|
|
||||||
sha: ${{ steps.vars.outputs.sha }}
|
|
||||||
short_sha: ${{ steps.vars.outputs.short_sha }}
|
|
||||||
build_key: ${{ steps.vars.outputs.build_key }}
|
|
||||||
commit_title: ${{ steps.vars.outputs.commit_title }}
|
|
||||||
exists: ${{ steps.check.outputs.exists }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
fetch-depth: 0
|
|
||||||
ref: ${{ inputs.sha != '' && inputs.sha || inputs.gh_ref }}
|
|
||||||
|
|
||||||
- name: Extract some useful variables
|
|
||||||
id: vars
|
|
||||||
env:
|
|
||||||
GH_REF: ${{ inputs.gh_ref || github.ref_name }}
|
|
||||||
run: |
|
|
||||||
# A git ref accepts characters that a Docker tag does not.
|
|
||||||
REF_SLUG=$(printf '%s' "$GH_REF" | tr -c 'A-Za-z0-9._-' '-' | cut -c1-100)
|
|
||||||
echo "gh_ref=$GH_REF" >> $GITHUB_OUTPUT
|
|
||||||
echo "ref_slug=$REF_SLUG" >> $GITHUB_OUTPUT
|
|
||||||
# Must match the key computed by build-bundle.yml.
|
|
||||||
BUNDLE_VERSION=$(./manage.sh version)
|
|
||||||
SHORT_SHA=$(git rev-parse --short=12 HEAD)
|
|
||||||
VERSION_TAG=$(git describe --tags --match '*.*.*' --abbrev=0)
|
|
||||||
echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
|
|
||||||
echo "short_sha=$SHORT_SHA" >> $GITHUB_OUTPUT
|
|
||||||
echo "commit_title=$(git log -1 --pretty=%s)" >> $GITHUB_OUTPUT
|
|
||||||
echo "bundle_version=$BUNDLE_VERSION" >> $GITHUB_OUTPUT
|
|
||||||
echo "build_key=sha-${SHORT_SHA}-${VERSION_TAG}" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
# The image set is a single block, so a single set-level check is
|
|
||||||
# enough: `promote` drops a marker object in S3 only after every
|
|
||||||
# image was built AND every branch tag was moved. Marker present
|
|
||||||
# means there is nothing at all to do for this commit. `force`
|
|
||||||
# bypasses this check entirely.
|
|
||||||
- name: Check if this image set is already built
|
|
||||||
id: check
|
|
||||||
env:
|
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
||||||
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}
|
|
||||||
S3_BUCKET: ${{ secrets.S3_BUCKET }}
|
|
||||||
FORCE: ${{ inputs.force }}
|
|
||||||
BUILD_KEY: ${{ steps.vars.outputs.build_key }}
|
|
||||||
run: |
|
|
||||||
if [ "$FORCE" = "true" ]; then
|
|
||||||
echo "exists=false" >> $GITHUB_OUTPUT
|
|
||||||
mkdir -p "$BUNDLE_CACHE"
|
|
||||||
find "$BUNDLE_CACHE" -type f -mtime +1 -delete || true
|
|
||||||
ZIP="$BUNDLE_CACHE/penpot-${BUILD_KEY}.zip"
|
|
||||||
aws s3 cp "s3://${S3_BUCKET}/penpot-${BUILD_KEY}.zip" "$ZIP.$$.tmp"
|
|
||||||
mv "$ZIP.$$.tmp" "$ZIP"
|
|
||||||
{
|
|
||||||
echo "### 🔁 Image set build forced"
|
|
||||||
echo ""
|
|
||||||
echo "\`force: true\` — skipping the S3 marker check."
|
|
||||||
} >> "$GITHUB_STEP_SUMMARY"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if aws s3api head-object \
|
|
||||||
--bucket "$S3_BUCKET" \
|
|
||||||
--key "markers/images-${BUILD_KEY}" \
|
|
||||||
> /dev/null 2>&1; then
|
|
||||||
echo "exists=true" >> $GITHUB_OUTPUT
|
|
||||||
{
|
|
||||||
echo "### ⏭️ Image set build skipped"
|
|
||||||
echo ""
|
|
||||||
echo "The whole set was already built and promoted for \`${BUILD_KEY}\`."
|
|
||||||
} >> "$GITHUB_STEP_SUMMARY"
|
|
||||||
else
|
|
||||||
echo "exists=false" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
# Stage the bundle in the host-local cache, once, for all the
|
|
||||||
# build jobs. Download to a temp name and mv for atomicity;
|
|
||||||
# prune stale bundles while at it.
|
|
||||||
mkdir -p "$BUNDLE_CACHE"
|
|
||||||
find "$BUNDLE_CACHE" -type f -mtime +1 -delete || true
|
|
||||||
ZIP="$BUNDLE_CACHE/penpot-${BUILD_KEY}.zip"
|
|
||||||
if [ ! -f "$ZIP" ]; then
|
|
||||||
aws s3 cp "s3://${S3_BUCKET}/penpot-${BUILD_KEY}.zip" "$ZIP.$$.tmp"
|
|
||||||
mv "$ZIP.$$.tmp" "$ZIP"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# ── 2. One build per image, in parallel, only when needed ──────────────
|
|
||||||
build:
|
|
||||||
name: Build ${{ matrix.image }}
|
|
||||||
runs-on: penpot-standar-runner
|
|
||||||
timeout-minutes: 60
|
|
||||||
needs: prepare
|
|
||||||
if: needs.prepare.outputs.exists == 'false'
|
|
||||||
strategy:
|
|
||||||
fail-fast: true
|
|
||||||
# 4 runner slots are available for build jobs on this server; cap the
|
|
||||||
# matrix at 3 so short jobs (prepare and other workflows' checks)
|
|
||||||
# never queue behind long builds.
|
|
||||||
max-parallel: 3
|
|
||||||
matrix:
|
|
||||||
image: [backend, frontend, exporter, storybook, mcp]
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Set common environment variables
|
- name: Set common environment variables
|
||||||
run: |
|
run: |
|
||||||
# Each job execution will use its own docker configuration.
|
# Each job execution will use its own docker configuration.
|
||||||
echo "DOCKER_CONFIG=${{ runner.temp }}/.docker-${{ github.run_id }}-${{ github.job }}-${{ matrix.image }}" >> $GITHUB_ENV
|
echo "DOCKER_CONFIG=${{ runner.temp }}/.docker-${{ github.run_id }}-${{ github.job }}" >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
fetch-depth: 0
|
||||||
ref: ${{ inputs.sha != '' && inputs.sha || inputs.gh_ref }}
|
ref: ${{ inputs.gh_ref }}
|
||||||
|
|
||||||
|
- name: Extract some useful variables
|
||||||
|
id: vars
|
||||||
|
run: |
|
||||||
|
echo "gh_ref=${{ inputs.gh_ref || github.ref_name }}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Download Penpot Bundles
|
||||||
|
id: bundles
|
||||||
|
env:
|
||||||
|
FILE_NAME: penpot-${{ steps.vars.outputs.gh_ref }}.zip
|
||||||
|
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||||
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
|
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}
|
||||||
|
run: |
|
||||||
|
tmp=$(aws s3api head-object \
|
||||||
|
--bucket ${{ secrets.S3_BUCKET }} \
|
||||||
|
--key "$FILE_NAME" \
|
||||||
|
--query 'Metadata."bundle-version"' \
|
||||||
|
--output text)
|
||||||
|
echo "bundle_version=$tmp" >> $GITHUB_OUTPUT
|
||||||
|
pushd docker/images
|
||||||
|
aws s3 cp s3://${{ secrets.S3_BUCKET }}/$FILE_NAME .
|
||||||
|
unzip $FILE_NAME > /dev/null
|
||||||
|
mv penpot/backend bundle-backend
|
||||||
|
mv penpot/frontend bundle-frontend
|
||||||
|
mv penpot/exporter bundle-exporter
|
||||||
|
mv penpot/storybook bundle-storybook
|
||||||
|
mv penpot/mcp bundle-mcp
|
||||||
|
popd
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: docker/setup-buildx-action@v4
|
||||||
|
|
||||||
- name: Login to Docker Registry
|
- name: Login to Docker Registry
|
||||||
uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
|
uses: docker/login-action@v4
|
||||||
with:
|
with:
|
||||||
registry: ${{ secrets.DOCKER_REGISTRY }}
|
registry: ${{ secrets.DOCKER_REGISTRY }}
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
# To avoid the "429 Too Many Requests" error when downloading
|
# To avoid the “429 Too Many Requests” error when downloading
|
||||||
# images from DockerHub for unregistered users.
|
# images from DockerHub for unregistered users.
|
||||||
# https://docs.docker.com/docker-hub/usage/
|
# https://docs.docker.com/docker-hub/usage/
|
||||||
- name: Login to DockerHub Registry
|
- name: Login to DockerHub Registry
|
||||||
uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
|
uses: docker/login-action@v4
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.PUB_DOCKER_USERNAME }}
|
username: ${{ secrets.PUB_DOCKER_USERNAME }}
|
||||||
password: ${{ secrets.PUB_DOCKER_PASSWORD }}
|
password: ${{ secrets.PUB_DOCKER_PASSWORD }}
|
||||||
|
|
||||||
# Images now build FROM Docker Hardened Images (dhi.io). DHI
|
|
||||||
# is free (Apache 2.0, no subscription), but pulling from it
|
|
||||||
# still requires an authenticated login -- a separate `docker
|
|
||||||
# login` against a different registry host, even though it
|
|
||||||
# reuses the same PUB_DOCKER_* credentials as the DockerHub
|
|
||||||
# login above.
|
|
||||||
- name: Login to Docker Hardened Images registry (base image pull)
|
|
||||||
uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
|
|
||||||
with:
|
|
||||||
registry: dhi.io
|
|
||||||
username: ${{ secrets.PUB_DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.PUB_DOCKER_PASSWORD }}
|
|
||||||
|
|
||||||
# Bundle staged once by `prepare` on this host; the S3 fallback only
|
|
||||||
# triggers if the cache is unavailable (runners on another machine,
|
|
||||||
# cache pruned mid-run, ...).
|
|
||||||
- name: Prepare Penpot bundle
|
|
||||||
env:
|
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
||||||
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}
|
|
||||||
S3_BUCKET: ${{ secrets.S3_BUCKET }}
|
|
||||||
BUILD_KEY: ${{ needs.prepare.outputs.build_key }}
|
|
||||||
IMAGE: ${{ matrix.image }}
|
|
||||||
run: |
|
|
||||||
ZIP="$BUNDLE_CACHE/penpot-${BUILD_KEY}.zip"
|
|
||||||
if [ ! -f "$ZIP" ]; then
|
|
||||||
echo "Bundle not found in host cache; falling back to S3."
|
|
||||||
mkdir -p "$BUNDLE_CACHE"
|
|
||||||
aws s3 cp "s3://${S3_BUCKET}/penpot-${BUILD_KEY}.zip" "$ZIP.$$.tmp"
|
|
||||||
mv "$ZIP.$$.tmp" "$ZIP"
|
|
||||||
fi
|
|
||||||
# Extract only the bundle this job needs.
|
|
||||||
pushd docker/images
|
|
||||||
unzip -q "$ZIP" "penpot/${IMAGE}/*"
|
|
||||||
mv "penpot/${IMAGE}" "bundle-${IMAGE}"
|
|
||||||
popd
|
|
||||||
|
|
||||||
- name: Set up QEMU (stable)
|
|
||||||
uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4.4.0
|
|
||||||
with:
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
|
|
||||||
|
|
||||||
- name: Extract metadata (tags, labels)
|
- name: Extract metadata (tags, labels)
|
||||||
id: meta
|
id: meta
|
||||||
uses: docker/metadata-action@dc802804100637a589fabce1cb79ff13a1411302 # v6.2.0
|
uses: docker/metadata-action@v6
|
||||||
with:
|
with:
|
||||||
images: ${{ matrix.image }}
|
images:
|
||||||
|
frontend
|
||||||
|
backend
|
||||||
|
exporter
|
||||||
|
storybook
|
||||||
|
mcp
|
||||||
labels: |
|
labels: |
|
||||||
bundle_version=${{ needs.prepare.outputs.bundle_version }}
|
bundle_version=${{ steps.bundles.outputs.bundle_version }}
|
||||||
|
|
||||||
- name: Build and push Docker image
|
- name: Build and push Backend Docker image
|
||||||
uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0
|
uses: docker/build-push-action@v7
|
||||||
|
env:
|
||||||
|
DOCKER_IMAGE: 'backend'
|
||||||
|
BUNDLE_PATH: './bundle-backend'
|
||||||
with:
|
with:
|
||||||
context: ./docker/images/
|
context: ./docker/images/
|
||||||
file: ./docker/images/Dockerfile.${{ matrix.image }}
|
file: ./docker/images/Dockerfile.backend
|
||||||
platforms: linux/amd64,linux/arm64
|
platforms: linux/amd64,linux/arm64
|
||||||
push: true
|
push: true
|
||||||
provenance: mode=max
|
tags: ${{ secrets.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:${{ steps.vars.outputs.gh_ref }}
|
||||||
sbom: true
|
|
||||||
# Immutable tag only; branch tags are moved atomically for the
|
|
||||||
# whole image set by the `promote` job.
|
|
||||||
tags: ${{ secrets.DOCKER_REGISTRY }}/${{ matrix.image }}:${{ needs.prepare.outputs.build_key }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
cache-from: type=registry,ref=${{ secrets.DOCKER_REGISTRY }}/${{ matrix.image }}:buildcache
|
cache-from: type=registry,ref=${{ secrets.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:buildcache
|
||||||
cache-to: type=registry,ref=${{ secrets.DOCKER_REGISTRY }}/${{ matrix.image }}:buildcache,mode=max
|
cache-to: type=registry,ref=${{ secrets.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:buildcache,mode=max
|
||||||
|
|
||||||
# ── 3a. Move the branch tags of ALL images together (fresh build) ──────
|
- name: Build and push Frontend Docker image
|
||||||
promote:
|
uses: docker/build-push-action@v7
|
||||||
name: Promote image set
|
env:
|
||||||
runs-on: penpot-standar-runner
|
DOCKER_IMAGE: 'frontend'
|
||||||
timeout-minutes: 10
|
BUNDLE_PATH: './bundle-frontend'
|
||||||
needs: [prepare, build]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Set common environment variables
|
|
||||||
run: |
|
|
||||||
echo "DOCKER_CONFIG=${{ runner.temp }}/.docker-${{ github.run_id }}-${{ github.job }}" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
|
|
||||||
|
|
||||||
- name: Login to Docker Registry
|
|
||||||
uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
|
|
||||||
with:
|
with:
|
||||||
registry: ${{ secrets.DOCKER_REGISTRY }}
|
context: ./docker/images/
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
file: ./docker/images/Dockerfile.frontend
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: ${{ secrets.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:${{ steps.vars.outputs.gh_ref }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
cache-from: type=registry,ref=${{ secrets.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:buildcache
|
||||||
|
cache-to: type=registry,ref=${{ secrets.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:buildcache,mode=max
|
||||||
|
|
||||||
- name: Point branch tags to the new build key
|
- name: Build and push Exporter Docker image
|
||||||
|
uses: docker/build-push-action@v7
|
||||||
env:
|
env:
|
||||||
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
|
DOCKER_IMAGE: 'exporter'
|
||||||
REF_SLUG: ${{ needs.prepare.outputs.ref_slug }}
|
BUNDLE_PATH: './bundle-exporter'
|
||||||
BUILD_KEY: ${{ needs.prepare.outputs.build_key }}
|
|
||||||
run: |
|
|
||||||
set -e
|
|
||||||
for image in $ALL_IMAGES; do
|
|
||||||
docker buildx imagetools create \
|
|
||||||
-t "${DOCKER_REGISTRY}/${image}:${REF_SLUG}" \
|
|
||||||
"${DOCKER_REGISTRY}/${image}:${BUILD_KEY}"
|
|
||||||
done
|
|
||||||
|
|
||||||
# The marker is written LAST: its presence certifies that all five
|
|
||||||
# images exist and all branch tags point to this build key.
|
|
||||||
- name: Write set-completed marker
|
|
||||||
env:
|
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
||||||
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}
|
|
||||||
S3_BUCKET: ${{ secrets.S3_BUCKET }}
|
|
||||||
BUILD_KEY: ${{ needs.prepare.outputs.build_key }}
|
|
||||||
run: |
|
|
||||||
echo "$GITHUB_RUN_ID" | aws s3 cp - \
|
|
||||||
"s3://${S3_BUCKET}/markers/images-${BUILD_KEY}"
|
|
||||||
|
|
||||||
- name: Write step summary
|
|
||||||
env:
|
|
||||||
REF_SLUG: ${{ needs.prepare.outputs.ref_slug }}
|
|
||||||
SHORT_SHA: ${{ needs.prepare.outputs.short_sha }}
|
|
||||||
BUILD_KEY: ${{ needs.prepare.outputs.build_key }}
|
|
||||||
BUNDLE_VERSION: ${{ needs.prepare.outputs.bundle_version }}
|
|
||||||
COMMIT_TITLE: ${{ needs.prepare.outputs.commit_title }}
|
|
||||||
run: |
|
|
||||||
{
|
|
||||||
echo "### ✅ Image set promoted"
|
|
||||||
echo ""
|
|
||||||
echo "- Version: \`${BUNDLE_VERSION}\` (\`./manage.sh version\`)"
|
|
||||||
echo "- Commit: [\`${SHORT_SHA}\`](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commit/${SHORT_SHA}) — ${COMMIT_TITLE}"
|
|
||||||
echo "- Built at: $(date -u +'%Y-%m-%d %H:%M:%S UTC')"
|
|
||||||
echo ""
|
|
||||||
echo "All \`:${REF_SLUG}\` tags now point to \`${BUILD_KEY}\`."
|
|
||||||
} >> "$GITHUB_STEP_SUMMARY"
|
|
||||||
|
|
||||||
# ── 3b. Skip path: make sure THIS ref's tags point to the existing
|
|
||||||
# images (another ref may have built and promoted the same commit
|
|
||||||
# first — the sha marker says the images exist, not that this ref's
|
|
||||||
# tags were ever created).
|
|
||||||
retag:
|
|
||||||
name: Ensure branch tags (already-built commit)
|
|
||||||
runs-on: penpot-standar-runner
|
|
||||||
timeout-minutes: 10
|
|
||||||
needs: prepare
|
|
||||||
if: needs.prepare.outputs.exists == 'true'
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Set common environment variables
|
|
||||||
run: |
|
|
||||||
echo "DOCKER_CONFIG=${{ runner.temp }}/.docker-${{ github.run_id }}-${{ github.job }}" >> $GITHUB_ENV
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
|
|
||||||
|
|
||||||
- name: Login to Docker Registry
|
|
||||||
uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
|
|
||||||
with:
|
with:
|
||||||
registry: ${{ secrets.DOCKER_REGISTRY }}
|
context: ./docker/images/
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
file: ./docker/images/Dockerfile.exporter
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
platforms: linux/amd64,linux/arm64
|
||||||
|
push: true
|
||||||
|
tags: ${{ secrets.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:${{ steps.vars.outputs.gh_ref }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
cache-from: type=registry,ref=${{ secrets.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:buildcache
|
||||||
|
cache-to: type=registry,ref=${{ secrets.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:buildcache,mode=max
|
||||||
|
|
||||||
- name: Point branch tags to the existing build key
|
- name: Build and push Storybook Docker image
|
||||||
|
uses: docker/build-push-action@v7
|
||||||
env:
|
env:
|
||||||
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
|
DOCKER_IMAGE: 'storybook'
|
||||||
REF_SLUG: ${{ needs.prepare.outputs.ref_slug }}
|
BUNDLE_PATH: './bundle-storybook'
|
||||||
BUILD_KEY: ${{ needs.prepare.outputs.build_key }}
|
with:
|
||||||
run: |
|
context: ./docker/images/
|
||||||
set -e
|
file: ./docker/images/Dockerfile.storybook
|
||||||
for image in $ALL_IMAGES; do
|
platforms: linux/amd64,linux/arm64
|
||||||
docker buildx imagetools create \
|
push: true
|
||||||
-t "${DOCKER_REGISTRY}/${image}:${REF_SLUG}" \
|
tags: ${{ secrets.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:${{ steps.vars.outputs.gh_ref }}
|
||||||
"${DOCKER_REGISTRY}/${image}:${BUILD_KEY}"
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
done
|
cache-from: type=registry,ref=${{ secrets.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:buildcache
|
||||||
|
cache-to: type=registry,ref=${{ secrets.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:buildcache,mode=max
|
||||||
|
|
||||||
- name: Write step summary
|
- name: Build and push MCP Docker image
|
||||||
|
uses: docker/build-push-action@v7
|
||||||
env:
|
env:
|
||||||
REF_SLUG: ${{ needs.prepare.outputs.ref_slug }}
|
DOCKER_IMAGE: 'mcp'
|
||||||
SHORT_SHA: ${{ needs.prepare.outputs.short_sha }}
|
BUNDLE_PATH: './bundle-mcp'
|
||||||
BUILD_KEY: ${{ needs.prepare.outputs.build_key }}
|
with:
|
||||||
BUNDLE_VERSION: ${{ needs.prepare.outputs.bundle_version }}
|
context: ./docker/images/
|
||||||
COMMIT_TITLE: ${{ needs.prepare.outputs.commit_title }}
|
file: ./docker/images/Dockerfile.mcp
|
||||||
run: |
|
platforms: linux/amd64,linux/arm64
|
||||||
{
|
push: true
|
||||||
echo "### ✅ Image set already built (branch tags ensured)"
|
tags: ${{ secrets.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:${{ steps.vars.outputs.gh_ref }}
|
||||||
echo ""
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
echo "- Version: \`${BUNDLE_VERSION}\` (\`./manage.sh version\`)"
|
cache-from: type=registry,ref=${{ secrets.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:buildcache
|
||||||
echo "- Commit: [\`${SHORT_SHA}\`](${GITHUB_SERVER_URL}/${GITHUB_REPOSITORY}/commit/${SHORT_SHA}) — ${COMMIT_TITLE}"
|
cache-to: type=registry,ref=${{ secrets.DOCKER_REGISTRY }}/${{ env.DOCKER_IMAGE }}:buildcache,mode=max
|
||||||
echo "- Checked at: $(date -u +'%Y-%m-%d %H:%M:%S UTC')"
|
|
||||||
echo ""
|
|
||||||
echo "All \`:${REF_SLUG}\` tags now point to \`${BUILD_KEY}\`."
|
|
||||||
} >> "$GITHUB_STEP_SUMMARY"
|
|
||||||
|
|
||||||
# ── 4. Single failure notification for the whole workflow ─────────────
|
|
||||||
notify:
|
|
||||||
name: Notify failure
|
|
||||||
runs-on: penpot-standar-runner
|
|
||||||
timeout-minutes: 5
|
|
||||||
needs: [prepare, build, promote, retag]
|
|
||||||
if: failure()
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Notify Mattermost
|
- name: Notify Mattermost
|
||||||
uses: mattermost/action-mattermost-notify@ae31bb6f9e26a54336e79696f108a2c91cf55b4e # v2.1.0
|
if: failure()
|
||||||
|
uses: mattermost/action-mattermost-notify@master
|
||||||
with:
|
with:
|
||||||
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK }}
|
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK }}
|
||||||
MATTERMOST_CHANNEL: bot-alerts-cicd
|
MATTERMOST_CHANNEL: bot-alerts-cicd
|
||||||
TEXT: |
|
TEXT: |
|
||||||
❌ 🐳 *[PENPOT] Error building/promoting the penpot docker image set.*
|
❌ 🐳 *[PENPOT] Error building penpot docker images.*
|
||||||
📄 Triggered from ref: `${{ needs.prepare.outputs.gh_ref || inputs.gh_ref }}`
|
📄 Triggered from ref: `${{ steps.vars.outputs.gh_ref }}`
|
||||||
📦 Bundle: `${{ needs.prepare.outputs.bundle_version || 'n/a' }}`
|
📦 Bundle: `${{ steps.bundles.outputs.bundle_version }}`
|
||||||
🔗 Run: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
🔗 Run: https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
|
||||||
@infra
|
@infra
|
||||||
|
|||||||
260
.github/workflows/build-renovate.yml
vendored
260
.github/workflows/build-renovate.yml
vendored
@ -1,260 +0,0 @@
|
|||||||
name: Renovate Docker Image Check
|
|
||||||
|
|
||||||
# Triggered by pushes to Renovate branches, not by pull_request: this is a
|
|
||||||
# public repository and these jobs run on the self-hosted runners, so a PR
|
|
||||||
# from a fork must never be able to start them. Only users with write
|
|
||||||
# access can push here.
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- 'renovate-*'
|
|
||||||
|
|
||||||
permissions: {}
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: renovate-image-check-${{ github.ref_name }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
env:
|
|
||||||
BUNDLE_CACHE: /var/tmp/penpot-bundle-cache
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
# ── 1. Pick an existing develop bundle and detect what changed ────────
|
|
||||||
prepare:
|
|
||||||
name: Prepare
|
|
||||||
runs-on: penpot-standar-runner
|
|
||||||
timeout-minutes: 10
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
outputs:
|
|
||||||
bundle_key: ${{ steps.bundle.outputs.bundle_key }}
|
|
||||||
images: ${{ steps.changes.outputs.images }}
|
|
||||||
devenv: ${{ steps.changes.outputs.devenv }}
|
|
||||||
imagemagick: ${{ steps.changes.outputs.imagemagick }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Find the develop commit this branch is based on
|
|
||||||
id: base
|
|
||||||
run: |
|
|
||||||
echo "sha=$(git merge-base HEAD origin/develop)" >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
- name: Detect changed images
|
|
||||||
id: changes
|
|
||||||
env:
|
|
||||||
BASE_SHA: ${{ steps.base.outputs.sha }}
|
|
||||||
run: |
|
|
||||||
changed() {
|
|
||||||
git diff --quiet "$BASE_SHA" HEAD -- "$@" && echo false || echo true
|
|
||||||
}
|
|
||||||
{
|
|
||||||
# Anything outside .github can affect the production images.
|
|
||||||
echo "images=$(changed . ':!.github')"
|
|
||||||
echo "devenv=$(changed docker/devenv)"
|
|
||||||
echo "imagemagick=$(changed docker/imagemagick)"
|
|
||||||
} >> "$GITHUB_OUTPUT"
|
|
||||||
|
|
||||||
# Renovate only changes Dockerfiles and package manager versions, so
|
|
||||||
# the most recent develop bundle is enough to build the images. The
|
|
||||||
# version part of the key does not matter here: take any bundle of
|
|
||||||
# the commit.
|
|
||||||
- name: Find the latest develop bundle
|
|
||||||
id: bundle
|
|
||||||
env:
|
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
||||||
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}
|
|
||||||
S3_BUCKET: ${{ secrets.S3_BUCKET }}
|
|
||||||
BASE_SHA: ${{ steps.base.outputs.sha }}
|
|
||||||
run: |
|
|
||||||
for SHA in $(git rev-list --first-parent --max-count=50 "$BASE_SHA"); do
|
|
||||||
SHORT_SHA=$(git rev-parse --short=12 "$SHA")
|
|
||||||
BUNDLE_KEY=$(aws s3api list-objects-v2 --bucket "$S3_BUCKET" \
|
|
||||||
--prefix "penpot-sha-${SHORT_SHA}-" \
|
|
||||||
--query 'Contents[0].Key' --output text)
|
|
||||||
if [ -n "$BUNDLE_KEY" ] && [ "$BUNDLE_KEY" != "None" ]; then
|
|
||||||
echo "bundle_key=$BUNDLE_KEY" >> "$GITHUB_OUTPUT"
|
|
||||||
echo "Using bundle \`${BUNDLE_KEY}\`" >> "$GITHUB_STEP_SUMMARY"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
echo "::error::No bundle found for the last 50 develop commits"
|
|
||||||
exit 1
|
|
||||||
|
|
||||||
# ── 2. Production images, built from the PR Dockerfiles ───────────────
|
|
||||||
images:
|
|
||||||
name: Build ${{ matrix.image }}
|
|
||||||
runs-on: penpot-standar-runner
|
|
||||||
timeout-minutes: 60
|
|
||||||
needs: prepare
|
|
||||||
if: needs.prepare.outputs.images == 'true'
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
max-parallel: 3
|
|
||||||
matrix:
|
|
||||||
image: [backend, frontend, exporter, storybook, mcp]
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Set common environment variables
|
|
||||||
env:
|
|
||||||
MATRIX_IMAGE: ${{ matrix.image }}
|
|
||||||
run: |
|
|
||||||
echo "DOCKER_CONFIG=${RUNNER_TEMP}/.docker-${GITHUB_RUN_ID}-${GITHUB_JOB}-${MATRIX_IMAGE}" >> "$GITHUB_ENV"
|
|
||||||
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Login to Docker Registry
|
|
||||||
uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
|
|
||||||
with:
|
|
||||||
registry: ${{ secrets.DOCKER_REGISTRY }}
|
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Login to DockerHub Registry
|
|
||||||
uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.PUB_DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.PUB_DOCKER_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Login to Docker Hardened Images registry
|
|
||||||
uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
|
|
||||||
with:
|
|
||||||
registry: dhi.io
|
|
||||||
username: ${{ secrets.PUB_DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.PUB_DOCKER_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Prepare Penpot bundle
|
|
||||||
env:
|
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
||||||
AWS_DEFAULT_REGION: ${{ secrets.AWS_REGION }}
|
|
||||||
S3_BUCKET: ${{ secrets.S3_BUCKET }}
|
|
||||||
BUNDLE_KEY: ${{ needs.prepare.outputs.bundle_key }}
|
|
||||||
IMAGE: ${{ matrix.image }}
|
|
||||||
run: |
|
|
||||||
ZIP="$BUNDLE_CACHE/${BUNDLE_KEY}"
|
|
||||||
if [ ! -f "$ZIP" ]; then
|
|
||||||
mkdir -p "$BUNDLE_CACHE"
|
|
||||||
aws s3 cp "s3://${S3_BUCKET}/${BUNDLE_KEY}" "$ZIP.$$.tmp"
|
|
||||||
mv "$ZIP.$$.tmp" "$ZIP"
|
|
||||||
fi
|
|
||||||
pushd docker/images
|
|
||||||
unzip -q "$ZIP" "penpot/${IMAGE}/*"
|
|
||||||
mv "penpot/${IMAGE}" "bundle-${IMAGE}"
|
|
||||||
popd
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4.4.0
|
|
||||||
with:
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
|
|
||||||
|
|
||||||
- name: Build Docker image
|
|
||||||
uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0
|
|
||||||
with:
|
|
||||||
context: ./docker/images/
|
|
||||||
file: ./docker/images/Dockerfile.${{ matrix.image }}
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
push: false
|
|
||||||
cache-from: type=registry,ref=${{ secrets.DOCKER_REGISTRY }}/${{ matrix.image }}:buildcache
|
|
||||||
|
|
||||||
# ── 3. Devenv, only when the PR touches it ────────────────────────────
|
|
||||||
devenv:
|
|
||||||
name: Build devenv
|
|
||||||
runs-on: penpot-standar-runner
|
|
||||||
timeout-minutes: 90
|
|
||||||
needs: prepare
|
|
||||||
if: needs.prepare.outputs.devenv == 'true'
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Set common environment variables
|
|
||||||
run: |
|
|
||||||
echo "DOCKER_CONFIG=${RUNNER_TEMP}/.docker-${GITHUB_RUN_ID}-${GITHUB_JOB}" >> "$GITHUB_ENV"
|
|
||||||
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Login to DockerHub Registry
|
|
||||||
uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.PUB_DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.PUB_DOCKER_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Login to Docker Hardened Images registry
|
|
||||||
uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
|
|
||||||
with:
|
|
||||||
registry: dhi.io
|
|
||||||
username: ${{ secrets.PUB_DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.PUB_DOCKER_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@99012661954931238ded8c8b007157a8430204e1 # v4.4.0
|
|
||||||
with:
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
|
|
||||||
|
|
||||||
- name: Build devenv image
|
|
||||||
uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0
|
|
||||||
with:
|
|
||||||
context: ./docker/devenv/
|
|
||||||
file: ./docker/devenv/Dockerfile
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
push: false
|
|
||||||
cache-from: type=registry,ref=penpotapp/devenv:buildcache
|
|
||||||
|
|
||||||
# ── 4. ImageMagick, only when the PR touches it ───────────────────────
|
|
||||||
# amd64 only: compiling ImageMagick under QEMU takes too long for a check.
|
|
||||||
imagemagick:
|
|
||||||
name: Build imagemagick
|
|
||||||
runs-on: penpot-standar-runner
|
|
||||||
timeout-minutes: 60
|
|
||||||
needs: prepare
|
|
||||||
if: needs.prepare.outputs.imagemagick == 'true'
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Set common environment variables
|
|
||||||
run: |
|
|
||||||
echo "DOCKER_CONFIG=${RUNNER_TEMP}/.docker-${GITHUB_RUN_ID}-${GITHUB_JOB}" >> "$GITHUB_ENV"
|
|
||||||
|
|
||||||
- name: Checkout code
|
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Login to Docker Hardened Images registry
|
|
||||||
uses: docker/login-action@8aa5831fb8d48d8f76594c7ddde61ae58019f550 # v4.8.0
|
|
||||||
with:
|
|
||||||
registry: dhi.io
|
|
||||||
username: ${{ secrets.PUB_DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.PUB_DOCKER_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@f87e5991a6d7451dcb8d9637bfbc97413f497069 # v4.4.1
|
|
||||||
|
|
||||||
- name: Build imagemagick image
|
|
||||||
uses: docker/build-push-action@c3c9e263c25d99ce0380d002d59b67737d91b0dc # v7.4.0
|
|
||||||
with:
|
|
||||||
context: ./docker/imagemagick/
|
|
||||||
file: ./docker/imagemagick/Dockerfile
|
|
||||||
platforms: linux/amd64
|
|
||||||
push: false
|
|
||||||
53
.github/workflows/build-staging.yml
vendored
53
.github/workflows/build-staging.yml
vendored
@ -1,67 +1,22 @@
|
|||||||
name: _STAGING
|
name: _STAGING
|
||||||
|
|
||||||
run-name: >-
|
|
||||||
_STAGING (staging)
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
|
||||||
force:
|
|
||||||
description: 'Rebuild and overwrite even if already built/promoted'
|
|
||||||
type: boolean
|
|
||||||
required: false
|
|
||||||
default: false
|
|
||||||
schedule:
|
schedule:
|
||||||
- cron: '36 5-20 * * 1-5'
|
- cron: '36 5-20 * * 1-5'
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
permissions: {}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-bundle:
|
build-bundle:
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
uses: ./.github/workflows/build-bundle.yml
|
uses: ./.github/workflows/build-bundle.yml
|
||||||
secrets:
|
secrets: inherit
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
||||||
AWS_REGION: ${{ secrets.AWS_REGION }}
|
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
||||||
MATTERMOST_WEBHOOK: ${{ secrets.MATTERMOST_WEBHOOK }}
|
|
||||||
S3_BUCKET: ${{ secrets.S3_BUCKET }}
|
|
||||||
with:
|
with:
|
||||||
gh_ref: "staging"
|
gh_ref: "staging"
|
||||||
force: ${{ inputs.force || false }}
|
build_wasm: "yes"
|
||||||
|
build_storybook: "yes"
|
||||||
|
|
||||||
build-docker:
|
build-docker:
|
||||||
needs: build-bundle
|
needs: build-bundle
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
uses: ./.github/workflows/build-docker.yml
|
uses: ./.github/workflows/build-docker.yml
|
||||||
secrets:
|
secrets: inherit
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
||||||
AWS_REGION: ${{ secrets.AWS_REGION }}
|
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
||||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
|
|
||||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
MATTERMOST_WEBHOOK: ${{ secrets.MATTERMOST_WEBHOOK }}
|
|
||||||
PUB_DOCKER_PASSWORD: ${{ secrets.PUB_DOCKER_PASSWORD }}
|
|
||||||
PUB_DOCKER_USERNAME: ${{ secrets.PUB_DOCKER_USERNAME }}
|
|
||||||
S3_BUCKET: ${{ secrets.S3_BUCKET }}
|
|
||||||
with:
|
with:
|
||||||
gh_ref: "staging"
|
gh_ref: "staging"
|
||||||
# Pin build-docker to the commit build-bundle actually bundled.
|
|
||||||
sha: ${{ needs.build-bundle.outputs.sha }}
|
|
||||||
force: ${{ inputs.force || false }}
|
|
||||||
|
|
||||||
build-docker-admin-console:
|
|
||||||
permissions: {}
|
|
||||||
uses: ./.github/workflows/build-docker-admin-console.yml
|
|
||||||
secrets:
|
|
||||||
ORG_WORKFLOW_TOKEN: ${{ secrets.ORG_WORKFLOW_TOKEN }}
|
|
||||||
with:
|
|
||||||
gh_ref: "staging"
|
|
||||||
force: ${{ inputs.force || false }}
|
|
||||||
|
|||||||
78
.github/workflows/build-tag.yml
vendored
78
.github/workflows/build-tag.yml
vendored
@ -1,82 +1,35 @@
|
|||||||
name: _TAG
|
name: _TAG
|
||||||
|
|
||||||
run-name: >-
|
|
||||||
_TAG (${{ github.ref_name }} @ ${{ github.sha }})
|
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
|
||||||
force:
|
|
||||||
description: 'Rebuild and overwrite even if already built/promoted (manual re-releases only)'
|
|
||||||
type: boolean
|
|
||||||
required: false
|
|
||||||
default: false
|
|
||||||
push:
|
push:
|
||||||
tags:
|
tags:
|
||||||
- '*'
|
- '*'
|
||||||
|
|
||||||
# Keyed by ref and never cancelling: pushing 2.17.2 shortly after 2.17.2-RC1
|
|
||||||
# must not abort the release already in flight.
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.ref_name }}
|
|
||||||
cancel-in-progress: false
|
|
||||||
|
|
||||||
permissions: {}
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-bundle:
|
build-bundle:
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
uses: ./.github/workflows/build-bundle.yml
|
uses: ./.github/workflows/build-bundle.yml
|
||||||
secrets:
|
secrets: inherit
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
||||||
AWS_REGION: ${{ secrets.AWS_REGION }}
|
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
||||||
MATTERMOST_WEBHOOK: ${{ secrets.MATTERMOST_WEBHOOK }}
|
|
||||||
S3_BUCKET: ${{ secrets.S3_BUCKET }}
|
|
||||||
with:
|
with:
|
||||||
gh_ref: ${{ github.ref_name }}
|
gh_ref: ${{ github.ref_name }}
|
||||||
force: ${{ inputs.force || false }}
|
build_wasm: "yes"
|
||||||
|
build_storybook: "yes"
|
||||||
|
|
||||||
build-docker:
|
build-docker:
|
||||||
needs: build-bundle
|
needs: build-bundle
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
uses: ./.github/workflows/build-docker.yml
|
uses: ./.github/workflows/build-docker.yml
|
||||||
secrets:
|
secrets: inherit
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
||||||
AWS_REGION: ${{ secrets.AWS_REGION }}
|
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
||||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
|
|
||||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
MATTERMOST_WEBHOOK: ${{ secrets.MATTERMOST_WEBHOOK }}
|
|
||||||
PUB_DOCKER_PASSWORD: ${{ secrets.PUB_DOCKER_PASSWORD }}
|
|
||||||
PUB_DOCKER_USERNAME: ${{ secrets.PUB_DOCKER_USERNAME }}
|
|
||||||
S3_BUCKET: ${{ secrets.S3_BUCKET }}
|
|
||||||
with:
|
with:
|
||||||
gh_ref: ${{ github.ref_name }}
|
gh_ref: ${{ github.ref_name }}
|
||||||
force: ${{ inputs.force || false }}
|
|
||||||
|
|
||||||
build-docker-admin-console:
|
|
||||||
permissions: {}
|
|
||||||
uses: ./.github/workflows/build-docker-admin-console.yml
|
|
||||||
secrets:
|
|
||||||
ORG_WORKFLOW_TOKEN: ${{ secrets.ORG_WORKFLOW_TOKEN }}
|
|
||||||
with:
|
|
||||||
gh_ref: ${{ github.ref_name }}
|
|
||||||
force: ${{ inputs.force || false }}
|
|
||||||
|
|
||||||
notify:
|
notify:
|
||||||
name: Notifications
|
name: Notifications
|
||||||
permissions: {}
|
runs-on: ubuntu-24.04
|
||||||
runs-on: ubuntu-latest
|
needs: build-docker
|
||||||
needs:
|
|
||||||
- build-docker
|
|
||||||
- build-docker-admin-console
|
|
||||||
steps:
|
steps:
|
||||||
- name: Notify Mattermost
|
- name: Notify Mattermost
|
||||||
uses: mattermost/action-mattermost-notify@ae31bb6f9e26a54336e79696f108a2c91cf55b4e # v2.1.0
|
uses: mattermost/action-mattermost-notify@master
|
||||||
with:
|
with:
|
||||||
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK }}
|
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK }}
|
||||||
MATTERMOST_CHANNEL: bot-alerts-cicd
|
MATTERMOST_CHANNEL: bot-alerts-cicd
|
||||||
@ -87,19 +40,8 @@ jobs:
|
|||||||
|
|
||||||
publish-final-tag:
|
publish-final-tag:
|
||||||
if: ${{ !contains(github.ref_name, '-RC') && !contains(github.ref_name, '-alpha') && !contains(github.ref_name, '-beta') && contains(github.ref_name, '.') }}
|
if: ${{ !contains(github.ref_name, '-RC') && !contains(github.ref_name, '-alpha') && !contains(github.ref_name, '-beta') && contains(github.ref_name, '.') }}
|
||||||
needs:
|
needs: build-docker
|
||||||
- build-docker
|
|
||||||
- build-docker-admin-console
|
|
||||||
permissions:
|
|
||||||
contents: write
|
|
||||||
uses: ./.github/workflows/release.yml
|
uses: ./.github/workflows/release.yml
|
||||||
secrets:
|
secrets: inherit
|
||||||
AWS_REGION: ${{ secrets.AWS_REGION }}
|
|
||||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
|
|
||||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
MATTERMOST_WEBHOOK: ${{ secrets.MATTERMOST_WEBHOOK }}
|
|
||||||
PUB_DOCKER_PASSWORD: ${{ secrets.PUB_DOCKER_PASSWORD }}
|
|
||||||
PUB_DOCKER_USERNAME: ${{ secrets.PUB_DOCKER_USERNAME }}
|
|
||||||
with:
|
with:
|
||||||
gh_ref: ${{ github.ref_name }}
|
gh_ref: ${{ github.ref_name }}
|
||||||
|
|||||||
45
.github/workflows/build-tmp-tokens.yml
vendored
45
.github/workflows/build-tmp-tokens.yml
vendored
@ -1,45 +0,0 @@
|
|||||||
name: _TMP TOKENS
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
# schedule:
|
|
||||||
# - cron: '46 5-20 * * 1-5'
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
permissions: {}
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
build-bundle:
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
uses: ./.github/workflows/build-bundle.yml
|
|
||||||
secrets:
|
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
||||||
AWS_REGION: ${{ secrets.AWS_REGION }}
|
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
||||||
MATTERMOST_WEBHOOK: ${{ secrets.MATTERMOST_WEBHOOK }}
|
|
||||||
S3_BUCKET: ${{ secrets.S3_BUCKET }}
|
|
||||||
with:
|
|
||||||
gh_ref: "hiru-tokens-in-libs"
|
|
||||||
|
|
||||||
build-docker:
|
|
||||||
needs: build-bundle
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
uses: ./.github/workflows/build-docker.yml
|
|
||||||
secrets:
|
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
|
||||||
AWS_REGION: ${{ secrets.AWS_REGION }}
|
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
|
||||||
DOCKER_PASSWORD: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
DOCKER_REGISTRY: ${{ secrets.DOCKER_REGISTRY }}
|
|
||||||
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
MATTERMOST_WEBHOOK: ${{ secrets.MATTERMOST_WEBHOOK }}
|
|
||||||
PUB_DOCKER_PASSWORD: ${{ secrets.PUB_DOCKER_PASSWORD }}
|
|
||||||
PUB_DOCKER_USERNAME: ${{ secrets.PUB_DOCKER_USERNAME }}
|
|
||||||
S3_BUCKET: ${{ secrets.S3_BUCKET }}
|
|
||||||
with:
|
|
||||||
gh_ref: "hiru-tokens-in-libs"
|
|
||||||
55
.github/workflows/commit-checker.yml
vendored
55
.github/workflows/commit-checker.yml
vendored
@ -7,16 +7,19 @@ on:
|
|||||||
- reopened
|
- reopened
|
||||||
- synchronize
|
- synchronize
|
||||||
- ready_for_review
|
- ready_for_review
|
||||||
|
pull_request_target:
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- edited
|
||||||
|
- reopened
|
||||||
|
- synchronize
|
||||||
|
- ready_for_review
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
- develop
|
- develop
|
||||||
- staging
|
- staging
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
pull-requests: read
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
check-commit-message:
|
check-commit-message:
|
||||||
if: ${{ !github.event.pull_request.draft }}
|
if: ${{ !github.event.pull_request.draft }}
|
||||||
@ -24,7 +27,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check Commit Type
|
- name: Check Commit Type
|
||||||
uses: gsactions/commit-message-checker@16fa2d5de096ae0d35626443bcd24f1e756cafee # v2.0.0
|
uses: gsactions/commit-message-checker@v2
|
||||||
with:
|
with:
|
||||||
pattern: '^(((:(lipstick|globe_with_meridians|wrench|books|arrow_up|arrow_down|zap|ambulance|construction|boom|fire|whale|bug|sparkles|paperclip|tada|recycle|rewind|construction_worker):)\s[A-Z].*[^.])|(Merge|Revert|Reapply).+[^.])$'
|
pattern: '^(((:(lipstick|globe_with_meridians|wrench|books|arrow_up|arrow_down|zap|ambulance|construction|boom|fire|whale|bug|sparkles|paperclip|tada|recycle|rewind|construction_worker):)\s[A-Z].*[^.])|(Merge|Revert|Reapply).+[^.])$'
|
||||||
flags: 'gm'
|
flags: 'gm'
|
||||||
@ -47,46 +50,4 @@ jobs:
|
|||||||
# pattern: '^.+(Resolves|Fixes): \#[0-9]+$'
|
# pattern: '^.+(Resolves|Fixes): \#[0-9]+$'
|
||||||
# error: 'You need at least one "Resolves|Fixes: #<issue number>" line.'
|
# error: 'You need at least one "Resolves|Fixes: #<issue number>" line.'
|
||||||
|
|
||||||
check-commit-guidelines:
|
|
||||||
if: ${{ !github.event.pull_request.draft }}
|
|
||||||
name: Check Commit Guidelines
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
# On PR events check out the base ref, so the script below is
|
|
||||||
# always the trusted version: PR commits are only read, never
|
|
||||||
# executed. On push events this resolves to the pushed sha.
|
|
||||||
- name: Checkout trusted code
|
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7
|
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
fetch-depth: 0
|
|
||||||
ref: ${{ github.event.pull_request.base.sha || github.sha }}
|
|
||||||
|
|
||||||
- name: Fetch PR commits
|
|
||||||
if: ${{ github.event_name == 'pull_request' || github.event_name == 'pull_request_target' }}
|
|
||||||
run: git fetch --no-tags origin "pull/${{ github.event.pull_request.number }}/head:pr-head"
|
|
||||||
|
|
||||||
- name: Run scripts/check-commit on every new commit
|
|
||||||
run: |
|
|
||||||
set -euo pipefail
|
|
||||||
if [ "${{ github.event_name }}" = "push" ]; then
|
|
||||||
if [ "${{ github.event.before }}" = "0000000000000000000000000000000000000000" ]; then
|
|
||||||
RANGE="${{ github.sha }}"
|
|
||||||
else
|
|
||||||
RANGE="${{ github.event.before }}..${{ github.sha }}"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
RANGE="${{ github.event.pull_request.base.sha }}..pr-head"
|
|
||||||
fi
|
|
||||||
COMMITS="$(git rev-list --reverse "$RANGE")"
|
|
||||||
if [ -z "$COMMITS" ]; then
|
|
||||||
echo "No new commits to check."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
FAILED=0
|
|
||||||
for COMMIT in $COMMITS; do
|
|
||||||
./scripts/check-commit -c "$COMMIT" || FAILED=1
|
|
||||||
done
|
|
||||||
exit "$FAILED"
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
78
.github/workflows/lint-workflows.yml
vendored
78
.github/workflows/lint-workflows.yml
vendored
@ -1,78 +0,0 @@
|
|||||||
name: "CI: Workflows"
|
|
||||||
|
|
||||||
# Static analysis of the GitHub Actions workflows themselves:
|
|
||||||
# - actionlint: syntax, expressions, runner labels, job/step references,
|
|
||||||
# and shellcheck on every `run:` block.
|
|
||||||
# - zizmor: security audits (template injection, dangerous triggers,
|
|
||||||
# credential persistence, ...). Configured in .github/zizmor.yml.
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types: [opened, synchronize, reopened, ready_for_review]
|
|
||||||
paths:
|
|
||||||
- '.github/workflows/**'
|
|
||||||
- '.github/actions/**'
|
|
||||||
- '.github/actionlint.yaml'
|
|
||||||
- '.github/zizmor.yml'
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- develop
|
|
||||||
- staging
|
|
||||||
- main
|
|
||||||
paths:
|
|
||||||
- '.github/workflows/**'
|
|
||||||
- '.github/actions/**'
|
|
||||||
- '.github/actionlint.yaml'
|
|
||||||
- '.github/zizmor.yml'
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: lint-workflows-${{ github.ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
permissions: {}
|
|
||||||
|
|
||||||
env:
|
|
||||||
ACTIONLINT_VERSION: '1.7.12'
|
|
||||||
ZIZMOR_VERSION: '1.32.0'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
lint:
|
|
||||||
name: Lint workflows
|
|
||||||
if: ${{ !github.event.pull_request.draft }}
|
|
||||||
# PR code is untrusted: never run this on the self-hosted runners.
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
timeout-minutes: 10
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Install actionlint
|
|
||||||
run: |
|
|
||||||
curl -fsSL --retry 3 \
|
|
||||||
"https://github.com/rhysd/actionlint/releases/download/v${ACTIONLINT_VERSION}/actionlint_${ACTIONLINT_VERSION}_linux_amd64.tar.gz" \
|
|
||||||
| tar -xz -C "$RUNNER_TEMP" actionlint
|
|
||||||
echo "$RUNNER_TEMP" >> "$GITHUB_PATH"
|
|
||||||
|
|
||||||
# Each finding is emitted as a `::error` annotation on the PR diff.
|
|
||||||
- name: Run actionlint
|
|
||||||
run: |
|
|
||||||
# shellcheck disable=SC2016 # Go template, not shell expansion.
|
|
||||||
actionlint -format '{{range $err := .}}::error file={{$err.Filepath}},line={{$err.Line}},col={{$err.Column}},title=actionlint ({{$err.Kind}})::{{$err.Message}}\n{{end}}'
|
|
||||||
|
|
||||||
- name: Run zizmor
|
|
||||||
if: ${{ !cancelled() }}
|
|
||||||
env:
|
|
||||||
# Enables the online audits (known-vulnerable-actions,
|
|
||||||
# impostor-commit, ref-confusion, ...).
|
|
||||||
GH_TOKEN: ${{ github.token }}
|
|
||||||
run: |
|
|
||||||
pipx run "zizmor==${ZIZMOR_VERSION}" \
|
|
||||||
--config .github/zizmor.yml \
|
|
||||||
--format github \
|
|
||||||
.github/workflows
|
|
||||||
51
.github/workflows/plugins-deploy-api-doc.yml
vendored
51
.github/workflows/plugins-deploy-api-doc.yml
vendored
@ -33,32 +33,48 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Extract some useful variables
|
- name: Extract some useful variables
|
||||||
id: vars
|
id: vars
|
||||||
env:
|
|
||||||
GH_REF: ${{ inputs.gh_ref || github.ref_name }}
|
|
||||||
run: |
|
run: |
|
||||||
echo "gh_ref=$GH_REF" >> $GITHUB_OUTPUT
|
echo "gh_ref=${{ inputs.gh_ref || github.ref_name }}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
ref: ${{ steps.vars.outputs.gh_ref }}
|
ref: ${{ steps.vars.outputs.gh_ref }}
|
||||||
|
|
||||||
# No dependency cache here: a deploy must not restore a cache that
|
# START: Setup Node and PNPM enabling cache
|
||||||
# other workflows can write to.
|
- name: Setup Node.js
|
||||||
- name: Setup pnpm + Node.js
|
uses: actions/setup-node@v6
|
||||||
uses: pnpm/setup@731dfb6463bbd11c11fd0ee11fe00ed0e36d48a1 # v3.2.0
|
|
||||||
with:
|
with:
|
||||||
working-directory: plugins
|
node-version-file: .nvmrc
|
||||||
runtime: node@24.22.3
|
|
||||||
install: false
|
- name: Enable PNPM
|
||||||
|
working-directory: ./plugins
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
corepack enable;
|
||||||
|
corepack install;
|
||||||
|
|
||||||
|
- name: Get pnpm store path
|
||||||
|
id: pnpm-store
|
||||||
|
working-directory: ./plugins
|
||||||
|
shell: bash
|
||||||
|
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Cache pnpm store
|
||||||
|
uses: actions/cache@v5
|
||||||
|
with:
|
||||||
|
path: ${{ steps.pnpm-store.outputs.STORE_PATH }}
|
||||||
|
key: ${{ runner.os }}-pnpm-${{ hashFiles('plugins/pnpm-lock.yaml') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-pnpm-
|
||||||
|
# END: Setup Node and PNPM enabling cache
|
||||||
|
|
||||||
- name: Install deps
|
- name: Install deps
|
||||||
working-directory: ./plugins
|
working-directory: ./plugins
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
pnpm install --frozen-lockfile;
|
pnpm install --no-frozen-lockfile;
|
||||||
pnpm add -D -w wrangler@latest;
|
pnpm add -D -w wrangler@latest;
|
||||||
|
|
||||||
- name: Build docs
|
- name: Build docs
|
||||||
@ -67,9 +83,8 @@ jobs:
|
|||||||
run: pnpm run build:doc
|
run: pnpm run build:doc
|
||||||
|
|
||||||
- name: Select Worker name
|
- name: Select Worker name
|
||||||
env:
|
|
||||||
REF: ${{ steps.vars.outputs.gh_ref }}
|
|
||||||
run: |
|
run: |
|
||||||
|
REF="${{ steps.vars.outputs.gh_ref }}"
|
||||||
case "$REF" in
|
case "$REF" in
|
||||||
main)
|
main)
|
||||||
echo "WORKER_NAME=penpot-plugins-api-doc-pro" >> $GITHUB_ENV
|
echo "WORKER_NAME=penpot-plugins-api-doc-pro" >> $GITHUB_ENV
|
||||||
@ -87,7 +102,7 @@ jobs:
|
|||||||
working-directory: plugins
|
working-directory: plugins
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
sed -i "s/WORKER_URI/${WORKER_URI}/g" wrangler-penpot-plugins-api-doc.toml
|
sed -i "s/WORKER_URI/${{ env.WORKER_URI }}/g" wrangler-penpot-plugins-api-doc.toml
|
||||||
|
|
||||||
- name: Add noindex header and robots.txt files for non-production environments
|
- name: Add noindex header and robots.txt files for non-production environments
|
||||||
if: ${{ steps.vars.outputs.gh_ref != 'main' }}
|
if: ${{ steps.vars.outputs.gh_ref != 'main' }}
|
||||||
@ -107,7 +122,7 @@ jobs:
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
- name: Deploy to Cloudflare Workers
|
- name: Deploy to Cloudflare Workers
|
||||||
uses: cloudflare/wrangler-action@953926a2e2182532811c01a25e53647d93bf07c0 # v4.1.3
|
uses: cloudflare/wrangler-action@v3
|
||||||
with:
|
with:
|
||||||
workingDirectory: plugins
|
workingDirectory: plugins
|
||||||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||||
@ -116,7 +131,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Notify Mattermost
|
- name: Notify Mattermost
|
||||||
if: failure()
|
if: failure()
|
||||||
uses: mattermost/action-mattermost-notify@ae31bb6f9e26a54336e79696f108a2c91cf55b4e # v2.1.0
|
uses: mattermost/action-mattermost-notify@master
|
||||||
with:
|
with:
|
||||||
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK }}
|
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK }}
|
||||||
MATTERMOST_CHANNEL: bot-alerts-cicd
|
MATTERMOST_CHANNEL: bot-alerts-cicd
|
||||||
|
|||||||
90
.github/workflows/plugins-deploy-package.yml
vendored
90
.github/workflows/plugins-deploy-package.yml
vendored
@ -23,89 +23,89 @@ on:
|
|||||||
description: 'Name of the branch'
|
description: 'Name of the branch'
|
||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
|
default: 'develop'
|
||||||
plugin_name:
|
plugin_name:
|
||||||
description: 'Publig name (from plugins/apps/<plugin_name>-plugin)'
|
description: 'Publig name (from plugins/apps/<plugin_name>-plugin)'
|
||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
secrets:
|
|
||||||
CLOUDFLARE_ACCOUNT_ID:
|
|
||||||
required: false
|
|
||||||
CLOUDFLARE_API_TOKEN:
|
|
||||||
required: false
|
|
||||||
MATTERMOST_WEBHOOK:
|
|
||||||
required: false
|
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: read
|
contents: read
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: penpot-standar-runner
|
runs-on: penpot-runner-01
|
||||||
container:
|
|
||||||
image: penpotapp/devenv:latest
|
|
||||||
volumes:
|
|
||||||
# Persistent pnpm store shared by all runner instances on the host.
|
|
||||||
# pnpm's content-addressable store is safe for concurrent access.
|
|
||||||
- /var/cache/github-runner/pnpm-store:/root/.local/share/pnpm/store
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: bash
|
|
||||||
env:
|
|
||||||
GH_REF: ${{ inputs.gh_ref }}
|
|
||||||
PLUGIN_NAME: ${{ inputs.plugin_name }}
|
|
||||||
steps:
|
steps:
|
||||||
# plugin_name is a free-form string that ends up in paths, worker names
|
|
||||||
# and GITHUB_ENV; reject anything that is not a plain slug before it is
|
|
||||||
# used anywhere.
|
|
||||||
- name: Validate inputs
|
|
||||||
run: |
|
|
||||||
if ! [[ "$PLUGIN_NAME" =~ ^[a-z0-9][a-z0-9-]*$ ]]; then
|
|
||||||
echo "::error::Invalid plugin_name: must match ^[a-z0-9][a-z0-9-]*$"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
ref: ${{ inputs.gh_ref }}
|
ref: ${{ inputs.gh_ref }}
|
||||||
|
|
||||||
|
# START: Setup Node and PNPM enabling cache
|
||||||
|
- name: Setup Node.js
|
||||||
|
uses: actions/setup-node@v6
|
||||||
|
with:
|
||||||
|
node-version-file: .nvmrc
|
||||||
|
|
||||||
|
- name: Enable PNPM
|
||||||
|
working-directory: ./plugins
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
corepack enable;
|
||||||
|
corepack install;
|
||||||
|
|
||||||
|
- name: Get pnpm store path
|
||||||
|
id: pnpm-store
|
||||||
|
working-directory: ./plugins
|
||||||
|
shell: bash
|
||||||
|
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Cache pnpm store
|
||||||
|
uses: actions/cache@v5
|
||||||
|
with:
|
||||||
|
path: ${{ steps.pnpm-store.outputs.STORE_PATH }}
|
||||||
|
key: ${{ runner.os }}-pnpm-${{ hashFiles('plugins/pnpm-lock.yaml') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-pnpm-
|
||||||
|
# END: Setup Node and PNPM enabling cache
|
||||||
|
|
||||||
- name: Install deps
|
- name: Install deps
|
||||||
working-directory: ./plugins
|
working-directory: ./plugins
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
pnpm install --frozen-lockfile;
|
pnpm install --no-frozen-lockfile;
|
||||||
pnpm add -D -w wrangler@latest;
|
pnpm add -D -w wrangler@latest;
|
||||||
|
|
||||||
- name: "Build package for ${{ inputs.plugin_name }}-plugin"
|
- name: "Build package for ${{ inputs.plugin_name }}-plugin"
|
||||||
working-directory: plugins
|
working-directory: plugins
|
||||||
shell: bash
|
shell: bash
|
||||||
run: pnpm --filter "${PLUGIN_NAME}-plugin" build
|
run: pnpm --filter ${{ inputs.plugin_name }}-plugin build
|
||||||
|
|
||||||
- name: Select Worker name
|
- name: Select Worker name
|
||||||
run: |
|
run: |
|
||||||
case "$GH_REF" in
|
REF="${{ inputs.gh_ref }}"
|
||||||
|
case "$REF" in
|
||||||
main)
|
main)
|
||||||
echo "WORKER_NAME=${PLUGIN_NAME}-plugin-pro" >> $GITHUB_ENV
|
echo "WORKER_NAME=${{ inputs.plugin_name }}-plugin-pro" >> $GITHUB_ENV
|
||||||
echo "WORKER_URI=${PLUGIN_NAME}.plugins.penpot.app" >> $GITHUB_ENV ;;
|
echo "WORKER_URI=${{ inputs.plugin_name }}.plugins.penpot.app" >> $GITHUB_ENV ;;
|
||||||
staging)
|
staging)
|
||||||
echo "WORKER_NAME=${PLUGIN_NAME}-plugin-pre" >> $GITHUB_ENV
|
echo "WORKER_NAME=${{ inputs.plugin_name }}-plugin-pre" >> $GITHUB_ENV
|
||||||
echo "WORKER_URI=${PLUGIN_NAME}.plugins.penpot.dev" >> $GITHUB_ENV ;;
|
echo "WORKER_URI=${{ inputs.plugin_name }}.plugins.penpot.dev" >> $GITHUB_ENV ;;
|
||||||
develop)
|
develop)
|
||||||
echo "WORKER_NAME=${PLUGIN_NAME}-plugin-hourly" >> $GITHUB_ENV
|
echo "WORKER_NAME=${{ inputs.plugin_name }}-plugin-hourly" >> $GITHUB_ENV
|
||||||
echo "WORKER_URI=${PLUGIN_NAME}.plugins.hourly.penpot.dev" >> $GITHUB_ENV ;;
|
echo "WORKER_URI=${{ inputs.plugin_name }}.plugins.hourly.penpot.dev" >> $GITHUB_ENV ;;
|
||||||
*) echo "Unsupported branch ${GH_REF}" && exit 1 ;;
|
*) echo "Unsupported branch ${REF}" && exit 1 ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
- name: Set the custom url
|
- name: Set the custom url
|
||||||
working-directory: plugins
|
working-directory: plugins
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
sed -i "s/WORKER_URI/${WORKER_URI}/g" "apps/${PLUGIN_NAME}-plugin/wrangler.toml"
|
sed -i "s/WORKER_URI/${{ env.WORKER_URI }}/g" apps/${{ inputs.plugin_name }}-plugin/wrangler.toml
|
||||||
|
|
||||||
- name: Deploy to Cloudflare Workers
|
- name: Deploy to Cloudflare Workers
|
||||||
uses: cloudflare/wrangler-action@953926a2e2182532811c01a25e53647d93bf07c0 # v4.1.3
|
uses: cloudflare/wrangler-action@v3
|
||||||
with:
|
with:
|
||||||
workingDirectory: plugins
|
workingDirectory: plugins
|
||||||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||||
@ -114,7 +114,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Notify Mattermost
|
- name: Notify Mattermost
|
||||||
if: failure()
|
if: failure()
|
||||||
uses: mattermost/action-mattermost-notify@ae31bb6f9e26a54336e79696f108a2c91cf55b4e # v2.1.0
|
uses: mattermost/action-mattermost-notify@master
|
||||||
with:
|
with:
|
||||||
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK }}
|
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK }}
|
||||||
MATTERMOST_CHANNEL: bot-alerts-cicd
|
MATTERMOST_CHANNEL: bot-alerts-cicd
|
||||||
|
|||||||
44
.github/workflows/plugins-deploy-packages.yml
vendored
44
.github/workflows/plugins-deploy-packages.yml
vendored
@ -21,9 +21,6 @@ on:
|
|||||||
- staging
|
- staging
|
||||||
- main
|
- main
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
detect-changes:
|
detect-changes:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
@ -39,11 +36,9 @@ jobs:
|
|||||||
# [For new plugins]
|
# [For new plugins]
|
||||||
# Add more outputs here
|
# Add more outputs here
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
- uses: actions/checkout@v6
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
- id: filter
|
- id: filter
|
||||||
uses: dorny/paths-filter@ceb8a2b8f2d89434be7ff52d3de7ec3738c5cc9d # v4.0.3
|
uses: dorny/paths-filter@v4
|
||||||
with:
|
with:
|
||||||
filters: |
|
filters: |
|
||||||
colors_to_tokens:
|
colors_to_tokens:
|
||||||
@ -77,10 +72,7 @@ jobs:
|
|||||||
needs: detect-changes
|
needs: detect-changes
|
||||||
if: github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.colors_to_tokens == 'true'
|
if: github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.colors_to_tokens == 'true'
|
||||||
uses: ./.github/workflows/plugins-deploy-package.yml
|
uses: ./.github/workflows/plugins-deploy-package.yml
|
||||||
secrets:
|
secrets: inherit
|
||||||
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
||||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
||||||
MATTERMOST_WEBHOOK: ${{ secrets.MATTERMOST_WEBHOOK }}
|
|
||||||
with:
|
with:
|
||||||
gh_ref: "${{ inputs.gh_ref || github.ref_name }}"
|
gh_ref: "${{ inputs.gh_ref || github.ref_name }}"
|
||||||
plugin_name: colors-to-tokens
|
plugin_name: colors-to-tokens
|
||||||
@ -89,10 +81,7 @@ jobs:
|
|||||||
needs: detect-changes
|
needs: detect-changes
|
||||||
if: github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.contrast == 'true'
|
if: github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.contrast == 'true'
|
||||||
uses: ./.github/workflows/plugins-deploy-package.yml
|
uses: ./.github/workflows/plugins-deploy-package.yml
|
||||||
secrets:
|
secrets: inherit
|
||||||
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
||||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
||||||
MATTERMOST_WEBHOOK: ${{ secrets.MATTERMOST_WEBHOOK }}
|
|
||||||
with:
|
with:
|
||||||
gh_ref: "${{ inputs.gh_ref || github.ref_name }}"
|
gh_ref: "${{ inputs.gh_ref || github.ref_name }}"
|
||||||
plugin_name: contrast
|
plugin_name: contrast
|
||||||
@ -101,10 +90,7 @@ jobs:
|
|||||||
needs: detect-changes
|
needs: detect-changes
|
||||||
if: github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.create_palette == 'true'
|
if: github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.create_palette == 'true'
|
||||||
uses: ./.github/workflows/plugins-deploy-package.yml
|
uses: ./.github/workflows/plugins-deploy-package.yml
|
||||||
secrets:
|
secrets: inherit
|
||||||
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
||||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
||||||
MATTERMOST_WEBHOOK: ${{ secrets.MATTERMOST_WEBHOOK }}
|
|
||||||
with:
|
with:
|
||||||
gh_ref: "${{ inputs.gh_ref || github.ref_name }}"
|
gh_ref: "${{ inputs.gh_ref || github.ref_name }}"
|
||||||
plugin_name: create-palette
|
plugin_name: create-palette
|
||||||
@ -113,10 +99,7 @@ jobs:
|
|||||||
needs: detect-changes
|
needs: detect-changes
|
||||||
if: github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.icons == 'true'
|
if: github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.icons == 'true'
|
||||||
uses: ./.github/workflows/plugins-deploy-package.yml
|
uses: ./.github/workflows/plugins-deploy-package.yml
|
||||||
secrets:
|
secrets: inherit
|
||||||
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
||||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
||||||
MATTERMOST_WEBHOOK: ${{ secrets.MATTERMOST_WEBHOOK }}
|
|
||||||
with:
|
with:
|
||||||
gh_ref: "${{ inputs.gh_ref || github.ref_name }}"
|
gh_ref: "${{ inputs.gh_ref || github.ref_name }}"
|
||||||
plugin_name: icons
|
plugin_name: icons
|
||||||
@ -125,10 +108,7 @@ jobs:
|
|||||||
needs: detect-changes
|
needs: detect-changes
|
||||||
if: github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.lorem_ipsum == 'true'
|
if: github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.lorem_ipsum == 'true'
|
||||||
uses: ./.github/workflows/plugins-deploy-package.yml
|
uses: ./.github/workflows/plugins-deploy-package.yml
|
||||||
secrets:
|
secrets: inherit
|
||||||
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
||||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
||||||
MATTERMOST_WEBHOOK: ${{ secrets.MATTERMOST_WEBHOOK }}
|
|
||||||
with:
|
with:
|
||||||
gh_ref: "${{ inputs.gh_ref || github.ref_name }}"
|
gh_ref: "${{ inputs.gh_ref || github.ref_name }}"
|
||||||
plugin_name: lorem-ipsum
|
plugin_name: lorem-ipsum
|
||||||
@ -137,10 +117,7 @@ jobs:
|
|||||||
needs: detect-changes
|
needs: detect-changes
|
||||||
if: github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.rename_layers == 'true'
|
if: github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.rename_layers == 'true'
|
||||||
uses: ./.github/workflows/plugins-deploy-package.yml
|
uses: ./.github/workflows/plugins-deploy-package.yml
|
||||||
secrets:
|
secrets: inherit
|
||||||
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
||||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
||||||
MATTERMOST_WEBHOOK: ${{ secrets.MATTERMOST_WEBHOOK }}
|
|
||||||
with:
|
with:
|
||||||
gh_ref: "${{ inputs.gh_ref || github.ref_name }}"
|
gh_ref: "${{ inputs.gh_ref || github.ref_name }}"
|
||||||
plugin_name: rename-layers
|
plugin_name: rename-layers
|
||||||
@ -149,10 +126,7 @@ jobs:
|
|||||||
needs: detect-changes
|
needs: detect-changes
|
||||||
if: github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.table == 'true'
|
if: github.event_name == 'workflow_dispatch' || needs.detect-changes.outputs.table == 'true'
|
||||||
uses: ./.github/workflows/plugins-deploy-package.yml
|
uses: ./.github/workflows/plugins-deploy-package.yml
|
||||||
secrets:
|
secrets: inherit
|
||||||
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
||||||
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
||||||
MATTERMOST_WEBHOOK: ${{ secrets.MATTERMOST_WEBHOOK }}
|
|
||||||
with:
|
with:
|
||||||
gh_ref: "${{ inputs.gh_ref || github.ref_name }}"
|
gh_ref: "${{ inputs.gh_ref || github.ref_name }}"
|
||||||
plugin_name: table
|
plugin_name: table
|
||||||
|
|||||||
51
.github/workflows/plugins-deploy-styles-doc.yml
vendored
51
.github/workflows/plugins-deploy-styles-doc.yml
vendored
@ -31,32 +31,48 @@ jobs:
|
|||||||
steps:
|
steps:
|
||||||
- name: Extract some useful variables
|
- name: Extract some useful variables
|
||||||
id: vars
|
id: vars
|
||||||
env:
|
|
||||||
GH_REF: ${{ inputs.gh_ref || github.ref_name }}
|
|
||||||
run: |
|
run: |
|
||||||
echo "gh_ref=$GH_REF" >> $GITHUB_OUTPUT
|
echo "gh_ref=${{ inputs.gh_ref || github.ref_name }}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
ref: ${{ steps.vars.outputs.gh_ref }}
|
ref: ${{ steps.vars.outputs.gh_ref }}
|
||||||
|
|
||||||
# No dependency cache here: a deploy must not restore a cache that
|
# START: Setup Node and PNPM enabling cache
|
||||||
# other workflows can write to.
|
- name: Setup Node.js
|
||||||
- name: Setup pnpm + Node.js
|
uses: actions/setup-node@v6
|
||||||
uses: pnpm/setup@731dfb6463bbd11c11fd0ee11fe00ed0e36d48a1 # v3.2.0
|
|
||||||
with:
|
with:
|
||||||
working-directory: plugins
|
node-version-file: .nvmrc
|
||||||
runtime: node@24.22.3
|
|
||||||
install: false
|
- name: Enable PNPM
|
||||||
|
working-directory: ./plugins
|
||||||
|
shell: bash
|
||||||
|
run: |
|
||||||
|
corepack enable;
|
||||||
|
corepack install;
|
||||||
|
|
||||||
|
- name: Get pnpm store path
|
||||||
|
id: pnpm-store
|
||||||
|
working-directory: ./plugins
|
||||||
|
shell: bash
|
||||||
|
run: echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
|
- name: Cache pnpm store
|
||||||
|
uses: actions/cache@v5
|
||||||
|
with:
|
||||||
|
path: ${{ steps.pnpm-store.outputs.STORE_PATH }}
|
||||||
|
key: ${{ runner.os }}-pnpm-${{ hashFiles('plugins/pnpm-lock.yaml') }}
|
||||||
|
restore-keys: |
|
||||||
|
${{ runner.os }}-pnpm-
|
||||||
|
# END: Setup Node and PNPM enabling cache
|
||||||
|
|
||||||
- name: Install deps
|
- name: Install deps
|
||||||
working-directory: ./plugins
|
working-directory: ./plugins
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
pnpm install --frozen-lockfile;
|
pnpm install --no-frozen-lockfile;
|
||||||
pnpm add -D -w wrangler@latest;
|
pnpm add -D -w wrangler@latest;
|
||||||
|
|
||||||
- name: Build styles
|
- name: Build styles
|
||||||
@ -65,9 +81,8 @@ jobs:
|
|||||||
run: pnpm run build:styles-example
|
run: pnpm run build:styles-example
|
||||||
|
|
||||||
- name: Select Worker name
|
- name: Select Worker name
|
||||||
env:
|
|
||||||
REF: ${{ steps.vars.outputs.gh_ref }}
|
|
||||||
run: |
|
run: |
|
||||||
|
REF="${{ steps.vars.outputs.gh_ref }}"
|
||||||
case "$REF" in
|
case "$REF" in
|
||||||
main)
|
main)
|
||||||
echo "WORKER_NAME=penpot-plugins-styles-doc-pro" >> $GITHUB_ENV
|
echo "WORKER_NAME=penpot-plugins-styles-doc-pro" >> $GITHUB_ENV
|
||||||
@ -85,7 +100,7 @@ jobs:
|
|||||||
working-directory: plugins
|
working-directory: plugins
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
sed -i "s/WORKER_URI/${WORKER_URI}/g" wrangler-penpot-plugins-styles-doc.toml
|
sed -i "s/WORKER_URI/${{ env.WORKER_URI }}/g" wrangler-penpot-plugins-styles-doc.toml
|
||||||
|
|
||||||
- name: Add noindex header and robots.txt files for non-production environments
|
- name: Add noindex header and robots.txt files for non-production environments
|
||||||
if: ${{ steps.vars.outputs.gh_ref != 'main' }}
|
if: ${{ steps.vars.outputs.gh_ref != 'main' }}
|
||||||
@ -105,7 +120,7 @@ jobs:
|
|||||||
EOF
|
EOF
|
||||||
|
|
||||||
- name: Deploy to Cloudflare Workers
|
- name: Deploy to Cloudflare Workers
|
||||||
uses: cloudflare/wrangler-action@953926a2e2182532811c01a25e53647d93bf07c0 # v4.1.3
|
uses: cloudflare/wrangler-action@v3
|
||||||
with:
|
with:
|
||||||
workingDirectory: plugins
|
workingDirectory: plugins
|
||||||
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
|
||||||
@ -114,7 +129,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Notify Mattermost
|
- name: Notify Mattermost
|
||||||
if: failure()
|
if: failure()
|
||||||
uses: mattermost/action-mattermost-notify@ae31bb6f9e26a54336e79696f108a2c91cf55b4e # v2.1.0
|
uses: mattermost/action-mattermost-notify@master
|
||||||
with:
|
with:
|
||||||
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK }}
|
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK }}
|
||||||
MATTERMOST_CHANNEL: bot-alerts-cicd
|
MATTERMOST_CHANNEL: bot-alerts-cicd
|
||||||
|
|||||||
47
.github/workflows/release.yml
vendored
47
.github/workflows/release.yml
vendored
@ -13,49 +13,31 @@ on:
|
|||||||
description: 'Tag to release'
|
description: 'Tag to release'
|
||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
secrets:
|
|
||||||
AWS_REGION:
|
|
||||||
required: false
|
|
||||||
DOCKER_PASSWORD:
|
|
||||||
required: false
|
|
||||||
DOCKER_REGISTRY:
|
|
||||||
required: false
|
|
||||||
DOCKER_USERNAME:
|
|
||||||
required: false
|
|
||||||
MATTERMOST_WEBHOOK:
|
|
||||||
required: false
|
|
||||||
PUB_DOCKER_PASSWORD:
|
|
||||||
required: false
|
|
||||||
PUB_DOCKER_USERNAME:
|
|
||||||
required: false
|
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
release:
|
release:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-24.04
|
||||||
outputs:
|
outputs:
|
||||||
version: ${{ steps.vars.outputs.gh_ref }}
|
version: ${{ steps.vars.outputs.gh_ref }}
|
||||||
release_notes: ${{ steps.extract_release_notes.outputs.release_notes }}
|
release_notes: ${{ steps.extract_release_notes.outputs.release_notes }}
|
||||||
steps:
|
steps:
|
||||||
- name: Extract some useful variables
|
- name: Extract some useful variables
|
||||||
id: vars
|
id: vars
|
||||||
env:
|
|
||||||
GH_REF: ${{ inputs.gh_ref || github.ref_name }}
|
|
||||||
run: |
|
run: |
|
||||||
echo "gh_ref=$GH_REF" >> $GITHUB_OUTPUT
|
echo "gh_ref=${{ inputs.gh_ref || github.ref_name }}" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
uses: actions/checkout@v6
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
|
||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
ref: ${{ steps.vars.outputs.gh_ref }}
|
ref: ${{ steps.vars.outputs.gh_ref }}
|
||||||
|
|
||||||
# --- Publicly release the docker images ---
|
# --- Publicly release the docker images ---
|
||||||
- name: Configure ECR credentials
|
- name: Configure ECR credentials
|
||||||
uses: aws-actions/configure-aws-credentials@e1253824e5c10ff9df46874f81ed3ec929e19cfd # v6.3.0
|
uses: aws-actions/configure-aws-credentials@v4
|
||||||
with:
|
with:
|
||||||
aws-access-key-id: ${{ secrets.DOCKER_USERNAME }}
|
aws-access-key-id: ${{ secrets.DOCKER_USERNAME }}
|
||||||
aws-secret-access-key: ${{ secrets.DOCKER_PASSWORD }}
|
aws-secret-access-key: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
@ -80,7 +62,7 @@ jobs:
|
|||||||
|
|
||||||
echo "$PUB_DOCKER_PASSWORD" | skopeo login --username "$PUB_DOCKER_USERNAME" --password-stdin docker.io
|
echo "$PUB_DOCKER_PASSWORD" | skopeo login --username "$PUB_DOCKER_USERNAME" --password-stdin docker.io
|
||||||
|
|
||||||
IMAGES=("frontend" "backend" "exporter" "admin-console" "mcp" "storybook")
|
IMAGES=("frontend" "backend" "exporter" "mcp" "storybook")
|
||||||
SHORT_TAG=${TAG%.*}
|
SHORT_TAG=${TAG%.*}
|
||||||
|
|
||||||
for image in "${IMAGES[@]}"; do
|
for image in "${IMAGES[@]}"; do
|
||||||
@ -110,23 +92,18 @@ jobs:
|
|||||||
echo "EOF" >> $GITHUB_OUTPUT
|
echo "EOF" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
# --- Create GitHub release ---
|
# --- Create GitHub release ---
|
||||||
# Updates the release if it already exists, so re-running is safe.
|
|
||||||
- name: Create GitHub release
|
- name: Create GitHub release
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
env:
|
env:
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
GH_REPO: ${{ github.repository }}
|
with:
|
||||||
TAG: ${{ steps.vars.outputs.gh_ref }}
|
tag_name: ${{ steps.vars.outputs.gh_ref }}
|
||||||
NOTES: ${{ steps.extract_release_notes.outputs.release_notes }}
|
name: ${{ steps.vars.outputs.gh_ref }}
|
||||||
run: |
|
body: ${{ steps.extract_release_notes.outputs.release_notes }}
|
||||||
if gh release view "$TAG" > /dev/null 2>&1; then
|
|
||||||
gh release edit "$TAG" --title "$TAG" --notes "$NOTES"
|
|
||||||
else
|
|
||||||
gh release create "$TAG" --verify-tag --title "$TAG" --notes "$NOTES"
|
|
||||||
fi
|
|
||||||
|
|
||||||
- name: Notify Mattermost
|
- name: Notify Mattermost
|
||||||
if: failure()
|
if: failure()
|
||||||
uses: mattermost/action-mattermost-notify@ae31bb6f9e26a54336e79696f108a2c91cf55b4e # v2.1.0
|
uses: mattermost/action-mattermost-notify@master
|
||||||
with:
|
with:
|
||||||
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK }}
|
MATTERMOST_WEBHOOK_URL: ${{ secrets.MATTERMOST_WEBHOOK }}
|
||||||
MATTERMOST_CHANNEL: bot-alerts-cicd
|
MATTERMOST_CHANNEL: bot-alerts-cicd
|
||||||
|
|||||||
@ -1,76 +0,0 @@
|
|||||||
name: Require Milestone on Linked Issues
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types:
|
|
||||||
- opened
|
|
||||||
- reopened
|
|
||||||
- synchronize
|
|
||||||
- edited
|
|
||||||
- ready_for_review
|
|
||||||
- converted_to_draft
|
|
||||||
workflow_dispatch:
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
pull-requests: read
|
|
||||||
issues: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
check-linked-issues:
|
|
||||||
name: Require Milestones on Linked Issues
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Check linked issues
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
||||||
IS_DRAFT: ${{ github.event.pull_request.draft }}
|
|
||||||
REPOSITORY: ${{ github.repository }}
|
|
||||||
run: |
|
|
||||||
if [ "$IS_DRAFT" = "true" ]; then
|
|
||||||
echo "Draft PR: milestone check skipped."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
OWNER="${REPOSITORY%%/*}"
|
|
||||||
REPO="${REPOSITORY#*/}"
|
|
||||||
|
|
||||||
# shellcheck disable=SC2016 # GraphQL variables, not shell expansion.
|
|
||||||
ISSUES=$(gh api graphql \
|
|
||||||
-F owner="$OWNER" \
|
|
||||||
-F repo="$REPO" \
|
|
||||||
-F number="$PR_NUMBER" \
|
|
||||||
-f query='
|
|
||||||
query($owner: String!, $repo: String!, $number: Int!) {
|
|
||||||
repository(owner: $owner, name: $repo) {
|
|
||||||
pullRequest(number: $number) {
|
|
||||||
closingIssuesReferences(first: 100) {
|
|
||||||
nodes {
|
|
||||||
number
|
|
||||||
title
|
|
||||||
url
|
|
||||||
milestone {
|
|
||||||
title
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
')
|
|
||||||
|
|
||||||
MISSING=$(echo "$ISSUES" | jq -r '
|
|
||||||
.data.repository.pullRequest.closingIssuesReferences.nodes[]
|
|
||||||
| select(.milestone == null)
|
|
||||||
| "- #\(.number): \(.title) (\(.url))"
|
|
||||||
')
|
|
||||||
|
|
||||||
if [ -n "$MISSING" ]; then
|
|
||||||
echo "::error::The following linked issues have no milestone:"
|
|
||||||
echo "$MISSING"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "All linked issues have a milestone."
|
|
||||||
45
.github/workflows/require-milestone.yml
vendored
45
.github/workflows/require-milestone.yml
vendored
@ -1,45 +0,0 @@
|
|||||||
name: Require Milestone
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
types:
|
|
||||||
- opened
|
|
||||||
- reopened
|
|
||||||
- synchronize
|
|
||||||
- edited
|
|
||||||
- milestoned
|
|
||||||
- demilestoned
|
|
||||||
- ready_for_review
|
|
||||||
- converted_to_draft
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
pull-requests: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
check-milestone:
|
|
||||||
name: Require Milestone
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Check milestone
|
|
||||||
env:
|
|
||||||
GH_TOKEN: ${{ github.token }}
|
|
||||||
PR_NUMBER: ${{ github.event.pull_request.number }}
|
|
||||||
run: |
|
|
||||||
pr_api="repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}"
|
|
||||||
|
|
||||||
is_draft=$(gh api "$pr_api" --jq '.draft')
|
|
||||||
milestone=$(gh api "$pr_api" --jq '.milestone.title // ""')
|
|
||||||
|
|
||||||
if [ "$is_draft" = "true" ]; then
|
|
||||||
echo "Draft PR: milestone check skipped."
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$milestone" ]; then
|
|
||||||
echo "::error::This pull request must have a milestone."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Milestone assigned: $milestone"
|
|
||||||
26
.github/workflows/tests-backend.yml
vendored
26
.github/workflows/tests-backend.yml
vendored
@ -28,14 +28,11 @@ concurrency:
|
|||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-backend:
|
test-backend:
|
||||||
if: ${{ !github.event.pull_request.draft }}
|
if: ${{ !github.event.pull_request.draft }}
|
||||||
name: "Backend Tests"
|
name: "Backend Tests"
|
||||||
runs-on: penpot-extended-runner
|
runs-on: penpot-runner-02
|
||||||
container:
|
container:
|
||||||
image: penpotapp/devenv:latest
|
image: penpotapp/devenv:latest
|
||||||
volumes:
|
volumes:
|
||||||
@ -63,27 +60,20 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
uses: actions/checkout@v6
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Fmt
|
|
||||||
working-directory: ./backend
|
|
||||||
run: |
|
|
||||||
cljfmt check --parallel=true src/ test/
|
|
||||||
|
|
||||||
- name: Lint
|
- name: Lint
|
||||||
working-directory: ./backend
|
working-directory: ./backend
|
||||||
run: |
|
run: |
|
||||||
clj-kondo --parallel --lint ../common/src/ src/
|
corepack enable;
|
||||||
|
corepack install;
|
||||||
|
pnpm install;
|
||||||
|
pnpm run check-fmt
|
||||||
|
pnpm run lint
|
||||||
|
|
||||||
- name: Tests
|
- name: Tests
|
||||||
working-directory: ./backend
|
working-directory: ./backend
|
||||||
env:
|
env:
|
||||||
# `clojure.core/assert` is elided at compile time, so without this
|
|
||||||
# flag the precondition asserts do not exist in the compiled code
|
|
||||||
# and the suite silently stops checking them.
|
|
||||||
PENPOT_FLAGS: "enable-backend-asserts"
|
|
||||||
PENPOT_TEST_DATABASE_URI: "postgresql://postgres/penpot_test"
|
PENPOT_TEST_DATABASE_URI: "postgresql://postgres/penpot_test"
|
||||||
PENPOT_TEST_DATABASE_USERNAME: penpot_test
|
PENPOT_TEST_DATABASE_USERNAME: penpot_test
|
||||||
PENPOT_TEST_DATABASE_PASSWORD: penpot_test
|
PENPOT_TEST_DATABASE_PASSWORD: penpot_test
|
||||||
@ -91,4 +81,4 @@ jobs:
|
|||||||
|
|
||||||
run: |
|
run: |
|
||||||
mkdir -p /tmp/penpot;
|
mkdir -p /tmp/penpot;
|
||||||
clojure -M:dev:test
|
clojure -M:dev:test --reporter kaocha.report/documentation
|
||||||
|
|||||||
11
.github/workflows/tests-common.yml
vendored
11
.github/workflows/tests-common.yml
vendored
@ -26,14 +26,11 @@ concurrency:
|
|||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-common:
|
test-common:
|
||||||
if: ${{ !github.event.pull_request.draft }}
|
if: ${{ !github.event.pull_request.draft }}
|
||||||
name: "Common Tests"
|
name: "Common Tests"
|
||||||
runs-on: penpot-extended-runner
|
runs-on: penpot-runner-02
|
||||||
container:
|
container:
|
||||||
image: penpotapp/devenv:latest
|
image: penpotapp/devenv:latest
|
||||||
volumes:
|
volumes:
|
||||||
@ -42,13 +39,13 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
uses: actions/checkout@v6
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Lint
|
- name: Lint
|
||||||
working-directory: ./common
|
working-directory: ./common
|
||||||
run: |
|
run: |
|
||||||
|
corepack enable;
|
||||||
|
corepack install;
|
||||||
pnpm install;
|
pnpm install;
|
||||||
pnpm run check-fmt:clj
|
pnpm run check-fmt:clj
|
||||||
pnpm run check-fmt:js
|
pnpm run check-fmt:js
|
||||||
|
|||||||
430
.github/workflows/tests-e2e.yml
vendored
430
.github/workflows/tests-e2e.yml
vendored
@ -1,430 +0,0 @@
|
|||||||
name: "CI: E2E"
|
|
||||||
|
|
||||||
# Single entry point for every suite that drives a real frontend bundle.
|
|
||||||
# The bundle is built ONCE by `build-bundle` and restored by every consumer,
|
|
||||||
# so adding a suite no longer adds another `frontend/scripts/build` run.
|
|
||||||
#
|
|
||||||
# Suites and what they need from the bundle:
|
|
||||||
#
|
|
||||||
# - Integration Tests: Playwright specs, backend faked with frontend mocks.
|
|
||||||
# - Composable test suite: Plugin runtime, backend faked with Playwright RPC
|
|
||||||
# fixtures. See plugins/apps/composable-test-suite/README.md ("Running in CI").
|
|
||||||
# - Plugin API Test Suite (mocked): Plugin runtime, backend faked with
|
|
||||||
# Playwright RPC fixtures and MOCK_BACKEND=1.
|
|
||||||
# See plugins/apps/plugin-api-test-suite/README.md.
|
|
||||||
#
|
|
||||||
# Hand-off: `build-bundle` restores `actions/cache` keyed by the checked-out
|
|
||||||
# SHA, builds only on a miss, and saves it; every consumer restores the same
|
|
||||||
# key after `needs: build-bundle` completes. A re-run of the same SHA reuses
|
|
||||||
# the cached bundle instead of rebuilding it.
|
|
||||||
#
|
|
||||||
# NOTE: the job `name:` values are the GitHub check contexts, so they are kept
|
|
||||||
# stable on purpose (branch protection may require them by name). Only the
|
|
||||||
# workflow file/name changed.
|
|
||||||
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
gh_ref:
|
|
||||||
description: 'Name of the branch or ref'
|
|
||||||
type: string
|
|
||||||
required: true
|
|
||||||
default: 'develop'
|
|
||||||
|
|
||||||
shards:
|
|
||||||
description: 'Shard layout (JSON array)'
|
|
||||||
type: choice
|
|
||||||
required: true
|
|
||||||
default: '[1, 2, 3, 4]'
|
|
||||||
options:
|
|
||||||
- '[1, 2, 3, 4]'
|
|
||||||
- '[1, 2, 3, 4, 5, 6]'
|
|
||||||
- '[1, 2]'
|
|
||||||
- '[1]'
|
|
||||||
|
|
||||||
workers:
|
|
||||||
description: 'Playwright workers per shard'
|
|
||||||
type: string
|
|
||||||
required: true
|
|
||||||
default: '2'
|
|
||||||
|
|
||||||
base_url:
|
|
||||||
description: 'Penpot base URL for the (disabled) live Plugin API suite'
|
|
||||||
required: false
|
|
||||||
default: 'https://localhost:3449'
|
|
||||||
|
|
||||||
pull_request:
|
|
||||||
paths:
|
|
||||||
- 'frontend/**'
|
|
||||||
- 'common/**'
|
|
||||||
- 'render-wasm/**'
|
|
||||||
- 'plugins/**'
|
|
||||||
- '.github/workflows/tests-e2e.yml'
|
|
||||||
|
|
||||||
types:
|
|
||||||
- opened
|
|
||||||
- synchronize
|
|
||||||
- ready_for_review
|
|
||||||
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- develop
|
|
||||||
- staging
|
|
||||||
|
|
||||||
paths:
|
|
||||||
- 'frontend/**'
|
|
||||||
- 'common/**'
|
|
||||||
- 'render-wasm/**'
|
|
||||||
- 'plugins/**'
|
|
||||||
- '.github/workflows/tests-e2e.yml'
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || inputs.gh_ref || github.ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
# ── 1. Build the frontend bundle once ──────────────────────────────────
|
|
||||||
build-bundle:
|
|
||||||
if: ${{ !github.event.pull_request.draft }}
|
|
||||||
name: "Build Integration Bundle"
|
|
||||||
runs-on: penpot-extended-runner
|
|
||||||
timeout-minutes: 30
|
|
||||||
|
|
||||||
container:
|
|
||||||
image: penpotapp/devenv:latest
|
|
||||||
volumes:
|
|
||||||
- /var/cache/github-runner/m2:/root/.m2
|
|
||||||
- /var/cache/github-runner/gitlib:/root/.gitlibs
|
|
||||||
|
|
||||||
outputs:
|
|
||||||
bundle_key: ${{ steps.vars.outputs.bundle_key }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
# An empty `ref` makes checkout fall back to its default (the PR merge
|
|
||||||
# ref on pull_request, the pushed ref on push).
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
ref: ${{ inputs.gh_ref }}
|
|
||||||
|
|
||||||
# The cache key must come from the SHA actually checked out: on a manual
|
|
||||||
# run `github.sha` points at the dispatching ref, not at `gh_ref`.
|
|
||||||
- name: Extract cache key
|
|
||||||
id: vars
|
|
||||||
run: |
|
|
||||||
echo "bundle_key=frontend-bundle-$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
|
|
||||||
|
|
||||||
- name: Restore Bundle Cache
|
|
||||||
id: restore
|
|
||||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
||||||
with:
|
|
||||||
key: ${{ steps.vars.outputs.bundle_key }}
|
|
||||||
path: frontend/resources/public
|
|
||||||
|
|
||||||
- name: Build Bundle
|
|
||||||
if: steps.restore.outputs.cache-hit != 'true'
|
|
||||||
working-directory: ./frontend
|
|
||||||
run: |
|
|
||||||
./scripts/build
|
|
||||||
|
|
||||||
- name: Store Bundle Cache
|
|
||||||
if: steps.restore.outputs.cache-hit != 'true'
|
|
||||||
uses: actions/cache/save@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
||||||
with:
|
|
||||||
key: ${{ steps.vars.outputs.bundle_key }}
|
|
||||||
path: frontend/resources/public
|
|
||||||
|
|
||||||
# ── 2. Consumers: restore the bundle, never rebuild it ─────────────────
|
|
||||||
test-integration:
|
|
||||||
if: ${{ !github.event.pull_request.draft }}
|
|
||||||
name: "Integration Tests (${{ matrix.shard }})"
|
|
||||||
runs-on: penpot-extended-runner
|
|
||||||
timeout-minutes: 40
|
|
||||||
|
|
||||||
needs: build-bundle
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
shard: ${{ fromJSON(inputs.shards || '[1, 2, 3, 4]') }}
|
|
||||||
|
|
||||||
container:
|
|
||||||
image: penpotapp/devenv:latest
|
|
||||||
volumes:
|
|
||||||
- /var/cache/github-runner/m2:/root/.m2
|
|
||||||
- /var/cache/github-runner/gitlib:/root/.gitlibs
|
|
||||||
- /var/cache/github-runner/ms-playwright:/ms-playwright
|
|
||||||
env:
|
|
||||||
PLAYWRIGHT_BROWSERS_PATH: /ms-playwright
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout Repository
|
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
ref: ${{ inputs.gh_ref }}
|
|
||||||
|
|
||||||
- name: Restore Cache
|
|
||||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
||||||
with:
|
|
||||||
key: ${{ needs.build-bundle.outputs.bundle_key }}
|
|
||||||
path: frontend/resources/public
|
|
||||||
fail-on-cache-miss: true
|
|
||||||
|
|
||||||
- name: Install deps
|
|
||||||
working-directory: ./frontend
|
|
||||||
run: |
|
|
||||||
pnpm install --frozen-lockfile;
|
|
||||||
|
|
||||||
# No-op once the shared volume is warm; keeps the first run working.
|
|
||||||
- name: Install Playwright Chromium
|
|
||||||
working-directory: ./frontend
|
|
||||||
run: pnpm exec playwright install chromium
|
|
||||||
|
|
||||||
# `strategy.job-total` is the matrix size, so the shard denominator
|
|
||||||
# follows the `shards` input without being hardcoded.
|
|
||||||
- name: Run Tests
|
|
||||||
working-directory: ./frontend
|
|
||||||
env:
|
|
||||||
WORKERS: ${{ inputs.workers }}
|
|
||||||
SHARD: ${{ matrix.shard }}
|
|
||||||
SHARD_TOTAL: ${{ strategy.job-total }}
|
|
||||||
run: |
|
|
||||||
WORKERS=${WORKERS:-2}
|
|
||||||
echo "Running shard ${SHARD}/${SHARD_TOTAL} with $WORKERS workers"
|
|
||||||
pnpm exec playwright test --project default \
|
|
||||||
--workers="$WORKERS" \
|
|
||||||
--shard="${SHARD}/${SHARD_TOTAL}" \
|
|
||||||
--reporter=blob
|
|
||||||
|
|
||||||
- name: Upload blob report
|
|
||||||
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
||||||
if: always()
|
|
||||||
with:
|
|
||||||
name: integration-blob-report-${{ matrix.shard }}
|
|
||||||
path: frontend/blob-report/
|
|
||||||
overwrite: true
|
|
||||||
retention-days: 3
|
|
||||||
|
|
||||||
- name: Upload test result
|
|
||||||
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
||||||
if: always()
|
|
||||||
with:
|
|
||||||
name: integration-tests-result-${{ matrix.shard }}
|
|
||||||
path: frontend/test-results/
|
|
||||||
overwrite: true
|
|
||||||
if-no-files-found: ignore
|
|
||||||
retention-days: 3
|
|
||||||
|
|
||||||
composable-test-suite:
|
|
||||||
if: ${{ github.event_name != 'workflow_dispatch' && !github.event.pull_request.draft }}
|
|
||||||
name: "Run composable test suite (mocked backend)"
|
|
||||||
runs-on: penpot-extended-runner
|
|
||||||
timeout-minutes: 30
|
|
||||||
|
|
||||||
needs: build-bundle
|
|
||||||
|
|
||||||
container:
|
|
||||||
image: penpotapp/devenv:latest
|
|
||||||
volumes:
|
|
||||||
- /var/cache/github-runner/m2:/root/.m2
|
|
||||||
- /var/cache/github-runner/gitlib:/root/.gitlibs
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
# The driver serves the prebuilt bundle from frontend/resources/public.
|
|
||||||
- name: Restore Cache
|
|
||||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
||||||
with:
|
|
||||||
key: ${{ needs.build-bundle.outputs.bundle_key }}
|
|
||||||
path: frontend/resources/public
|
|
||||||
fail-on-cache-miss: true
|
|
||||||
|
|
||||||
- name: Install deps
|
|
||||||
working-directory: ./plugins
|
|
||||||
run: |
|
|
||||||
pnpm install;
|
|
||||||
|
|
||||||
- name: Install Playwright Chromium
|
|
||||||
working-directory: ./plugins
|
|
||||||
run: pnpm --filter composable-test-suite exec playwright install --with-deps chromium
|
|
||||||
|
|
||||||
- name: Run composable test suite (mocked)
|
|
||||||
working-directory: ./plugins
|
|
||||||
run: pnpm --filter composable-test-suite run test:ci
|
|
||||||
|
|
||||||
api-test-suite-mocked:
|
|
||||||
if: ${{ github.event_name != 'workflow_dispatch' && !github.event.pull_request.draft }}
|
|
||||||
name: "Run Plugin API Test Suite (mocked)"
|
|
||||||
runs-on: penpot-extended-runner
|
|
||||||
timeout-minutes: 30
|
|
||||||
|
|
||||||
needs: build-bundle
|
|
||||||
|
|
||||||
container:
|
|
||||||
image: penpotapp/devenv:latest
|
|
||||||
volumes:
|
|
||||||
- /var/cache/github-runner/m2:/root/.m2
|
|
||||||
- /var/cache/github-runner/gitlib:/root/.gitlibs
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
# Mocked mode serves the prebuilt bundle from frontend/resources/public.
|
|
||||||
- name: Restore Cache
|
|
||||||
uses: actions/cache/restore@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
|
|
||||||
with:
|
|
||||||
key: ${{ needs.build-bundle.outputs.bundle_key }}
|
|
||||||
path: frontend/resources/public
|
|
||||||
fail-on-cache-miss: true
|
|
||||||
|
|
||||||
- name: Install deps
|
|
||||||
working-directory: ./plugins
|
|
||||||
run: |
|
|
||||||
pnpm install;
|
|
||||||
|
|
||||||
- name: Install Playwright Chromium
|
|
||||||
working-directory: ./plugins
|
|
||||||
run: pnpm --filter plugin-api-test-suite exec playwright install --with-deps chromium
|
|
||||||
|
|
||||||
- name: Generate API surface
|
|
||||||
working-directory: ./plugins
|
|
||||||
run: pnpm --filter plugin-api-test-suite run gen:api
|
|
||||||
|
|
||||||
- name: Run API test suite (mocked)
|
|
||||||
working-directory: ./plugins
|
|
||||||
env:
|
|
||||||
MOCK_BACKEND: "1"
|
|
||||||
run: pnpm --filter plugin-api-test-suite run test:ci
|
|
||||||
|
|
||||||
# ── 3. Merge the per-shard integration reports ─────────────────────────
|
|
||||||
merge-reports:
|
|
||||||
if: ${{ !cancelled() && !github.event.pull_request.draft && needs.test-integration.result != 'skipped' }}
|
|
||||||
name: "Merge Integration Reports"
|
|
||||||
runs-on: penpot-extended-runner
|
|
||||||
timeout-minutes: 15
|
|
||||||
|
|
||||||
needs: test-integration
|
|
||||||
|
|
||||||
container:
|
|
||||||
image: penpotapp/devenv:latest
|
|
||||||
volumes:
|
|
||||||
- /var/cache/github-runner/m2:/root/.m2
|
|
||||||
- /var/cache/github-runner/gitlib:/root/.gitlibs
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout Repository
|
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
ref: ${{ inputs.gh_ref }}
|
|
||||||
|
|
||||||
- name: Install deps
|
|
||||||
working-directory: ./frontend
|
|
||||||
run: |
|
|
||||||
pnpm install --frozen-lockfile;
|
|
||||||
|
|
||||||
- name: Download blob reports
|
|
||||||
uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
||||||
with:
|
|
||||||
path: frontend/all-blob-reports
|
|
||||||
pattern: integration-blob-report-*
|
|
||||||
merge-multiple: true
|
|
||||||
|
|
||||||
- name: Merge into HTML report
|
|
||||||
working-directory: ./frontend
|
|
||||||
env:
|
|
||||||
PLAYWRIGHT_JSON_OUTPUT_NAME: report.json
|
|
||||||
run: |
|
|
||||||
pnpm exec playwright merge-reports \
|
|
||||||
--reporter=html,json,list ./all-blob-reports
|
|
||||||
|
|
||||||
- name: Test summary
|
|
||||||
if: always()
|
|
||||||
continue-on-error: true
|
|
||||||
working-directory: ./frontend
|
|
||||||
run: |
|
|
||||||
if [ ! -f report.json ]; then
|
|
||||||
echo "No report produced (all shards failed early)." >> "$GITHUB_STEP_SUMMARY"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
jq -r -f ../.github/scripts/playwright-summary.jq report.json \
|
|
||||||
>> "$GITHUB_STEP_SUMMARY" \
|
|
||||||
|| echo "Summary generation failed; see the HTML report artifact." \
|
|
||||||
>> "$GITHUB_STEP_SUMMARY"
|
|
||||||
|
|
||||||
- name: Upload JSON report
|
|
||||||
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
||||||
if: always()
|
|
||||||
with:
|
|
||||||
name: integration-json-report
|
|
||||||
path: frontend/report.json
|
|
||||||
overwrite: true
|
|
||||||
if-no-files-found: ignore
|
|
||||||
retention-days: 7
|
|
||||||
|
|
||||||
- name: Upload HTML report
|
|
||||||
uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
||||||
if: always()
|
|
||||||
with:
|
|
||||||
name: integration-html-report
|
|
||||||
path: frontend/playwright-report/
|
|
||||||
overwrite: true
|
|
||||||
retention-days: 7
|
|
||||||
|
|
||||||
# ── 4. Live Plugin API suite (disabled) ────────────────────────────────
|
|
||||||
#
|
|
||||||
# True end-to-end against a LIVE instance: point PENPOT_BASE_URL at a
|
|
||||||
# reachable instance and provide login credentials via repo secrets. Manual
|
|
||||||
# because the CI runner has no Docker to stand up a full stack.
|
|
||||||
#
|
|
||||||
# api-test-suite-live:
|
|
||||||
# if: ${{ github.event_name == 'workflow_dispatch' }}
|
|
||||||
# name: Run Plugin API Test Suite (live)
|
|
||||||
# runs-on: penpot-extended-runner
|
|
||||||
# container:
|
|
||||||
# image: penpotapp/devenv:latest
|
|
||||||
#
|
|
||||||
# env:
|
|
||||||
# PENPOT_BASE_URL: ${{ inputs.base_url }}
|
|
||||||
# E2E_LOGIN_EMAIL: ${{ secrets.E2E_LOGIN_EMAIL }}
|
|
||||||
# E2E_LOGIN_PASSWORD: ${{ secrets.E2E_LOGIN_PASSWORD }}
|
|
||||||
#
|
|
||||||
# steps:
|
|
||||||
# - uses: actions/checkout@v6
|
|
||||||
#
|
|
||||||
# - name: Setup Node
|
|
||||||
# uses: actions/setup-node@v6
|
|
||||||
# with:
|
|
||||||
# node-version-file: .nvmrc
|
|
||||||
#
|
|
||||||
# - name: Install deps
|
|
||||||
# working-directory: ./plugins
|
|
||||||
# run: |
|
|
||||||
# pnpm install;
|
|
||||||
#
|
|
||||||
# - name: Install Playwright Chromium
|
|
||||||
# working-directory: ./plugins
|
|
||||||
# run: pnpm --filter plugin-api-test-suite exec playwright install --with-deps chromium
|
|
||||||
#
|
|
||||||
# - name: Generate API surface
|
|
||||||
# working-directory: ./plugins
|
|
||||||
# run: pnpm --filter plugin-api-test-suite run gen:api
|
|
||||||
#
|
|
||||||
# # Note: requires a running Penpot instance reachable at PENPOT_BASE_URL.
|
|
||||||
# - name: Run API test suite
|
|
||||||
# working-directory: ./plugins
|
|
||||||
# run: pnpm --filter plugin-api-test-suite run test:ci
|
|
||||||
63
.github/workflows/tests-exporter.yml
vendored
63
.github/workflows/tests-exporter.yml
vendored
@ -1,63 +0,0 @@
|
|||||||
name: "CI: Exporter"
|
|
||||||
|
|
||||||
defaults:
|
|
||||||
run:
|
|
||||||
shell: bash
|
|
||||||
|
|
||||||
on:
|
|
||||||
pull_request:
|
|
||||||
paths:
|
|
||||||
- 'exporter/**'
|
|
||||||
- 'common/**'
|
|
||||||
- 'render-wasm/**'
|
|
||||||
|
|
||||||
types:
|
|
||||||
- opened
|
|
||||||
- synchronize
|
|
||||||
- ready_for_review
|
|
||||||
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- develop
|
|
||||||
- staging
|
|
||||||
|
|
||||||
paths:
|
|
||||||
- 'exporter/**'
|
|
||||||
- 'common/**'
|
|
||||||
- 'render-wasm/**'
|
|
||||||
|
|
||||||
concurrency:
|
|
||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
|
||||||
cancel-in-progress: true
|
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test-exporter:
|
|
||||||
if: ${{ !github.event.pull_request.draft }}
|
|
||||||
name: "Exporter Tests"
|
|
||||||
runs-on: penpot-extended-runner
|
|
||||||
container:
|
|
||||||
image: penpotapp/devenv:latest
|
|
||||||
volumes:
|
|
||||||
- /var/cache/github-runner/m2:/root/.m2
|
|
||||||
- /var/cache/github-runner/gitlib:/root/.gitlibs
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Lint
|
|
||||||
working-directory: ./exporter
|
|
||||||
run: |
|
|
||||||
pnpm install;
|
|
||||||
pnpm run check-fmt:clj
|
|
||||||
pnpm run lint:clj
|
|
||||||
|
|
||||||
- name: Tests
|
|
||||||
working-directory: ./exporter
|
|
||||||
run: |
|
|
||||||
./scripts/test
|
|
||||||
11
.github/workflows/tests-frontend.yml
vendored
11
.github/workflows/tests-frontend.yml
vendored
@ -30,14 +30,11 @@ concurrency:
|
|||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-frontend:
|
test-frontend:
|
||||||
if: ${{ !github.event.pull_request.draft }}
|
if: ${{ !github.event.pull_request.draft }}
|
||||||
name: "Frontend Tests"
|
name: "Frontend Tests"
|
||||||
runs-on: penpot-extended-runner
|
runs-on: penpot-runner-02
|
||||||
container:
|
container:
|
||||||
image: penpotapp/devenv:latest
|
image: penpotapp/devenv:latest
|
||||||
volumes:
|
volumes:
|
||||||
@ -46,13 +43,13 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
uses: actions/checkout@v6
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Lint
|
- name: Lint
|
||||||
working-directory: ./frontend
|
working-directory: ./frontend
|
||||||
run: |
|
run: |
|
||||||
|
corepack enable;
|
||||||
|
corepack install;
|
||||||
pnpm install;
|
pnpm install;
|
||||||
pnpm run check-fmt:js
|
pnpm run check-fmt:js
|
||||||
pnpm run check-fmt:clj
|
pnpm run check-fmt:clj
|
||||||
|
|||||||
93
.github/workflows/tests-integration.yml
vendored
Normal file
93
.github/workflows/tests-integration.yml
vendored
Normal file
@ -0,0 +1,93 @@
|
|||||||
|
name: "CI: Integration"
|
||||||
|
|
||||||
|
defaults:
|
||||||
|
run:
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- 'frontend/**'
|
||||||
|
- 'common/**'
|
||||||
|
- 'render-wasm/**'
|
||||||
|
|
||||||
|
types:
|
||||||
|
- opened
|
||||||
|
- synchronize
|
||||||
|
- ready_for_review
|
||||||
|
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- develop
|
||||||
|
- staging
|
||||||
|
|
||||||
|
paths:
|
||||||
|
- 'frontend/**'
|
||||||
|
- 'common/**'
|
||||||
|
- 'render-wasm/**'
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build-integration:
|
||||||
|
if: ${{ !github.event.pull_request.draft }}
|
||||||
|
name: "Build Integration Bundle"
|
||||||
|
runs-on: penpot-runner-02
|
||||||
|
container:
|
||||||
|
image: penpotapp/devenv:latest
|
||||||
|
volumes:
|
||||||
|
- /var/cache/github-runner/m2:/root/.m2
|
||||||
|
- /var/cache/github-runner/gitlib:/root/.gitlibs
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: Build Bundle
|
||||||
|
working-directory: ./frontend
|
||||||
|
run: |
|
||||||
|
./scripts/build
|
||||||
|
|
||||||
|
- name: Store Bundle Cache
|
||||||
|
uses: actions/cache@v5
|
||||||
|
with:
|
||||||
|
key: "integration-bundle-${{ github.sha }}"
|
||||||
|
path: frontend/resources/public
|
||||||
|
|
||||||
|
test-integration:
|
||||||
|
if: ${{ !github.event.pull_request.draft }}
|
||||||
|
name: "Integration Tests"
|
||||||
|
runs-on: penpot-runner-02
|
||||||
|
container:
|
||||||
|
image: penpotapp/devenv:latest
|
||||||
|
volumes:
|
||||||
|
- /var/cache/github-runner/m2:/root/.m2
|
||||||
|
- /var/cache/github-runner/gitlib:/root/.gitlibs
|
||||||
|
|
||||||
|
needs: build-integration
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout Repository
|
||||||
|
uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: Restore Cache
|
||||||
|
uses: actions/cache/restore@v5
|
||||||
|
with:
|
||||||
|
key: "integration-bundle-${{ github.sha }}"
|
||||||
|
path: frontend/resources/public
|
||||||
|
|
||||||
|
- name: Run Tests
|
||||||
|
working-directory: ./frontend
|
||||||
|
run: |
|
||||||
|
./scripts/test-e2e
|
||||||
|
|
||||||
|
- name: Upload test result
|
||||||
|
uses: actions/upload-artifact@v7
|
||||||
|
if: always()
|
||||||
|
with:
|
||||||
|
name: integration-tests-result
|
||||||
|
path: frontend/test-results/
|
||||||
|
overwrite: true
|
||||||
|
retention-days: 3
|
||||||
11
.github/workflows/tests-library.yml
vendored
11
.github/workflows/tests-library.yml
vendored
@ -28,14 +28,11 @@ concurrency:
|
|||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-library:
|
test-library:
|
||||||
if: ${{ !github.event.pull_request.draft }}
|
if: ${{ !github.event.pull_request.draft }}
|
||||||
name: "Library Tests"
|
name: "Library Tests"
|
||||||
runs-on: penpot-extended-runner
|
runs-on: penpot-runner-02
|
||||||
container:
|
container:
|
||||||
image: penpotapp/devenv:latest
|
image: penpotapp/devenv:latest
|
||||||
volumes:
|
volumes:
|
||||||
@ -44,13 +41,13 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
uses: actions/checkout@v6
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Lint
|
- name: Lint
|
||||||
working-directory: ./library
|
working-directory: ./library
|
||||||
run: |
|
run: |
|
||||||
|
corepack enable;
|
||||||
|
corepack install;
|
||||||
pnpm install;
|
pnpm install;
|
||||||
pnpm run check-fmt
|
pnpm run check-fmt
|
||||||
pnpm run lint
|
pnpm run lint
|
||||||
|
|||||||
13
.github/workflows/tests-mcp.yml
vendored
13
.github/workflows/tests-mcp.yml
vendored
@ -1,4 +1,4 @@
|
|||||||
name: "CI: MCP"
|
name: "MCP CI"
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
@ -24,21 +24,16 @@ on:
|
|||||||
paths:
|
paths:
|
||||||
- 'mcp/**'
|
- 'mcp/**'
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-mcp:
|
test-mcp:
|
||||||
if: ${{ !github.event.pull_request.draft }}
|
if: ${{ !github.event.pull_request.draft }}
|
||||||
name: "Test MCP"
|
name: "Test MCP"
|
||||||
runs-on: penpot-extended-runner
|
runs-on: penpot-runner-02
|
||||||
container: penpotapp/devenv:latest
|
container: penpotapp/devenv:latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
uses: actions/checkout@v6
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Setup
|
- name: Setup
|
||||||
working-directory: ./mcp
|
working-directory: ./mcp
|
||||||
@ -54,4 +49,4 @@ jobs:
|
|||||||
- name: Tests
|
- name: Tests
|
||||||
working-directory: ./mcp
|
working-directory: ./mcp
|
||||||
run: |
|
run: |
|
||||||
pnpm run test;
|
pnpm -r run test;
|
||||||
|
|||||||
17
.github/workflows/tests-plugins.yml
vendored
17
.github/workflows/tests-plugins.yml
vendored
@ -26,14 +26,11 @@ concurrency:
|
|||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-plugins:
|
test-plugins:
|
||||||
if: ${{ !github.event.pull_request.draft }}
|
if: ${{ !github.event.pull_request.draft }}
|
||||||
name: Plugins Runtime Linter & Tests
|
name: Plugins Runtime Linter & Tests
|
||||||
runs-on: penpot-extended-runner
|
runs-on: penpot-runner-02
|
||||||
container:
|
container:
|
||||||
image: penpotapp/devenv:latest
|
image: penpotapp/devenv:latest
|
||||||
volumes:
|
volumes:
|
||||||
@ -41,15 +38,21 @@ jobs:
|
|||||||
- /var/cache/github-runner/gitlib:/root/.gitlibs
|
- /var/cache/github-runner/gitlib:/root/.gitlibs
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
- uses: actions/checkout@v6
|
||||||
|
|
||||||
|
- name: Setup Node
|
||||||
|
id: setup-node
|
||||||
|
uses: actions/setup-node@v6
|
||||||
with:
|
with:
|
||||||
persist-credentials: false
|
node-version-file: .nvmrc
|
||||||
|
|
||||||
- name: Install deps
|
- name: Install deps
|
||||||
working-directory: ./plugins
|
working-directory: ./plugins
|
||||||
shell: bash
|
shell: bash
|
||||||
run: |
|
run: |
|
||||||
pnpm install -r;
|
corepack enable;
|
||||||
|
corepack install;
|
||||||
|
pnpm install;
|
||||||
|
|
||||||
- name: Run Lint
|
- name: Run Lint
|
||||||
working-directory: ./plugins
|
working-directory: ./plugins
|
||||||
|
|||||||
11
.github/workflows/tests-wasm.yml
vendored
11
.github/workflows/tests-wasm.yml
vendored
@ -26,14 +26,11 @@ concurrency:
|
|||||||
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
|
||||||
cancel-in-progress: true
|
cancel-in-progress: true
|
||||||
|
|
||||||
permissions:
|
|
||||||
contents: read
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test-render-wasm:
|
test-render-wasm:
|
||||||
if: ${{ !github.event.pull_request.draft }}
|
if: ${{ !github.event.pull_request.draft }}
|
||||||
name: "Render WASM Tests"
|
name: "Render WASM Tests"
|
||||||
runs-on: penpot-extended-runner
|
runs-on: penpot-runner-02
|
||||||
container:
|
container:
|
||||||
image: penpotapp/devenv:latest
|
image: penpotapp/devenv:latest
|
||||||
volumes:
|
volumes:
|
||||||
@ -42,14 +39,12 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout repository
|
- name: Checkout repository
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
uses: actions/checkout@v6
|
||||||
with:
|
|
||||||
persist-credentials: false
|
|
||||||
|
|
||||||
- name: Format
|
- name: Format
|
||||||
working-directory: ./render-wasm
|
working-directory: ./render-wasm
|
||||||
run: |
|
run: |
|
||||||
./fmt --check
|
cargo fmt --check
|
||||||
|
|
||||||
- name: Lint
|
- name: Lint
|
||||||
working-directory: ./render-wasm
|
working-directory: ./render-wasm
|
||||||
|
|||||||
39
.github/zizmor.yml
vendored
39
.github/zizmor.yml
vendored
@ -1,39 +0,0 @@
|
|||||||
# zizmor configuration — https://docs.zizmor.sh/configuration/
|
|
||||||
#
|
|
||||||
# Every audit is enforced for every workflow. New workflows are checked with
|
|
||||||
# no exceptions. The entries below are the only remaining ones, and each is
|
|
||||||
# marked as either a pending clean-up or an accepted risk with its reason.
|
|
||||||
# Remove a file from a list in the same PR that fixes it, and the whole rule
|
|
||||||
# entry once its list is empty.
|
|
||||||
rules:
|
|
||||||
# Accepted: wrangler is added with `pnpm add wrangler@latest` before each
|
|
||||||
# deploy instead of being a dependency of the plugins workspace. Only used
|
|
||||||
# to publish to Cloudflare; not worth adding to the workspace.
|
|
||||||
adhoc-packages:
|
|
||||||
ignore:
|
|
||||||
- plugins-deploy-api-doc.yml
|
|
||||||
- plugins-deploy-package.yml
|
|
||||||
- plugins-deploy-styles-doc.yml
|
|
||||||
# Accepted: auto-label.yml needs pull_request_target so the GitHub App
|
|
||||||
# secrets are available for PRs from forks. It never checks out or runs
|
|
||||||
# PR code, it only reads ids from the event payload.
|
|
||||||
dangerous-triggers:
|
|
||||||
ignore:
|
|
||||||
- auto-label.yml
|
|
||||||
# Style nudge towards the `$/...` syntax; not worth enforcing.
|
|
||||||
self-repository:
|
|
||||||
disable: true
|
|
||||||
# Accepted: penpotapp/devenv is our own image, built and pushed by
|
|
||||||
# build-docker-devenv.yml, so the floating tag is intentional.
|
|
||||||
unpinned-images:
|
|
||||||
ignore:
|
|
||||||
- plugins-deploy-package.yml
|
|
||||||
- tests-backend.yml
|
|
||||||
- tests-common.yml
|
|
||||||
- tests-e2e.yml
|
|
||||||
- tests-exporter.yml
|
|
||||||
- tests-frontend.yml
|
|
||||||
- tests-library.yml
|
|
||||||
- tests-mcp.yml
|
|
||||||
- tests-plugins.yml
|
|
||||||
- tests-wasm.yml
|
|
||||||
32
.gitignore
vendored
32
.gitignore
vendored
@ -9,17 +9,11 @@
|
|||||||
.clj-kondo
|
.clj-kondo
|
||||||
.cpcache
|
.cpcache
|
||||||
.lsp
|
.lsp
|
||||||
.env
|
|
||||||
.nrepl-port
|
.nrepl-port
|
||||||
.nyc_output
|
.nyc_output
|
||||||
.rebel_readline_history
|
.rebel_readline_history
|
||||||
.repl
|
.repl
|
||||||
opencode.json
|
|
||||||
.opencode/package-lock.json
|
|
||||||
/*.html
|
|
||||||
/*.jpg
|
/*.jpg
|
||||||
/*.json
|
|
||||||
!/package.json
|
|
||||||
/*.md
|
/*.md
|
||||||
!CHANGES.md
|
!CHANGES.md
|
||||||
!CONTRIBUTING.md
|
!CONTRIBUTING.md
|
||||||
@ -36,6 +30,7 @@ opencode.json
|
|||||||
/.clj-kondo/.cache
|
/.clj-kondo/.cache
|
||||||
/_dump
|
/_dump
|
||||||
/notes
|
/notes
|
||||||
|
/.opencode/package-lock.json
|
||||||
/plans
|
/plans
|
||||||
/prompts
|
/prompts
|
||||||
/playground/
|
/playground/
|
||||||
@ -61,8 +56,6 @@ opencode.json
|
|||||||
/docker/images/bundle*
|
/docker/images/bundle*
|
||||||
/exporter/target
|
/exporter/target
|
||||||
/exporter/.shadow-cljs
|
/exporter/.shadow-cljs
|
||||||
/exporter/resources/wasm/
|
|
||||||
/exporter/src/app/wasm/shared.js
|
|
||||||
/frontend/.storybook/preview-body.html
|
/frontend/.storybook/preview-body.html
|
||||||
/frontend/.storybook/preview-head.html
|
/frontend/.storybook/preview-head.html
|
||||||
/frontend/playwright-report/
|
/frontend/playwright-report/
|
||||||
@ -79,6 +72,8 @@ opencode.json
|
|||||||
/frontend/target/
|
/frontend/target/
|
||||||
/frontend/test-results/
|
/frontend/test-results/
|
||||||
/frontend/.shadow-cljs
|
/frontend/.shadow-cljs
|
||||||
|
/other/
|
||||||
|
/scripts/
|
||||||
/nexus/
|
/nexus/
|
||||||
/tmp/
|
/tmp/
|
||||||
/vendor/**/target
|
/vendor/**/target
|
||||||
@ -86,7 +81,6 @@ opencode.json
|
|||||||
/web
|
/web
|
||||||
/library/target/
|
/library/target/
|
||||||
/library/*.zip
|
/library/*.zip
|
||||||
/library/.shadow-cljs
|
|
||||||
/external
|
/external
|
||||||
/penpot-nitrate
|
/penpot-nitrate
|
||||||
/test-results/
|
/test-results/
|
||||||
@ -94,15 +88,6 @@ opencode.json
|
|||||||
/blob-report/
|
/blob-report/
|
||||||
/playwright/.cache/
|
/playwright/.cache/
|
||||||
/render-wasm/target/
|
/render-wasm/target/
|
||||||
/render-wasm/.render-wasm-build.lock
|
|
||||||
|
|
||||||
# render-wasm build artifacts copied into the exporter (autogenerated)
|
|
||||||
/exporter/resources/wasm/render-wasm.js
|
|
||||||
/exporter/resources/wasm/render-wasm.wasm
|
|
||||||
/exporter/src/app/wasm/shared.js
|
|
||||||
|
|
||||||
/media-processor/dist/
|
|
||||||
/media-processor/target/
|
|
||||||
/**/node_modules
|
/**/node_modules
|
||||||
/**/.yarn/*
|
/**/.yarn/*
|
||||||
/.pnpm-store
|
/.pnpm-store
|
||||||
@ -110,19 +95,8 @@ opencode.json
|
|||||||
/.idea
|
/.idea
|
||||||
*.iml
|
*.iml
|
||||||
/.claude
|
/.claude
|
||||||
/CLAUDE.md
|
|
||||||
/CLAUDE.local.md
|
|
||||||
/.playwright-mcp
|
/.playwright-mcp
|
||||||
/.devenv/mcp/
|
/.devenv/mcp/
|
||||||
/opencode.json
|
/opencode.json
|
||||||
/.agents/plans
|
|
||||||
/.agents/local/
|
|
||||||
/AGENTS.local.md
|
|
||||||
/.opencode/reports
|
|
||||||
/.opencode/prompts
|
|
||||||
/.ci-logs
|
|
||||||
/tmp
|
|
||||||
/.codex/
|
/.codex/
|
||||||
/scripts/__pycache__/
|
|
||||||
/tools/__pycache__
|
/tools/__pycache__
|
||||||
/scripts/__pycache__
|
|
||||||
|
|||||||
28
.opencode/agents/commiter.md
Normal file
28
.opencode/agents/commiter.md
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
---
|
||||||
|
name: commiter
|
||||||
|
description: Git commit assistant
|
||||||
|
mode: all
|
||||||
|
---
|
||||||
|
|
||||||
|
## Role
|
||||||
|
|
||||||
|
You are responsible for creating git commits for Penpot and must
|
||||||
|
follow the repository commit-format rules exactly. It should have
|
||||||
|
concise title and clear summary of changes in the description,
|
||||||
|
including the rationale if proceed.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
* Override your internal commit rules when the user explicitly requests
|
||||||
|
something that conflicts with them.
|
||||||
|
* Read `.serena/memories/workflows/creating-commits.md` before
|
||||||
|
creating any commit and follow the commit guidelines strictly.
|
||||||
|
* Keep the description (commit body) with maximum line length of 80
|
||||||
|
characters. Use manual line breaks to wrap text before it exceeds
|
||||||
|
this limit.
|
||||||
|
* Use `git commit -s` so the commit includes the required
|
||||||
|
`Signed-off-by` line.
|
||||||
|
* Do not guess or hallucinate git author information (Name or
|
||||||
|
Email). Never include the `--author` flag in git commands unless
|
||||||
|
specifically instructed by the user for a unique case; assume the
|
||||||
|
local environment is already configured.
|
||||||
25
.opencode/agents/engineer.md
Normal file
25
.opencode/agents/engineer.md
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
---
|
||||||
|
name: Engineer
|
||||||
|
description: Senior Full-Stack Software Engineer
|
||||||
|
mode: primary
|
||||||
|
---
|
||||||
|
|
||||||
|
## Role
|
||||||
|
|
||||||
|
You are a high-autonomy Senior Full-Stack Software Engineer working on Penpot, an
|
||||||
|
open-source design tool. You have full permission to navigate the codebase, modify files,
|
||||||
|
and execute commands to fulfill your tasks. Your goal is to solve complex technical tasks
|
||||||
|
with high precision while maintaining a strong focus on maintainability and performance.
|
||||||
|
|
||||||
|
## Before Start
|
||||||
|
|
||||||
|
**Read `AGENTS.md` file and project structure and how the memory system works**
|
||||||
|
|
||||||
|
## Requiremens
|
||||||
|
|
||||||
|
* Before writing code, analyze the task in depth and describe your plan. If the task is
|
||||||
|
complex, break it down into atomic steps.
|
||||||
|
* Do **not** touch unrelated modules unless the task explicitly requires it.
|
||||||
|
* Only reference functions, namespaces, or APIs that actually exist in the
|
||||||
|
codebase. Verify their existence before citing them. If unsure, search first.
|
||||||
|
* Be concise and autonomous — avoid unnecessary explanations.
|
||||||
60
.opencode/agents/planner.md
Normal file
60
.opencode/agents/planner.md
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
---
|
||||||
|
name: Planner
|
||||||
|
description: Software architect for planning and analysis only
|
||||||
|
mode: primary
|
||||||
|
permission:
|
||||||
|
edit: ask
|
||||||
|
---
|
||||||
|
|
||||||
|
## Role
|
||||||
|
|
||||||
|
You are a Senior Software Architect working on Penpot, an open-source design
|
||||||
|
tool. Your sole responsibility is planning and analysis — you do NOT write,
|
||||||
|
modify any code.
|
||||||
|
|
||||||
|
You help users understand the codebase, design solutions, and create detailed
|
||||||
|
implementation plans that other agents or developers can execute. Document
|
||||||
|
everything they need to know: which files to touch for each task, code, testing,
|
||||||
|
docs they might need to check, how to test it. Give them the whole plan as
|
||||||
|
bite-sized tasks. DRY. YAGNI. TDD. Frequent commits.
|
||||||
|
|
||||||
|
Do **not** suggest commit messages or commit names anywhere in your plans or
|
||||||
|
responses — committing is the developer's responsibility.
|
||||||
|
|
||||||
|
Assume they are a skilled developer, but know almost nothing about our toolset
|
||||||
|
or problem domain. Assume they don't know good test design very well.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
* Analyze the codebase architecture and identify affected modules.
|
||||||
|
* Read `AGENTS.md` file and project structure and how the memory system works and how to
|
||||||
|
navigate and read relevant information conventions.
|
||||||
|
* Break down complex features or bugs into atomic, actionable steps.
|
||||||
|
* Propose solutions with clear rationale, trade-offs, and sequencing.
|
||||||
|
* Identify risks, edge cases, and testing considerations.
|
||||||
|
|
||||||
|
Save plans to: plans/YYYY-MM-DD-<plan-one-line-title>.md
|
||||||
|
|
||||||
|
## Constraints
|
||||||
|
|
||||||
|
* You are **read-only** — never create, edit, or delete files.
|
||||||
|
* You do **not** run builds, tests, linters, or any commands that modify state.
|
||||||
|
* You do **not** create git commits or interact with version control.
|
||||||
|
* You do **not** execute shell commands beyond read-only searches (`rg`, `ls`,
|
||||||
|
`find`, `cat`).
|
||||||
|
* Your output is a structured plan or analysis, ready for handoff to an
|
||||||
|
engineer agent or developer.
|
||||||
|
|
||||||
|
## Output format
|
||||||
|
|
||||||
|
When producing a plan, structure it as:
|
||||||
|
|
||||||
|
1. **Context** — What is the problem or feature request?
|
||||||
|
2. **Affected modules** — Which parts of the codebase are involved?
|
||||||
|
3. **Approach** — Step-by-step implementation plan with file paths and
|
||||||
|
function names where applicable.
|
||||||
|
4. **Risks & considerations** — Edge cases, performance implications, breaking
|
||||||
|
changes.
|
||||||
|
5. **Testing strategy** — How to verify the implementation works correctly.
|
||||||
|
|
||||||
|
|
||||||
56
.opencode/agents/prompt-assistant.md
Normal file
56
.opencode/agents/prompt-assistant.md
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
---
|
||||||
|
name: Prompt Assistant
|
||||||
|
description: Refines and improves prompts for maximum clarity and effectiveness
|
||||||
|
mode: all
|
||||||
|
---
|
||||||
|
|
||||||
|
## Role
|
||||||
|
|
||||||
|
You are an expert Prompt Engineer with strong knowledge of
|
||||||
|
penpot. Your sole responsibility is to take a prompt provided by the
|
||||||
|
user and transform it into the most effective, clear, and
|
||||||
|
well-structured version possible — ready to be used with any AI model.
|
||||||
|
|
||||||
|
## Requirements
|
||||||
|
|
||||||
|
* You do NOT execute tasks. You do NOT write code. You only design and refine prompts
|
||||||
|
* Read `AGENTS.md` file and project structure and how the memory system works and how to
|
||||||
|
navigate and read relevant information conventions.
|
||||||
|
* Analyze the original prompt: identify its intent, target audience, ambiguities, missing
|
||||||
|
context, and structural weaknesses
|
||||||
|
* Ask clarifying questions if the intent is unclear or if critical information is missing
|
||||||
|
(e.g. target model, expected output format, tone, constraints). Keep questions concise
|
||||||
|
and grouped
|
||||||
|
* Rewrite the prompt using prompt engineering best practices
|
||||||
|
|
||||||
|
|
||||||
|
## Prompt Engineering Principles
|
||||||
|
|
||||||
|
Apply these techniques when refining prompts:
|
||||||
|
|
||||||
|
- **Be specific and explicit**: Replace vague instructions with precise ones.
|
||||||
|
- **Set the context**: Include background information the model needs to
|
||||||
|
perform well.
|
||||||
|
- **Specify the output format**: State the desired structure, length, tone,
|
||||||
|
or format (e.g. bullet list, JSON, step-by-step).
|
||||||
|
- **Add constraints**: Include what the model should avoid or not do.
|
||||||
|
- **Use examples** (few-shot): When applicable, suggest adding examples to
|
||||||
|
anchor the model's behaviour.
|
||||||
|
- **Break down complexity**: Split multi-step tasks into clear numbered steps.
|
||||||
|
- **Avoid ambiguity**: Remove pronouns and references that could be
|
||||||
|
misinterpreted.
|
||||||
|
- **Chain of thought**: For reasoning tasks, include "Think step by step."
|
||||||
|
|
||||||
|
## Constraints
|
||||||
|
|
||||||
|
- Do NOT execute the prompt yourself.
|
||||||
|
- Do NOT answer the question inside the prompt.
|
||||||
|
- Do NOT add unnecessary verbosity — prompts should be as short as they can
|
||||||
|
be while remaining complete.
|
||||||
|
- Always preserve the user's original intent.
|
||||||
|
|
||||||
|
## Output
|
||||||
|
|
||||||
|
Refined Prompt: The improved, ready-to-use prompt. Print it for
|
||||||
|
immediate use and save it to
|
||||||
|
prompts/YYYY-MM-DD-N-<prompt-one-line-title>.md for future use.
|
||||||
@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
description: Create a PR for the current task branch or update an existing one — loads and follows the create-pr skill
|
|
||||||
agent: build
|
|
||||||
---
|
|
||||||
|
|
||||||
Load the **`create-pr`** skill and follow it as your only instruction.
|
|
||||||
|
|
||||||
## User input, overrides and additional context
|
|
||||||
|
|
||||||
$ARGUMENTS
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
description: Execute a ready plan — task checklist, your confirmation, then all tasks with one commit (default) or step by step with a commit and a pause per task; creates issue + branch when on a base branch, or commits on the current branch with "direct" — loads and follows the implement-plan skill
|
|
||||||
agent: build
|
|
||||||
---
|
|
||||||
|
|
||||||
Load the **`implement-plan`** skill and follow it as your only instruction.
|
|
||||||
|
|
||||||
## User input, overrides and additional context
|
|
||||||
|
|
||||||
$ARGUMENTS
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
description: Investigate the chosen task, produce an implementation plan, and save it — loads and follows the make-a-plan skill
|
|
||||||
agent: build
|
|
||||||
---
|
|
||||||
|
|
||||||
Load the **`make-a-plan`** skill and follow it as your only instruction.
|
|
||||||
|
|
||||||
## User input, overrides and additional context
|
|
||||||
|
|
||||||
$ARGUMENTS
|
|
||||||
@ -1,6 +0,0 @@
|
|||||||
---
|
|
||||||
description: Resolve local git conflicts and stage the resolved files; never continues the rebase — loads and follows the resolve-git-conflicts skill
|
|
||||||
agent: build
|
|
||||||
---
|
|
||||||
|
|
||||||
Load the **`resolve-git-conflicts`** skill and follow it as your only instruction.
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
description: Code review — review a diff, PR, or code change — loads and follows the review-code skill
|
|
||||||
agent: build
|
|
||||||
---
|
|
||||||
|
|
||||||
Load the **`review-code`** skill and follow it as your only instruction.
|
|
||||||
|
|
||||||
## User input, overrides and additional context
|
|
||||||
|
|
||||||
$ARGUMENTS
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
---
|
|
||||||
description: Plan review — evaluate an implementation plan before executing it — loads and follows the review-plan skill
|
|
||||||
agent: build
|
|
||||||
---
|
|
||||||
|
|
||||||
Load the **`review-plan`** skill and follow it as your only instruction.
|
|
||||||
|
|
||||||
## User input, overrides and additional context
|
|
||||||
|
|
||||||
$ARGUMENTS
|
|
||||||
@ -1,169 +0,0 @@
|
|||||||
// Penpot OpenCode V2 plugin: custom tools for Penpot development.
|
|
||||||
//
|
|
||||||
// Tools are registered with `ctx.tool.transform()` and JSON Schema inputs.
|
|
||||||
// Keep this plugin dependency-free so the auto-discovered local plugin loads
|
|
||||||
// without project npm dependencies.
|
|
||||||
|
|
||||||
import path from "path"
|
|
||||||
import { spawn } from "child_process"
|
|
||||||
|
|
||||||
function runCommand(command, args, options = {}) {
|
|
||||||
const {
|
|
||||||
cwd,
|
|
||||||
env,
|
|
||||||
stdin,
|
|
||||||
closeStdin = false,
|
|
||||||
successMessage = "Command executed successfully",
|
|
||||||
} = options
|
|
||||||
|
|
||||||
return new Promise((resolve) => {
|
|
||||||
let stdout = ""
|
|
||||||
let stderr = ""
|
|
||||||
|
|
||||||
const proc = spawn(command, args, { cwd, env })
|
|
||||||
|
|
||||||
proc.stdout.on("data", (data) => {
|
|
||||||
stdout += data.toString()
|
|
||||||
})
|
|
||||||
|
|
||||||
proc.stderr.on("data", (data) => {
|
|
||||||
stderr += data.toString()
|
|
||||||
})
|
|
||||||
|
|
||||||
proc.on("error", (error) => {
|
|
||||||
resolve(`Error: ${error.message}`)
|
|
||||||
})
|
|
||||||
|
|
||||||
proc.on("close", (exitCode) => {
|
|
||||||
const output =
|
|
||||||
exitCode === 0
|
|
||||||
? stdout.trim() || successMessage
|
|
||||||
: `Error (exit ${exitCode}): ${
|
|
||||||
(stderr || stdout).trim() || "No error output"
|
|
||||||
}`
|
|
||||||
resolve(output)
|
|
||||||
})
|
|
||||||
|
|
||||||
// Close stdin so the child cannot wait on it indefinitely. `psql -c`
|
|
||||||
// never reads stdin, so only the paren-repair pipe mode needs this, but
|
|
||||||
// closing it unconditionally is harmless there.
|
|
||||||
if (stdin !== undefined) {
|
|
||||||
proc.stdin.end(stdin)
|
|
||||||
} else if (closeStdin) {
|
|
||||||
proc.stdin.end()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function executePsql(sql, useTestDb, cwd) {
|
|
||||||
const host = process.env.PENPOT_DB_HOST || "postgres"
|
|
||||||
const user = process.env.PENPOT_DB_USER || "penpot"
|
|
||||||
const db = useTestDb
|
|
||||||
? "penpot_test"
|
|
||||||
: process.env.PENPOT_DB_NAME || "penpot"
|
|
||||||
const password = process.env.PENPOT_DB_PASSWORD || "penpot"
|
|
||||||
|
|
||||||
const psqlArgs = ["-h", host, "-U", user, "-d", db, "-c", sql]
|
|
||||||
|
|
||||||
return runCommand("psql", psqlArgs, {
|
|
||||||
cwd,
|
|
||||||
env: { ...process.env, PGPASSWORD: password },
|
|
||||||
successMessage: "Query executed successfully",
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
function executeParenRepair({ files, code }, directory) {
|
|
||||||
const script = path.join(directory, "scripts/paren-repair")
|
|
||||||
|
|
||||||
const fileList = files
|
|
||||||
? files
|
|
||||||
.split(",")
|
|
||||||
.map((file) => file.trim())
|
|
||||||
.filter(Boolean)
|
|
||||||
: []
|
|
||||||
|
|
||||||
const childArgs =
|
|
||||||
fileList.length > 0 ? [script, ...fileList] : [script]
|
|
||||||
|
|
||||||
return runCommand("bb", childArgs, {
|
|
||||||
cwd: directory,
|
|
||||||
stdin: code,
|
|
||||||
closeStdin: true,
|
|
||||||
successMessage: "No changes needed",
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
const penpotPsqlInputSchema = {
|
|
||||||
type: "object",
|
|
||||||
properties: {
|
|
||||||
sql: {
|
|
||||||
type: "string",
|
|
||||||
description: "SQL command to execute",
|
|
||||||
},
|
|
||||||
test: {
|
|
||||||
type: "boolean",
|
|
||||||
description: "Use the penpot_test database",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
required: ["sql"],
|
|
||||||
additionalProperties: false,
|
|
||||||
}
|
|
||||||
|
|
||||||
const parenRepairInputSchema = {
|
|
||||||
type: "object",
|
|
||||||
properties: {
|
|
||||||
// A string is used instead of an array so OpenCode displays it
|
|
||||||
// in the generic tool invocation.
|
|
||||||
files: {
|
|
||||||
type: "string",
|
|
||||||
description:
|
|
||||||
"Comma-separated file paths to fix, for example: frontend/src/app/config.cljs, backend/src/core.clj",
|
|
||||||
},
|
|
||||||
code: {
|
|
||||||
type: "string",
|
|
||||||
description: "Code string to fix via stdin",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
additionalProperties: false,
|
|
||||||
}
|
|
||||||
|
|
||||||
async function setup(ctx) {
|
|
||||||
// Use the plugin instance location as the working directory for both tools.
|
|
||||||
const directory =
|
|
||||||
ctx.location.directory ?? ctx.location.project?.canonical
|
|
||||||
|
|
||||||
// Keep this callback synchronous: transforms are replayable state edits.
|
|
||||||
// The async work happens later, inside each tool's `execute`.
|
|
||||||
await ctx.tool.transform((editor) => {
|
|
||||||
editor.add({
|
|
||||||
name: "penpot-psql",
|
|
||||||
description:
|
|
||||||
"Execute a SQL command against the Penpot database. Uses the defaults from scripts/psql.",
|
|
||||||
input: penpotPsqlInputSchema,
|
|
||||||
async execute(input) {
|
|
||||||
const content = await executePsql(
|
|
||||||
input.sql,
|
|
||||||
input.test === true,
|
|
||||||
directory,
|
|
||||||
)
|
|
||||||
return { content }
|
|
||||||
},
|
|
||||||
})
|
|
||||||
|
|
||||||
editor.add({
|
|
||||||
name: "paren-repair",
|
|
||||||
description:
|
|
||||||
"Fix mismatched parentheses/braces in Clojure files (.clj, .cljs, .cljc) then reformat with cljfmt.",
|
|
||||||
input: parenRepairInputSchema,
|
|
||||||
async execute(input) {
|
|
||||||
const content = await executeParenRepair(input, directory)
|
|
||||||
return { content }
|
|
||||||
},
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
export default {
|
|
||||||
id: "penpot",
|
|
||||||
setup,
|
|
||||||
}
|
|
||||||
85
.opencode/skills/backport-commit/SKILL.md
Normal file
85
.opencode/skills/backport-commit/SKILL.md
Normal file
@ -0,0 +1,85 @@
|
|||||||
|
---
|
||||||
|
name: backport-commit
|
||||||
|
description: Port changes from a specific Git commit to the current branch by manually applying the diff, avoiding cherry-pick when it would introduce complex conflicts.
|
||||||
|
---
|
||||||
|
|
||||||
|
# Backport Commit
|
||||||
|
|
||||||
|
Port changes from a specific Git commit to the current branch by manually
|
||||||
|
applying the diff, avoiding `git cherry-pick` when it would introduce
|
||||||
|
complex conflicts.
|
||||||
|
|
||||||
|
## When to Use
|
||||||
|
|
||||||
|
Use this skill whenever the user asks to backport a commit, especially when:
|
||||||
|
|
||||||
|
- The commit touches multiple modules or files with significant divergence
|
||||||
|
- `git cherry-pick` is explicitly ruled out ("do not use cherry-pick")
|
||||||
|
- The target commit is old enough that conflicts are likely
|
||||||
|
- The commit introduces both source changes AND new files (tests, etc.)
|
||||||
|
- You need full control over how each hunk is applied
|
||||||
|
|
||||||
|
## Workflow
|
||||||
|
|
||||||
|
### 1. Identify the target commit
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Verify the commit exists and understand what it does
|
||||||
|
git log --oneline -1 <commit-sha>
|
||||||
|
|
||||||
|
# Get the full diff (including new/deleted files)
|
||||||
|
git show <commit-sha>
|
||||||
|
|
||||||
|
# Capture the original commit message for later reuse
|
||||||
|
git log --format='%B' -1 <commit-sha>
|
||||||
|
```
|
||||||
|
|
||||||
|
### 2. Identify affected modules
|
||||||
|
|
||||||
|
From the file paths in the diff, determine which Penpot modules are affected
|
||||||
|
(frontend, backend, common, render-wasm, etc.) and read their `AGENTS.md`
|
||||||
|
files **before** making any changes. If a module has no `AGENTS.md`, skip
|
||||||
|
that step — verify with `ls <module>/AGENTS.md` first.
|
||||||
|
|
||||||
|
### 3. Read the current state of each affected file
|
||||||
|
|
||||||
|
For every file the diff touches, read the current version on disk to understand
|
||||||
|
context and ensure correct placement before editing.
|
||||||
|
|
||||||
|
### 4. Apply changes manually (the core of this approach)
|
||||||
|
|
||||||
|
Process every hunk in the diff using the appropriate tool:
|
||||||
|
|
||||||
|
| Diff action | Tool to use |
|
||||||
|
|-------------|-------------|
|
||||||
|
| Modify existing file | `edit` — use enough surrounding context in `oldString` to uniquely match the location |
|
||||||
|
| Add new file | `write` — include proper license header and namespace conventions matching project style |
|
||||||
|
| Delete file | `bash rm <path>` |
|
||||||
|
| Rename/move file | `bash mv <old> <new>`, then apply any content changes with `edit` |
|
||||||
|
|
||||||
|
> **Tip:** Group nearby hunks from the same file into a single `edit` call.
|
||||||
|
> Use separate calls when hunks are far apart to keep `oldString` short and
|
||||||
|
> unambiguous.
|
||||||
|
|
||||||
|
Repeat until **all** hunks in the diff are ported.
|
||||||
|
|
||||||
|
### 5. Validate
|
||||||
|
|
||||||
|
Run **lint**, **check-fmt**, and **tests** for every affected module (see each
|
||||||
|
module's `AGENTS.md` for the exact commands). If the formatter auto-fixes
|
||||||
|
indentation, verify the logic is still semantically correct. All checks must
|
||||||
|
pass before moving on.
|
||||||
|
|
||||||
|
### 6. Commit
|
||||||
|
|
||||||
|
Ask the `commiter` sub-agent to create a commit. Stage all relevant files
|
||||||
|
(exclude unrelated untracked files) and provide the original commit message as
|
||||||
|
a reference, adapting it as needed for the target branch context.
|
||||||
|
|
||||||
|
## Key Principles
|
||||||
|
|
||||||
|
- **Context matters** — always read files before editing; never guess
|
||||||
|
indentation or surrounding code
|
||||||
|
- **Lint + format + test** — never skip validation before committing
|
||||||
|
- **Preserve intent** — keep the original commit message meaning; the
|
||||||
|
`commiter` agent handles formatting
|
||||||
@ -9,11 +9,6 @@ metadata: {"clawdbot":{"emoji":"🦇","requires":{"bins":["bat"]},"install":[{"i
|
|||||||
|
|
||||||
`cat` with syntax highlighting, line numbers, and Git integration.
|
`cat` with syntax highlighting, line numbers, and Git integration.
|
||||||
|
|
||||||
## When to use
|
|
||||||
|
|
||||||
- Reading or displaying a file in the terminal — prefer it over plain
|
|
||||||
`cat`: syntax highlighting, line numbers, git-side indicators.
|
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
### Basic usage
|
### Basic usage
|
||||||
124
.opencode/skills/create-pr/SKILL.md
Normal file
124
.opencode/skills/create-pr/SKILL.md
Normal file
@ -0,0 +1,124 @@
|
|||||||
|
---
|
||||||
|
name: create-pr
|
||||||
|
description: Create or update a GitHub PR following Penpot conventions, with a concise engineer-focused description
|
||||||
|
---
|
||||||
|
|
||||||
|
# Pull Request (Create or Update)
|
||||||
|
|
||||||
|
Create or update a GitHub PR with proper title format and a concise description that explains reasoning, not implementation details.
|
||||||
|
|
||||||
|
## When to Use
|
||||||
|
|
||||||
|
- Opening a new pull request
|
||||||
|
- Updating an existing PR's title or description
|
||||||
|
- The user asks to create or update a PR
|
||||||
|
- Code changes are ready and committed
|
||||||
|
|
||||||
|
## Conventions
|
||||||
|
|
||||||
|
All PR conventions (title format, body structure, writing principles, what NOT to include) are documented in `mem:workflow/creating-prs`. This skill covers the procedure only.
|
||||||
|
|
||||||
|
## Workflow A: Creating a New PR
|
||||||
|
|
||||||
|
### A1. Verify Prerequisites
|
||||||
|
|
||||||
|
```bash
|
||||||
|
git branch --show-current
|
||||||
|
git log --oneline main..HEAD
|
||||||
|
```
|
||||||
|
|
||||||
|
### A2. Check if Branch is Pushed
|
||||||
|
|
||||||
|
```bash
|
||||||
|
BRANCH=$(git branch --show-current)
|
||||||
|
if git ls-remote --heads origin "$BRANCH" | grep -q "$BRANCH"; then
|
||||||
|
echo "Branch is pushed, proceeding with PR creation"
|
||||||
|
else
|
||||||
|
echo "ERROR: Branch '$BRANCH' is not pushed to remote. Please push the branch first."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
```
|
||||||
|
|
||||||
|
**If the branch is not pushed, STOP here and ask the user to push it. The LLM does not have push permissions.**
|
||||||
|
|
||||||
|
### A3. Create PR Body
|
||||||
|
|
||||||
|
Write the body to `/tmp/pr-body.md` using the template from `mem:workflow/creating-prs` (Description Body section):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cat > /tmp/pr-body.md << 'EOF'
|
||||||
|
**Note:** This PR was created with AI assistance as part of the Penpot MCP self-improvement initiative.
|
||||||
|
|
||||||
|
## What
|
||||||
|
|
||||||
|
<one paragraph: the problem or feature, user-facing impact>
|
||||||
|
|
||||||
|
## Why
|
||||||
|
|
||||||
|
<root cause or motivation, why this change was necessary>
|
||||||
|
|
||||||
|
## How
|
||||||
|
|
||||||
|
<high-level approach, key technical decisions>
|
||||||
|
EOF
|
||||||
|
```
|
||||||
|
|
||||||
|
### A4. Create the PR
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gh pr create --base main --project "Main" --title "<title>" --body-file /tmp/pr-body.md
|
||||||
|
```
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## Workflow B: Updating an Existing PR
|
||||||
|
|
||||||
|
Use this when a PR already exists and you need to change its title or description (or both).
|
||||||
|
|
||||||
|
### B1. Find the PR Number
|
||||||
|
|
||||||
|
```bash
|
||||||
|
BRANCH=$(git branch --show-current)
|
||||||
|
gh pr list --head "$BRANCH" --state open --json number --jq '.[0].number'
|
||||||
|
```
|
||||||
|
|
||||||
|
If the result is empty, there is no open PR for this branch — use Workflow A instead.
|
||||||
|
If multiple PRs match, pick the first one (typically there should only be one).
|
||||||
|
|
||||||
|
### B2. Determine What to Update
|
||||||
|
|
||||||
|
- **Title only:** use `--title "<new title>"`
|
||||||
|
- **Description (body) only:** write to `/tmp/pr-body.md` and use `--body-file /tmp/pr-body.md`
|
||||||
|
- **Both title and description:** supply both flags
|
||||||
|
|
||||||
|
### B3. Prepare Description (if updating)
|
||||||
|
|
||||||
|
Use the same template from `mem:workflow/creating-prs`:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cat > /tmp/pr-body.md << 'EOF'
|
||||||
|
**Note:** This PR was created with AI assistance as part of the Penpot MCP self-improvement initiative.
|
||||||
|
|
||||||
|
## What
|
||||||
|
|
||||||
|
<one paragraph: the problem or feature, user-facing impact>
|
||||||
|
|
||||||
|
## Why
|
||||||
|
|
||||||
|
<root cause or motivation, why this change was necessary>
|
||||||
|
|
||||||
|
## How
|
||||||
|
|
||||||
|
<high-level approach, key technical decisions>
|
||||||
|
EOF
|
||||||
|
```
|
||||||
|
|
||||||
|
### B4. Update the PR
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gh pr edit <NUMBER> --title "<title>" --body-file /tmp/pr-body.md
|
||||||
|
```
|
||||||
|
|
||||||
|
Omit either flag if only one field is being updated.
|
||||||
|
|
||||||
|
**The LLM has permissions to edit PRs. No push required.**
|
||||||
@ -9,11 +9,6 @@ metadata: {"clawdbot":{"emoji":"📂","requires":{"bins":["fd"]},"install":[{"id
|
|||||||
|
|
||||||
User-friendly alternative to `find` with smart defaults.
|
User-friendly alternative to `find` with smart defaults.
|
||||||
|
|
||||||
## When to use
|
|
||||||
|
|
||||||
- Locating files or directories by name or pattern — prefer it over
|
|
||||||
plain `find`: simpler syntax, smart defaults, respects `.gitignore`.
|
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
### Basic search
|
### Basic search
|
||||||
227
.opencode/skills/gh-issue-from-pr/SKILL.md
Normal file
227
.opencode/skills/gh-issue-from-pr/SKILL.md
Normal file
@ -0,0 +1,227 @@
|
|||||||
|
---
|
||||||
|
name: gh-issue-from-pr
|
||||||
|
description: Create a user-facing GitHub issue from a PR, separating the WHAT from the HOW, with correct milestone, project, labels, and issue type.
|
||||||
|
---
|
||||||
|
|
||||||
|
# Skill: gh-issue-from-pr
|
||||||
|
|
||||||
|
Create a GitHub issue that captures the **WHAT** (user-facing feature or
|
||||||
|
bug) from an existing PR that describes the **HOW** (implementation).
|
||||||
|
Used when the project board needs an issue as the primary changelog/release unit.
|
||||||
|
|
||||||
|
## When to Use
|
||||||
|
|
||||||
|
- Create a tracking issue from a PR for changelog purposes
|
||||||
|
- Extract the user-facing problem/feature from a PR's implementation details
|
||||||
|
- Assign milestone, project, labels, and issue type to a new issue derived from a PR
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
- `gh` CLI authenticated (`gh auth status`)
|
||||||
|
- Permission to create issues and edit PRs in the target repository
|
||||||
|
|
||||||
|
## Workflow
|
||||||
|
|
||||||
|
### 1. Understand the PR
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gh pr view <PR_NUMBER> --repo penpot/penpot \
|
||||||
|
--json title,body,author,labels,baseRefName,mergedAt,state,milestone
|
||||||
|
```
|
||||||
|
|
||||||
|
Identify:
|
||||||
|
|
||||||
|
- **WHAT** — user-facing problem or feature. Goes into the issue.
|
||||||
|
Describe symptoms and impact, not internal mechanisms.
|
||||||
|
- **HOW** — implementation details. These belong in the PR, not the issue.
|
||||||
|
|
||||||
|
### 2. Determine metadata
|
||||||
|
|
||||||
|
| Field | Source | Rule |
|
||||||
|
|-------|--------|------|
|
||||||
|
| **Title** | PR title | Rewrite from user perspective. Strip leading emoji prefixes (`:bug:`, `:sparkles:`, `:tada:`). Focus on observable behavior. Use imperative mood. Use the `issue-title` skill to generate this. |
|
||||||
|
| **Labels** | PR labels | Copy `community contribution` if present. Skip `bug` and `enhancement` (redundant with Issue Type). Skip workflow labels (`backport candidate`, `team-qa`). |
|
||||||
|
| **Milestone** | PR milestone | **Always copy what's on the PR.** Fetch with: `gh pr view <PR_NUMBER> --json milestone --jq '.milestone.title'` If the PR has no milestone, create the issue without one. |
|
||||||
|
| **Project** | Always `Main` | Penpot uses the `Main` project (number 8) for all issues. |
|
||||||
|
| **Body** | PR's user-facing section | Extract steps to reproduce or feature description. Omit internal details. Use templates below. |
|
||||||
|
| **Issue Type** | PR labels / title | Map: `bug` label or `:bug:` title → `Bug`. `enhancement` label or `:sparkles:` title → `Enhancement`. Feature/epic → `Feature`. Default → `Task`. |
|
||||||
|
|
||||||
|
### 3. Write the issue body
|
||||||
|
|
||||||
|
**Bug template:**
|
||||||
|
|
||||||
|
```markdown
|
||||||
|
### Description
|
||||||
|
|
||||||
|
<what breaks, what the user experiences>
|
||||||
|
|
||||||
|
### Steps to reproduce
|
||||||
|
|
||||||
|
1. <step 1>
|
||||||
|
2. <step 2>
|
||||||
|
|
||||||
|
### Expected behavior
|
||||||
|
|
||||||
|
<what should happen instead>
|
||||||
|
|
||||||
|
### Affected versions
|
||||||
|
|
||||||
|
<version>
|
||||||
|
```
|
||||||
|
|
||||||
|
**Enhancement template:**
|
||||||
|
|
||||||
|
```markdown
|
||||||
|
### Description
|
||||||
|
|
||||||
|
<what the user can now do that they couldn't before>
|
||||||
|
|
||||||
|
### Use case
|
||||||
|
|
||||||
|
<why this is useful, who benefits>
|
||||||
|
|
||||||
|
### Affected versions
|
||||||
|
|
||||||
|
<version>
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. Create the issue
|
||||||
|
|
||||||
|
Write the body to a temp file to avoid shell quoting issues:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
cat > /tmp/issue-body.md << 'ISSUE_BODY'
|
||||||
|
<body content here>
|
||||||
|
ISSUE_BODY
|
||||||
|
```
|
||||||
|
|
||||||
|
Create:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gh issue create \
|
||||||
|
--repo penpot/penpot \
|
||||||
|
--title "<Title>" \
|
||||||
|
--label "community contribution" \ # only if PR has this label
|
||||||
|
--milestone "<milestone>" \
|
||||||
|
--project "Main" \
|
||||||
|
--body-file /tmp/issue-body.md
|
||||||
|
```
|
||||||
|
|
||||||
|
Output: `https://github.com/penpot/penpot/issues/<NUMBER>`
|
||||||
|
|
||||||
|
### 5. Assign to the PR author
|
||||||
|
|
||||||
|
Assign the issue to the PR author so they're responsible for it:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
AUTHOR=$(gh pr view <PR_NUMBER> --repo penpot/penpot --json author --jq '.author.login')
|
||||||
|
gh issue edit <ISSUE_NUMBER> --repo penpot/penpot --add-assignee "$AUTHOR"
|
||||||
|
```
|
||||||
|
|
||||||
|
### 6. Set the Issue Type
|
||||||
|
|
||||||
|
`gh issue create` can't set the Issue Type directly. Use GraphQL.
|
||||||
|
|
||||||
|
Get the issue's GraphQL node ID:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
ISSUE_ID=$(gh api graphql -f query='
|
||||||
|
query { repository(owner: "penpot", name: "penpot") {
|
||||||
|
issue(number: <ISSUE_NUMBER>) { id }
|
||||||
|
}}' --jq '.data.repository.issue.id')
|
||||||
|
```
|
||||||
|
|
||||||
|
Issue Type IDs for the Penpot repo:
|
||||||
|
|
||||||
|
| Type | ID |
|
||||||
|
|------|----|
|
||||||
|
| Bug | `IT_kwDOAcyBPM4AX5Nb` |
|
||||||
|
| Enhancement | `IT_kwDOAcyBPM4B_IQN` |
|
||||||
|
| Feature | `IT_kwDOAcyBPM4AX5Nf` |
|
||||||
|
| Task | `IT_kwDOAcyBPM4AX5NY` |
|
||||||
|
| Question | `IT_kwDOAcyBPM4B_IQj` |
|
||||||
|
| Docs | `IT_kwDOAcyBPM4B_IQz` |
|
||||||
|
|
||||||
|
Set it:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gh api graphql -f query='
|
||||||
|
mutation {
|
||||||
|
updateIssue(input: {
|
||||||
|
id: "'"$ISSUE_ID"'"
|
||||||
|
issueTypeId: "<TYPE_ID>"
|
||||||
|
}) {
|
||||||
|
issue { number issueType { name } }
|
||||||
|
}
|
||||||
|
}'
|
||||||
|
```
|
||||||
|
|
||||||
|
### 7. Verify
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gh issue view <ISSUE_NUMBER> --repo penpot/penpot \
|
||||||
|
--json title,milestone,projectItems,labels \
|
||||||
|
--jq '{title, milestone: .milestone.title, projects: [.projectItems[].title], labels: [.labels[].name]}'
|
||||||
|
|
||||||
|
gh api graphql -f query='
|
||||||
|
query { repository(owner: "penpot", name: "penpot") {
|
||||||
|
issue(number: <ISSUE_NUMBER>) { issueType { name } }
|
||||||
|
}}' --jq '.data.repository.issue.issueType.name'
|
||||||
|
```
|
||||||
|
|
||||||
|
### 8. Link the PR to the issue
|
||||||
|
|
||||||
|
Append `Closes #<ISSUE_NUMBER>` to the PR body:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gh pr view <PR_NUMBER> --repo penpot/penpot --json body --jq '.body' > /tmp/pr-body.md
|
||||||
|
printf "\n\nCloses #<ISSUE_NUMBER>\n" >> /tmp/pr-body.md
|
||||||
|
gh pr edit <PR_NUMBER> --repo penpot/penpot --body-file /tmp/pr-body.md
|
||||||
|
|
||||||
|
# Verify
|
||||||
|
gh pr view <PR_NUMBER> --repo penpot/penpot --json body \
|
||||||
|
--jq '.body | test("Closes #<ISSUE_NUMBER>")'
|
||||||
|
```
|
||||||
|
|
||||||
|
**Note:** If the PR is already merged, `Closes` won't auto-close the issue
|
||||||
|
— it only creates the "Development" sidebar link. This is the desired
|
||||||
|
behavior since the issue is a tracking artifact.
|
||||||
|
|
||||||
|
### 9. Clean up
|
||||||
|
|
||||||
|
```bash
|
||||||
|
rm -f /tmp/issue-body.md /tmp/pr-body.md
|
||||||
|
```
|
||||||
|
|
||||||
|
## Label rules
|
||||||
|
|
||||||
|
| PR has | Issue gets |
|
||||||
|
|--------|-----------|
|
||||||
|
| `community contribution` | `community contribution` |
|
||||||
|
| `bug`, `enhancement` | *(skip — redundant with Issue Type)* |
|
||||||
|
| `backport candidate` | *(skip — workflow label)* |
|
||||||
|
| `team-qa` | *(skip — workflow label)* |
|
||||||
|
|
||||||
|
## Issue Type mapping
|
||||||
|
|
||||||
|
| PR label(s) / title prefix | Issue Type |
|
||||||
|
|----------------------------|-----------|
|
||||||
|
| `bug` or `:bug:` | Bug |
|
||||||
|
| `enhancement` or `:sparkles:` or `:tada:` | Enhancement |
|
||||||
|
| Feature / epic | Feature |
|
||||||
|
| Documentation | Docs |
|
||||||
|
| None of the above | Task |
|
||||||
|
|
||||||
|
## Key Principles
|
||||||
|
|
||||||
|
- **Issue = WHAT, PR = HOW.** Never put implementation details in the
|
||||||
|
issue body. The issue is for users, QA, and changelog readers.
|
||||||
|
- **Copy the milestone from the PR.** Don't guess based on branch names.
|
||||||
|
If the PR has no milestone, create the issue without one.
|
||||||
|
- **Set Issue Type via GraphQL** — `gh issue create` can't set it.
|
||||||
|
- **Link via PR body** — `Closes #<NUMBER>` creates the "Development"
|
||||||
|
sidebar link automatically.
|
||||||
|
- **One issue per PR** — even if a PR fixes multiple things, create a
|
||||||
|
single issue that summarizes the overall change.
|
||||||
|
- **Community attribution:** if the PR has the `community contribution`
|
||||||
|
label or the author is not a core team member, add the label to the issue.
|
||||||
123
.opencode/skills/issue-title/SKILL.md
Normal file
123
.opencode/skills/issue-title/SKILL.md
Normal file
@ -0,0 +1,123 @@
|
|||||||
|
---
|
||||||
|
name: issue-title
|
||||||
|
description: Derive a clear, well-formatted title for a GitHub issue from its description body, using descriptive present-tense for bugs and imperative mood for features, always including the "where" (location in the UI/module).
|
||||||
|
---
|
||||||
|
|
||||||
|
# Skill: issue-title
|
||||||
|
|
||||||
|
Derive a concise, descriptive title for a GitHub issue based on its body
|
||||||
|
content. Use **descriptive present tense for bugs** (e.g. "Plugin API
|
||||||
|
crashes when setting text fills") and **imperative mood for features** (e.g.
|
||||||
|
"Add customizable dash and gap controls"). No emoji or type prefixes
|
||||||
|
(`feat:`, `bug:`, `feature:`, etc.).
|
||||||
|
|
||||||
|
Can be used both when **creating a new issue** and when **updating an
|
||||||
|
existing one** that has a vague or outdated title.
|
||||||
|
|
||||||
|
## When to Use
|
||||||
|
|
||||||
|
- Creating a new issue and need a well-formatted title from the draft body
|
||||||
|
- An existing issue has a vague, outdated, or auto-generated title (e.g.
|
||||||
|
`[PENPOT FEEDBACK]: ...`, `feature: ...`)
|
||||||
|
- The current title doesn't reflect the actual content of the description
|
||||||
|
- The title is missing the "where" (which part of the UI/module is affected)
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
- `gh` CLI authenticated (`gh auth status`)
|
||||||
|
|
||||||
|
## Workflow
|
||||||
|
|
||||||
|
### 1. Get the issue body
|
||||||
|
|
||||||
|
For an **existing issue**, fetch it:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gh issue view <NUMBER> --repo penpot/penpot --json title,body
|
||||||
|
```
|
||||||
|
|
||||||
|
For a **new issue**, read the draft body from wherever it was provided
|
||||||
|
(Taiga link, user report, discussion, etc.).
|
||||||
|
|
||||||
|
### 2. Read the body and derive a title
|
||||||
|
|
||||||
|
Extract the core problem or request from the description. Distinguish between
|
||||||
|
bug reports and feature requests:
|
||||||
|
|
||||||
|
**Bug titles (descriptive, present tense):**
|
||||||
|
Describe the symptom as it appears to the user. Format:
|
||||||
|
`[Where] [present-tense verb] when [condition]`
|
||||||
|
|
||||||
|
- *"Plugin API crashes when setting text fills"*
|
||||||
|
- *"Canvas renders glitches when zooming quickly"*
|
||||||
|
- *"French Canada locale falls back to French (fr) translations"*
|
||||||
|
- *"Text layer content is not deleted when WebGL render is enabled"*
|
||||||
|
|
||||||
|
Do **not** start bug titles with "Fix" or any imperative verb. The title
|
||||||
|
should state what's broken, not command a fix.
|
||||||
|
|
||||||
|
**Feature / Enhancement titles (imperative mood):**
|
||||||
|
Command what should be built. Format:
|
||||||
|
`[Imperative verb] [what] in/on [where]`
|
||||||
|
|
||||||
|
- *"Add customizable dash and gap length controls to dashed strokes in the sidebar"*
|
||||||
|
- *"Show user, timestamp, and hash in the workspace history panel like git commits"*
|
||||||
|
- *"Validate shape on add-object to catch malformed inputs early"*
|
||||||
|
|
||||||
|
**Universal rules (both types):**
|
||||||
|
- **Include the "where"** — specify the UI location or module (e.g.
|
||||||
|
"in the sidebar", "in the workspace history panel", "on the stroke
|
||||||
|
options")
|
||||||
|
- **No prefixes** — strip `bug:`, `feature:`, `feat:`, `:bug:`, `:sparkles:`,
|
||||||
|
`[PENPOT FEEDBACK]`, etc.
|
||||||
|
- **No emoji** — plain text only
|
||||||
|
- **Be specific** — prefer concrete detail over generality. If the
|
||||||
|
description mentions two related problems, capture both.
|
||||||
|
|
||||||
|
**Examples:**
|
||||||
|
|
||||||
|
| Original / draft title | Type | New title |
|
||||||
|
|---|---|---|
|
||||||
|
| `[PENPOT FEEDBACK]: WebGL` | Bug | `Canvas renders glitches when zooming quickly — text appears distorted and nodes have background-colored rectangles` |
|
||||||
|
| `bug: flatten-nested-tokens-json uses $type instead of $value as the DTCG token/group discriminator` | Bug | `Token import fails when group-level type inheritance is used — parser misidentifies groups as tokens` |
|
||||||
|
| `feature: Dashed stroke customization` | Feature | `Add customizable dash and gap length controls to dashed strokes in the sidebar` |
|
||||||
|
| `feature: Add more detail to history of actions` | Feature | `Show user, timestamp, and hash in the workspace history panel like git commits` |
|
||||||
|
|
||||||
|
### 3. Apply the title
|
||||||
|
|
||||||
|
**If updating an existing issue:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gh issue edit <NUMBER> --repo penpot/penpot --title "<NEW TITLE>"
|
||||||
|
```
|
||||||
|
|
||||||
|
**If creating a new issue:**
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gh issue create --repo penpot/penpot --title "<NEW TITLE>" --body "<BODY>"
|
||||||
|
```
|
||||||
|
|
||||||
|
### 4. Confirm
|
||||||
|
|
||||||
|
For updates, the command returns the issue URL. Verify by optionally fetching
|
||||||
|
again:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
gh issue view <NUMBER> --repo penpot/penpot --json title
|
||||||
|
```
|
||||||
|
|
||||||
|
## Key Principles
|
||||||
|
|
||||||
|
- **Bug titles describe the symptom** — present tense, 3rd person:
|
||||||
|
"crashes", "fails", "shows", "is cut off", "does not load". Do not
|
||||||
|
start with "Fix" or "Bug:".
|
||||||
|
- **Feature titles use imperative mood** — command form: "Add", "Show",
|
||||||
|
"Use", "Validate", "Support", "Toggle".
|
||||||
|
- **Always include the "where"** — a title like "Crashes when zooming"
|
||||||
|
is too vague; "Canvas crashes when zooming quickly" is clear.
|
||||||
|
- **No prefixes, no emoji** — strip all type labels and decorative
|
||||||
|
characters from the title.
|
||||||
|
- **Derive from the body, not the current title** — the body contains
|
||||||
|
the real detail; the current title may be auto-generated or stale.
|
||||||
|
- **Two problems → cover both** — if the description has two distinct
|
||||||
|
but related issues, capture both in the title joined by "and".
|
||||||
@ -9,11 +9,6 @@ metadata: {"clawdbot":{"emoji":"🔍","requires":{"bins":["jq"]},"install":[{"id
|
|||||||
|
|
||||||
Process, filter, and transform JSON data with jq.
|
Process, filter, and transform JSON data with jq.
|
||||||
|
|
||||||
## When to use
|
|
||||||
|
|
||||||
- Parsing, filtering, or transforming JSON from commands, files, or API
|
|
||||||
responses — slicing, reshaping, or validating JSON output.
|
|
||||||
|
|
||||||
## Quick Examples
|
## Quick Examples
|
||||||
|
|
||||||
### Basic filtering
|
### Basic filtering
|
||||||
@ -1,7 +1,12 @@
|
|||||||
|
---
|
||||||
|
name: nrepl-eval
|
||||||
|
description: Evaluate Clojure code via nREPL using the standalone tools/nrepl-eval.mjs CLI tool.
|
||||||
|
---
|
||||||
|
|
||||||
# nREPL Eval
|
# nREPL Eval
|
||||||
|
|
||||||
Evaluate Clojure (or ClojureScript) code via a running nREPL server using
|
Evaluate Clojure (or ClojureScript) code via a running nREPL server using
|
||||||
`scripts/nrepl-eval.mjs` — a standalone CLI application.
|
`tools/nrepl-eval.mjs` — a standalone CLI application.
|
||||||
|
|
||||||
Session state (defs, in-ns, etc.) persists across invocations via a stored
|
Session state (defs, in-ns, etc.) persists across invocations via a stored
|
||||||
session ID, so you can build up state incrementally.
|
session ID, so you can build up state incrementally.
|
||||||
@ -9,17 +14,18 @@ session ID, so you can build up state incrementally.
|
|||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
node scripts/nrepl-eval.mjs [options] [<code>]
|
node tools/nrepl-eval.mjs [options] [<code>]
|
||||||
# or
|
```
|
||||||
./scripts/nrepl-eval.mjs [options] [<code>]
|
|
||||||
|
The tool is also executable directly:
|
||||||
|
```bash
|
||||||
|
./tools/nrepl-eval.mjs [options] [<code>]
|
||||||
```
|
```
|
||||||
|
|
||||||
## Options
|
## Options
|
||||||
|
|
||||||
| Flag | Description | Default |
|
| Flag | Description | Default |
|
||||||
|------|-------------|---------|
|
|------|-------------|---------|
|
||||||
| `--backend` | Connect to backend nREPL (port 6064) | — |
|
|
||||||
| `--frontend` | Connect to frontend nREPL (port 3447) | — |
|
|
||||||
| `-p, --port PORT` | nREPL server port | `6064` |
|
| `-p, --port PORT` | nREPL server port | `6064` |
|
||||||
| `-H, --host HOST` | nREPL server host | `127.0.0.1` |
|
| `-H, --host HOST` | nREPL server host | `127.0.0.1` |
|
||||||
| `-t, --timeout MS` | Timeout in milliseconds | `120000` |
|
| `-t, --timeout MS` | Timeout in milliseconds | `120000` |
|
||||||
@ -27,11 +33,10 @@ node scripts/nrepl-eval.mjs [options] [<code>]
|
|||||||
| `-e, --last-error` | Evaluate `*e` to retrieve the last exception | — |
|
| `-e, --last-error` | Evaluate `*e` to retrieve the last exception | — |
|
||||||
| `-h, --help` | Show help message | — |
|
| `-h, --help` | Show help message | — |
|
||||||
|
|
||||||
- `--backend` and `--frontend` are mutually exclusive.
|
|
||||||
- Explicit `--port` is overridden when `--backend`/`--frontend` is used.
|
|
||||||
|
|
||||||
## When to Use
|
## When to Use
|
||||||
|
|
||||||
|
Use this tool when you need to:
|
||||||
|
|
||||||
1. **Evaluate Clojure code** during development — test functions, inspect
|
1. **Evaluate Clojure code** during development — test functions, inspect
|
||||||
state, or run experiments against a running Clojure process.
|
state, or run experiments against a running Clojure process.
|
||||||
2. **Verify that edited files compile** — require namespaces with `:reload`
|
2. **Verify that edited files compile** — require namespaces with `:reload`
|
||||||
@ -41,43 +46,33 @@ node scripts/nrepl-eval.mjs [options] [<code>]
|
|||||||
|
|
||||||
## Workflow
|
## Workflow
|
||||||
|
|
||||||
### Session management
|
### 1. Session management
|
||||||
|
|
||||||
Sessions are persisted to `/tmp/penpot-nrepl-session-<host>-<port>`. State
|
Sessions are persisted to `/tmp/penpot-nrepl-session-<host>-<port>`. State
|
||||||
carries across calls automatically:
|
carries across calls automatically:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./scripts/nrepl-eval.mjs '(def x 42)'
|
./tools/nrepl-eval.mjs '(def x 42)'
|
||||||
./scripts/nrepl-eval.mjs 'x'
|
./tools/nrepl-eval.mjs 'x'
|
||||||
# => 42
|
# => 42
|
||||||
```
|
```
|
||||||
|
|
||||||
Reset the session to start fresh:
|
Reset the session to start fresh:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./scripts/nrepl-eval.mjs --reset-session '(def x 0)'
|
./tools/nrepl-eval.mjs --reset-session '(def x 0)'
|
||||||
```
|
```
|
||||||
|
|
||||||
### Evaluate code
|
### 2. Evaluate code
|
||||||
|
|
||||||
**Single expression (inline) — uses default port 6064:**
|
**Single expression (inline) — uses default port 6064:**
|
||||||
```bash
|
```bash
|
||||||
./scripts/nrepl-eval.mjs '(+ 1 2 3)'
|
./tools/nrepl-eval.mjs '(+ 1 2 3)'
|
||||||
```
|
|
||||||
|
|
||||||
**Backend nREPL (explicit):**
|
|
||||||
```bash
|
|
||||||
./scripts/nrepl-eval.mjs --backend '(+ 1 2 3)'
|
|
||||||
```
|
|
||||||
|
|
||||||
**Frontend nREPL:**
|
|
||||||
```bash
|
|
||||||
./scripts/nrepl-eval.mjs --frontend '(js/alert "hi")'
|
|
||||||
```
|
```
|
||||||
|
|
||||||
**Multiple expressions via heredoc (recommended — avoids escaping issues):**
|
**Multiple expressions via heredoc (recommended — avoids escaping issues):**
|
||||||
```bash
|
```bash
|
||||||
./scripts/nrepl-eval.mjs <<'EOF'
|
./tools/nrepl-eval.mjs <<'EOF'
|
||||||
(def x 10)
|
(def x 10)
|
||||||
(+ x 20)
|
(+ x 20)
|
||||||
EOF
|
EOF
|
||||||
@ -85,61 +80,38 @@ EOF
|
|||||||
|
|
||||||
**Override with a different port:**
|
**Override with a different port:**
|
||||||
```bash
|
```bash
|
||||||
./scripts/nrepl-eval.mjs -p 7888 '(+ 1 2 3)'
|
./tools/nrepl-eval.mjs -p 7888 '(+ 1 2 3)'
|
||||||
```
|
```
|
||||||
|
|
||||||
### Inspect last exception
|
### 3. Inspect last exception
|
||||||
|
|
||||||
After code throws an error, retrieve the full exception details:
|
After code throws an error, retrieve the full exception details:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
./scripts/nrepl-eval.mjs -e
|
./tools/nrepl-eval.mjs -e
|
||||||
```
|
```
|
||||||
|
|
||||||
## Common Patterns
|
## Common Patterns
|
||||||
|
|
||||||
**Require a namespace with reload:**
|
**Require a namespace with reload:**
|
||||||
```bash
|
```bash
|
||||||
./scripts/nrepl-eval.mjs "(require '[my.namespace :as ns] :reload)"
|
./tools/nrepl-eval.mjs "(require '[my.namespace :as ns] :reload)"
|
||||||
```
|
```
|
||||||
|
|
||||||
**Test a function:**
|
**Test a function:**
|
||||||
```bash
|
```bash
|
||||||
./scripts/nrepl-eval.mjs "(ns/my-function arg1 arg2)"
|
./tools/nrepl-eval.mjs "(ns/my-function arg1 arg2)"
|
||||||
```
|
```
|
||||||
|
|
||||||
**Long-running operation with custom timeout:**
|
**Long-running operation with custom timeout:**
|
||||||
```bash
|
```bash
|
||||||
./scripts/nrepl-eval.mjs -t 300000 "(long-running-fn)"
|
./tools/nrepl-eval.mjs -t 300000 "(long-running-fn)"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Accessing Private Functions
|
|
||||||
|
|
||||||
Private functions (declared with `^:private` or `defn-`) cannot be called
|
|
||||||
directly from outside their namespace. Use the var quote syntax `#'` to
|
|
||||||
access the underlying var:
|
|
||||||
|
|
||||||
**This fails:**
|
|
||||||
```bash
|
|
||||||
./scripts/nrepl-eval.mjs "(app.rpc.commands.error-reports/build-list-query {})"
|
|
||||||
# => Syntax error: app.rpc.commands.error-reports/build-list-query is not public
|
|
||||||
```
|
|
||||||
|
|
||||||
**This works:**
|
|
||||||
```bash
|
|
||||||
./scripts/nrepl-eval.mjs "(#'app.rpc.commands.error-reports/build-list-query {})"
|
|
||||||
# => Returns the result
|
|
||||||
```
|
|
||||||
|
|
||||||
The `#'` reader macro resolves to `(var ...)`, giving you direct access to
|
|
||||||
the var regardless of its visibility modifier. The syntax is `#'` followed
|
|
||||||
by the fully qualified symbol.
|
|
||||||
|
|
||||||
## Key Principles
|
## Key Principles
|
||||||
|
|
||||||
- **Default port is 6064** — just pass code directly, no `-p` needed when
|
- **Default port is 6064** — just pass code directly, no `-p` needed when
|
||||||
your nREPL server is on 6064. Use `--backend` (6064) or `--frontend` (3447)
|
your nREPL server is on 6064. Use `-p <PORT>` for a different port.
|
||||||
as quick aliases. Use `-p <PORT>` for any other port.
|
|
||||||
- **Always use `:reload`** when requiring namespaces to pick up file changes.
|
- **Always use `:reload`** when requiring namespaces to pick up file changes.
|
||||||
- **Session is reused** across invocations — defs, in-ns, and var bindings
|
- **Session is reused** across invocations — defs, in-ns, and var bindings
|
||||||
persist. Use `--reset-session` to clear.
|
persist. Use `--reset-session` to clear.
|
||||||
@ -9,11 +9,6 @@ metadata: {"clawdbot":{"emoji":"🔎","requires":{"bins":["rg"]},"install":[{"id
|
|||||||
|
|
||||||
Fast, smart recursive search. Respects `.gitignore` by default.
|
Fast, smart recursive search. Respects `.gitignore` by default.
|
||||||
|
|
||||||
## When to use
|
|
||||||
|
|
||||||
- Searching file contents across the repo for regex patterns — the
|
|
||||||
default code search, respects `.gitignore`.
|
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
### Basic search
|
### Basic search
|
||||||
@ -11,15 +11,9 @@ Fetch information from Taiga public API for the **Penpot** project
|
|||||||
|
|
||||||
**No authentication required** — only public project data is accessed.
|
**No authentication required** — only public project data is accessed.
|
||||||
|
|
||||||
## When to use
|
|
||||||
|
|
||||||
- The user asks about Penpot issues, user stories, or tasks tracked in
|
|
||||||
Taiga — fetch them via the public API (project id 345963), no
|
|
||||||
authentication needed.
|
|
||||||
|
|
||||||
## Prerequisites
|
## Prerequisites
|
||||||
|
|
||||||
- `python3` — the `scripts/taiga.py` CLI script is self-contained (stdlib only)
|
- `python3` — the `tools/taiga.py` CLI script is self-contained (stdlib only)
|
||||||
|
|
||||||
## Quick Start
|
## Quick Start
|
||||||
|
|
||||||
@ -27,17 +21,17 @@ The easiest way is to use the bundled Python script:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
# Pass a Taiga URL directly
|
# Pass a Taiga URL directly
|
||||||
python3 scripts/taiga.py https://tree.taiga.io/project/penpot/issue/13714
|
python3 tools/taiga.py https://tree.taiga.io/project/penpot/issue/13714
|
||||||
|
|
||||||
# Or use "<type> <ref>" syntax
|
# Or use "<type> <ref>" syntax
|
||||||
python3 scripts/taiga.py us 14128
|
python3 tools/taiga.py us 14128
|
||||||
python3 scripts/taiga.py task 13648
|
python3 tools/taiga.py task 13648
|
||||||
|
|
||||||
# Add --json for raw output
|
# Add --json for raw output
|
||||||
python3 scripts/taiga.py --json issue 13714
|
python3 tools/taiga.py --json issue 13714
|
||||||
|
|
||||||
# See full usage
|
# See full usage
|
||||||
python3 scripts/taiga.py --help
|
python3 tools/taiga.py --help
|
||||||
```
|
```
|
||||||
|
|
||||||
## URL Pattern Reference
|
## URL Pattern Reference
|
||||||
@ -57,30 +51,30 @@ To extract the **type** and **ref** from a URL:
|
|||||||
|
|
||||||
## Python Script Reference
|
## Python Script Reference
|
||||||
|
|
||||||
The `scripts/taiga.py` script wraps the Taiga API into a single convenient CLI
|
The `tools/taiga.py` script wraps the Taiga API into a single convenient CLI
|
||||||
with sensible defaults.
|
with sensible defaults.
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
|
|
||||||
```
|
```
|
||||||
python3 scripts/taiga.py <taiga-url>
|
python3 tools/taiga.py <taiga-url>
|
||||||
python3 scripts/taiga.py <type> <ref>
|
python3 tools/taiga.py <type> <ref>
|
||||||
python3 scripts/taiga.py [--json] <taiga-url>
|
python3 tools/taiga.py [--json] <taiga-url>
|
||||||
python3 scripts/taiga.py [--json] <type> <ref>
|
python3 tools/taiga.py [--json] <type> <ref>
|
||||||
```
|
```
|
||||||
|
|
||||||
### Examples
|
### Examples
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
# By URL (recommended — no need to think about type/ref)
|
# By URL (recommended — no need to think about type/ref)
|
||||||
python3 scripts/taiga.py https://tree.taiga.io/project/penpot/issue/13714
|
python3 tools/taiga.py https://tree.taiga.io/project/penpot/issue/13714
|
||||||
|
|
||||||
# By type and ref
|
# By type and ref
|
||||||
python3 scripts/taiga.py us 14128
|
python3 tools/taiga.py us 14128
|
||||||
python3 scripts/taiga.py task 13648
|
python3 tools/taiga.py task 13648
|
||||||
|
|
||||||
# Raw JSON output
|
# Raw JSON output
|
||||||
python3 scripts/taiga.py --json issue 13714
|
python3 tools/taiga.py --json issue 13714
|
||||||
```
|
```
|
||||||
|
|
||||||
### Output
|
### Output
|
||||||
630
.opencode/skills/update-changelog/SKILL.md
Normal file
630
.opencode/skills/update-changelog/SKILL.md
Normal file
@ -0,0 +1,630 @@
|
|||||||
|
---
|
||||||
|
name: update-changelog
|
||||||
|
description: Update the project CHANGES.md with issues from a given GitHub milestone, with correct categorization and references.
|
||||||
|
---
|
||||||
|
|
||||||
|
# Skill: update-changelog
|
||||||
|
|
||||||
|
Update `CHANGES.md` with entries for all issues and PRs in a given GitHub
|
||||||
|
milestone. Each entry references the user-facing issue (not the PR) as the
|
||||||
|
primary link, with the fix PR inline on the same line.
|
||||||
|
|
||||||
|
## When to Use
|
||||||
|
|
||||||
|
- Before a new release, to populate the changelog with all fixed issues
|
||||||
|
- When new issues are added to an existing milestone and the changelog needs
|
||||||
|
to be refreshed
|
||||||
|
- To ensure every entry follows the correct format for the changelog
|
||||||
|
|
||||||
|
## Prerequisites
|
||||||
|
|
||||||
|
- `gh` CLI authenticated (`gh auth status`)
|
||||||
|
- Python 3.8+
|
||||||
|
- `tools/gh.py` helper script available
|
||||||
|
|
||||||
|
## Workflow
|
||||||
|
|
||||||
|
### 1. Determine the target version
|
||||||
|
|
||||||
|
The version is typically a semver string like `2.15.3`. Confirm with the user
|
||||||
|
if not specified.
|
||||||
|
|
||||||
|
### 2. Fetch all issues in the milestone
|
||||||
|
|
||||||
|
Use the helper script. It uses GraphQL for efficient single-pass fetching
|
||||||
|
(closing PRs are included in the same query — no N+1):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# All closed issues (default)
|
||||||
|
python3 tools/gh.py issues "2.16.0"
|
||||||
|
|
||||||
|
# Include open issues too
|
||||||
|
python3 tools/gh.py issues "2.16.0" --state all
|
||||||
|
|
||||||
|
# Exclude entries that should not go in the changelog
|
||||||
|
python3 tools/gh.py issues "2.16.0" --exclude "release blocker,no changelog"
|
||||||
|
```
|
||||||
|
|
||||||
|
**Exclusion rules (issue-level):**
|
||||||
|
- `no changelog` label — Chore/refactor work that doesn't need a changelog entry
|
||||||
|
- `release blocker` label — Blocked issues not yet ready for changelog
|
||||||
|
- `Task` issue type — Internal chores are not user-facing; automatically excluded by `gh.py`. Use `--include-tasks` to override.
|
||||||
|
- **Rejected project status** — Issues with a "Rejected" status in the "Main" project board are automatically excluded by `gh.py`. This project-level status (independent of the GitHub issue `state`) indicates the issue was rejected from the release. Use `--include-rejected` to override.
|
||||||
|
|
||||||
|
**Exclusion rules (PR-level):**
|
||||||
|
In addition to issue-level exclusions, PRs with these labels should be
|
||||||
|
excluded regardless of their linked issue's labels:
|
||||||
|
- `release blocker` — PR is part of a pending release blocker batch
|
||||||
|
- `no issue required` — Trivial fix not tracked as an issue
|
||||||
|
|
||||||
|
The script outputs JSON with each entry containing `number`, `title`, `state`,
|
||||||
|
`issue_type`, `labels`, `closing_prs` (the PRs that fix each issue), and
|
||||||
|
`project_status` (the "Main" project board status, e.g. "Done", "Rejected",
|
||||||
|
or `null` if not tracked in a project).
|
||||||
|
|
||||||
|
### 3. Identify missing entries (optional)
|
||||||
|
|
||||||
|
If updating from an existing `CHANGES.md`, find issues in the milestone that
|
||||||
|
are NOT yet referenced in the changelog:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python3 tools/gh.py issues "2.16.0" --exclude "release blocker,no changelog" --compare CHANGES.md
|
||||||
|
```
|
||||||
|
|
||||||
|
This returns a filtered JSON array with only the missing issues.
|
||||||
|
|
||||||
|
> **Note:** The `--compare` flag checks **issues** only (via issue number
|
||||||
|
> references in the changelog). To find merged **PRs** not yet referenced,
|
||||||
|
> use the milestone PR cross-reference described in step 10 below.
|
||||||
|
|
||||||
|
### 4. Fetch additional PR details when needed
|
||||||
|
|
||||||
|
When you need more context for specific PRs (e.g. to find the PR author for
|
||||||
|
community contribution attribution, or to read the PR body for
|
||||||
|
"Fixes/Closes #NNN" patterns):
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# One or more PR numbers
|
||||||
|
python3 tools/gh.py prs 9179 9204 9311
|
||||||
|
|
||||||
|
# From a file
|
||||||
|
python3 tools/gh.py prs --file prs.txt
|
||||||
|
|
||||||
|
# From stdin
|
||||||
|
cat prs.txt | python3 tools/gh.py prs --stdin
|
||||||
|
```
|
||||||
|
|
||||||
|
The `prs` command also supports listing all PRs in a milestone in one call:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# All merged PRs in a milestone (default)
|
||||||
|
python3 tools/gh.py prs --milestone "2.16.0"
|
||||||
|
|
||||||
|
# All states (merged, open, closed)
|
||||||
|
python3 tools/gh.py prs --milestone "2.16.0" --state all
|
||||||
|
```
|
||||||
|
|
||||||
|
The `prs` command returns JSON with `number`, `title`, `body`, `state`,
|
||||||
|
`merged_at`, `author`, `labels`, and `closing_issues`. PRs are fetched in
|
||||||
|
batches of 50 via GraphQL to stay within API limits (milestone mode uses
|
||||||
|
paginated GraphQL on the milestone's `pullRequests` connection).
|
||||||
|
|
||||||
|
You can also list all PRs in a milestone in a single call:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# All merged PRs in a milestone (default)
|
||||||
|
python3 tools/gh.py prs --milestone "2.16.0"
|
||||||
|
|
||||||
|
# All states (merged, open, closed)
|
||||||
|
python3 tools/gh.py prs --milestone "2.16.0" --state all
|
||||||
|
|
||||||
|
# Open PRs only
|
||||||
|
python3 tools/gh.py prs --milestone "2.16.0" --state open
|
||||||
|
```
|
||||||
|
|
||||||
|
The milestone path uses paginated GraphQL on the milestone's `pullRequests`
|
||||||
|
connection (100 per page), avoiding one-by-one fetches.
|
||||||
|
|
||||||
|
### 5. Categorize entries — strictly by issue type, never by labels or emoji
|
||||||
|
|
||||||
|
Use the **Issue Type** field (GitHub's native issue type, exposed as
|
||||||
|
`issue_type` in the `gh.py` JSON output) to determine which section an entry
|
||||||
|
belongs to.
|
||||||
|
|
||||||
|
> **⚠️ CRITICAL: Never use labels or title emoji prefixes for categorization.**
|
||||||
|
> Labels like `bug` and `enhancement`, as well as title prefixes like `:bug:`
|
||||||
|
> and `:sparkles:`, are frequently inaccurate, missing, or contradictory to the
|
||||||
|
> actual issue type. The `issue_type` field from `gh.py` is the single source
|
||||||
|
> of truth.
|
||||||
|
|
||||||
|
| `issue_type` value | Changelog section |
|
||||||
|
|--------------------|-------------------|
|
||||||
|
| `Bug` | `### :bug: Bugs fixed` |
|
||||||
|
| `Feature` or `Enhancement` | `### :sparkles: New features & Enhancements` |
|
||||||
|
| `Task` | **Exclude** — internal chores are not user-facing |
|
||||||
|
| `null` (not set) | Check labels as a fallback: `bug` label → bugs, otherwise enhancements |
|
||||||
|
|
||||||
|
The `gh.py` issues command already includes `issue_type` in every entry's
|
||||||
|
output. **No separate GraphQL query is needed.**
|
||||||
|
|
||||||
|
**Community contribution attribution:** If the issue or its fix PR has the
|
||||||
|
`community contribution` label, add an attribution `(by @<github_username>)`
|
||||||
|
on the changelog entry line, **before** the GitHub issue/PR references.
|
||||||
|
|
||||||
|
The attribution should reference the **PR author**, not the issue author.
|
||||||
|
The `prs` subcommand includes the `author` field — use that:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python3 tools/gh.py prs <PR_NUMBER> | python3 -c "import sys,json; print(json.load(sys.stdin)[0]['author'])"
|
||||||
|
```
|
||||||
|
|
||||||
|
Placement in the entry line:
|
||||||
|
```markdown
|
||||||
|
- Fix description of the bug (by @username) [#<ISSUE>](...) (PR: [#<PR>](...))
|
||||||
|
```
|
||||||
|
|
||||||
|
**Only closed issues are included.** An issue must have `state: "closed"` to
|
||||||
|
appear in the changelog. Open/unresolved issues are omitted, even if they are
|
||||||
|
tracked in the milestone.
|
||||||
|
|
||||||
|
**Pairing rules:**
|
||||||
|
|
||||||
|
| Pattern | Changelog format |
|
||||||
|
|---------|-----------------|
|
||||||
|
| Closed issue + one or more PRs fix it | Primary link = issue, PR inline comma-separated |
|
||||||
|
| PR exists with no linked issue | If a corresponding closed issue exists in the same milestone, link the issue. Otherwise, skip the entry (the issue must be the changelog unit). |
|
||||||
|
| Closed issue with no fix PR in milestone | Link the issue directly, without a PR reference. |
|
||||||
|
|
||||||
|
> **False-positive associations:** A PR may incorrectly claim to close an issue
|
||||||
|
> from a different context (e.g., a very old PR referencing a modern issue, or a
|
||||||
|
> cross-project reference). If the PR title and issue title are clearly unrelated,
|
||||||
|
> or the PR was created years before the issue, treat it as a data glitch and
|
||||||
|
> skip it. PR [#3](https://github.com/penpot/penpot/pull/3) (ancient License PR
|
||||||
|
> claiming to close a plugin API issue) is a known example.
|
||||||
|
|
||||||
|
### 5a. ⚠️ Verify PR merge status before writing
|
||||||
|
|
||||||
|
A closed issue may list closing PRs that were **closed without merging**
|
||||||
|
(e.g., a community PR that was superseded by another). The changelog must
|
||||||
|
only reference **merged** PRs. Verify before writing:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# Collect all PR numbers from the candidate entries and check them
|
||||||
|
python3 tools/gh.py prs <ALL_PR_NUMBERS> | python3 -c "
|
||||||
|
import json, sys
|
||||||
|
for pr in json.load(sys.stdin):
|
||||||
|
if pr['state'] != 'MERGED':
|
||||||
|
print(f'WARNING: #{pr[\"number\"]} is {pr[\"state\"]} (not merged)')
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
If a closing PR is closed-unmerged, find the actual merged PR that
|
||||||
|
superseded it:
|
||||||
|
1. Check the issue's closing PRs list for other PRs (there may be multiple)
|
||||||
|
2. Look for other PRs with similar titles or descriptions referencing the same issue
|
||||||
|
3. Inspect the closed PR's conversation timeline for a pointer to the replacement
|
||||||
|
|
||||||
|
Replace the reference in the changelog entry with the correct merged PR number.
|
||||||
|
|
||||||
|
### 6. Read the current CHANGES.md
|
||||||
|
|
||||||
|
Read the top of `CHANGES.md` to understand the existing format and find the
|
||||||
|
insertion point (newest version goes at the top, after the `# CHANGELOG`
|
||||||
|
header).
|
||||||
|
|
||||||
|
Key format rules from the existing file:
|
||||||
|
|
||||||
|
```markdown
|
||||||
|
## <VERSION>
|
||||||
|
|
||||||
|
### :bug: Bugs fixed
|
||||||
|
|
||||||
|
- Fix description of the bug [#<ISSUE>](https://github.com/penpot/penpot/issues/<ISSUE>) (PR: [#<PR>](https://github.com/penpot/penpot/pull/<PR>))
|
||||||
|
- Fix another bug (by @contributor) [#<ISSUE>](https://github.com/penpot/penpot/issues/<ISSUE>) (PR: [#<PR>](https://github.com/penpot/penpot/pull/<PR>))
|
||||||
|
|
||||||
|
### :sparkles: New features & Enhancements
|
||||||
|
|
||||||
|
- Add new feature description [#<ISSUE>](https://github.com/penpot/penpot/issues/<ISSUE>) (PR: [#<PR>](https://github.com/penpot/penpot/pull/<PR>))
|
||||||
|
```
|
||||||
|
|
||||||
|
Format details:
|
||||||
|
- Entries start with `- ` followed by a short description in imperative mood
|
||||||
|
- Primary link is **always the issue** (user-facing artifact)
|
||||||
|
- PR references are inline on the same line: `(PR: [#<N>](<url>))`
|
||||||
|
If an issue has multiple fix PRs, they are comma-separated:
|
||||||
|
`(PR: [#<N>](<url>), [#<M>](<url>))`
|
||||||
|
- The description should describe the fix/feature from the user's perspective
|
||||||
|
- Community contributions get `(by @<username>)` **before** the issue link
|
||||||
|
- Sections are separated by a blank line between the last entry and the next
|
||||||
|
section title
|
||||||
|
- Only include a section if there are entries for it
|
||||||
|
- When an entry already exists in an earlier version section, it must be removed
|
||||||
|
from the current version to avoid duplicates
|
||||||
|
|
||||||
|
### 7. Build the description text
|
||||||
|
|
||||||
|
Derive the description from the issue title, not the PR title. Strip leading
|
||||||
|
emoji prefixes (`:bug:`, `:sparkles:`, `:tada:`) and focus on the
|
||||||
|
user-facing behavior.
|
||||||
|
|
||||||
|
Examples:
|
||||||
|
|
||||||
|
| Issue title | Changelog description |
|
||||||
|
|-------------|----------------------|
|
||||||
|
| `Plugin API token methods fail with schema validation error on PRO` | `Fix Plugin API token methods failing with schema validation error on PRO` |
|
||||||
|
| `Comment content is not sanitized before rendering, enabling stored XSS` | `Sanitize comment content on rendering` |
|
||||||
|
| `Custom uploaded font family names are not sanitized` | `Sanitize font family names on custom uploaded fonts` |
|
||||||
|
|
||||||
|
### 8. Insert the section into CHANGES.md
|
||||||
|
|
||||||
|
Insert the new version section right after the `# CHANGELOG` header (before
|
||||||
|
the previous version entry). Use the `edit` tool with enough context to make
|
||||||
|
a unique match.
|
||||||
|
|
||||||
|
### 9. Verify
|
||||||
|
|
||||||
|
Read the top of `CHANGES.md` and confirm:
|
||||||
|
- The version header is correct
|
||||||
|
- Every entry has a GitHub link
|
||||||
|
- Entries with a fix PR have the PR sub-line
|
||||||
|
- The section ordering is correct (newest first)
|
||||||
|
- Formatting matches the surrounding entries
|
||||||
|
|
||||||
|
### 10. Cross-reference milestone PRs against the changelog
|
||||||
|
|
||||||
|
Issues can be fixed by PRs that aren't in the milestone, and merged PRs in
|
||||||
|
the milestone may not close any tracked issue. After writing, run a full
|
||||||
|
cross-reference to catch gaps:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# List all merged PRs in the milestone
|
||||||
|
python3 tools/gh.py prs --milestone "<MILESTONE>" --state merged > /tmp/milestone-prs.json
|
||||||
|
|
||||||
|
# Extract PR numbers from the changelog section
|
||||||
|
python3 -c "
|
||||||
|
import json, re
|
||||||
|
|
||||||
|
with open('CHANGES.md') as f:
|
||||||
|
content = f.read()
|
||||||
|
|
||||||
|
# Extract the version section (adjust regex to match the actual version)
|
||||||
|
match = re.search(r'## <MILESTONE> \(Unreleased\)\n(.*?)(?:\n## |\Z)', content, re.DOTALL)
|
||||||
|
section = match.group(1)
|
||||||
|
|
||||||
|
# Collect all PR numbers referenced
|
||||||
|
changelog_prs = set()
|
||||||
|
for m in re.findall(r'\[#(\d+)\]\(https://github\.com/penpot/penpot/pull/\d+\)', section):
|
||||||
|
changelog_prs.add(int(m))
|
||||||
|
|
||||||
|
# Collect all milestone PRs (filtered)
|
||||||
|
with open('/tmp/milestone-prs.json') as f:
|
||||||
|
milestone_prs = json.load(f)
|
||||||
|
|
||||||
|
milestone_merged = {pr['number'] for pr in milestone_prs}
|
||||||
|
|
||||||
|
# PRs in milestone but not in changelog
|
||||||
|
missing = sorted(milestone_merged - changelog_prs)
|
||||||
|
print(f'Milestone merged PRs: {len(milestone_merged)}')
|
||||||
|
print(f'Changelog referenced PRs: {len(changelog_prs)}')
|
||||||
|
print(f'PRs in milestone but NOT in changelog: {len(missing)}')
|
||||||
|
for num in missing:
|
||||||
|
pr = next(p for p in milestone_prs if p['number'] == num)
|
||||||
|
print(f' #{num} {pr[\"title\"][:80]}')
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
For each missing PR found, decide whether it should be added to the
|
||||||
|
changelog or is legitimately excluded (check its labels).
|
||||||
|
|
||||||
|
Also verify that no closed-unmerged PRs remain in the changelog:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python3 tools/gh.py prs --milestone "<MILESTONE>" --state all | python3 -c "
|
||||||
|
import json, sys
|
||||||
|
data = json.load(sys.stdin)
|
||||||
|
closed = [p for p in data if p['state'] == 'CLOSED']
|
||||||
|
if closed:
|
||||||
|
print('WARNING: CLOSED (unmerged) PRs in milestone:')
|
||||||
|
for p in closed:
|
||||||
|
print(f' #{p[\"number\"]} {p[\"title\"][:80]}')
|
||||||
|
"
|
||||||
|
```
|
||||||
|
|
||||||
|
**Post-edit audit checklist:**
|
||||||
|
- ✅ All referenced PRs are merged (no closed-unmerged artifacts)
|
||||||
|
- ✅ Every merged milestone PR is either in the changelog or excluded by label
|
||||||
|
- ✅ PR and issue counts are internally consistent
|
||||||
|
- ✅ No false-positive PR-to-issue associations
|
||||||
|
|
||||||
|
## Version section template
|
||||||
|
|
||||||
|
```markdown
|
||||||
|
## <VERSION>
|
||||||
|
|
||||||
|
### :bug: Bugs fixed
|
||||||
|
|
||||||
|
- <fix description> [#<ISSUE>](https://github.com/penpot/penpot/issues/<ISSUE>) (PR: [#<PR>](https://github.com/penpot/penpot/pull/<PR>))
|
||||||
|
- <fix description> (by @contributor) [#<ISSUE>](https://github.com/penpot/penpot/issues/<ISSUE>) (PR: [#<PR>](https://github.com/penpot/penpot/pull/<PR>))
|
||||||
|
```
|
||||||
|
|
||||||
|
### 11. Generate anomaly report and save to CHANGES-ISSUES.md
|
||||||
|
|
||||||
|
After all edits and cross-referencing are complete, generate a structured
|
||||||
|
anomaly report and save it to `CHANGES-ISSUES.md` (overwriting if exists).
|
||||||
|
This provides a persistent record of any discrepancies between the milestone
|
||||||
|
and the changelog.
|
||||||
|
|
||||||
|
Run this self-contained script:
|
||||||
|
|
||||||
|
```bash
|
||||||
|
python3 << 'PYEOF'
|
||||||
|
import json, re, subprocess, sys
|
||||||
|
|
||||||
|
MILESTONE = "<MILESTONE>"
|
||||||
|
CHANGES_MD = "CHANGES.md"
|
||||||
|
OUTPUT = "CHANGES-ISSUES.md"
|
||||||
|
|
||||||
|
# Fetch milestone issues (all states)
|
||||||
|
result = subprocess.run(
|
||||||
|
["python3", "tools/gh.py", "issues", MILESTONE, "--state", "all"],
|
||||||
|
capture_output=True, text=True)
|
||||||
|
all_issues = json.loads(result.stdout)
|
||||||
|
issue_by_num = {i['number']: i for i in all_issues}
|
||||||
|
|
||||||
|
# Fetch milestone PRs (all states)
|
||||||
|
result = subprocess.run(
|
||||||
|
["python3", "tools/gh.py", "prs", "--milestone", MILESTONE, "--state", "all"],
|
||||||
|
capture_output=True, text=True)
|
||||||
|
all_prs = json.loads(result.stdout)
|
||||||
|
pr_by_num = {p['number']: p for p in all_prs}
|
||||||
|
|
||||||
|
# Read changelog
|
||||||
|
with open(CHANGES_MD) as f:
|
||||||
|
content = f.read()
|
||||||
|
|
||||||
|
m = re.search(rf'## {MILESTONE} \(Unreleased\)\n(.*?)(?:\n## |\Z)', content, re.DOTALL)
|
||||||
|
section = m.group(1) if m else ""
|
||||||
|
|
||||||
|
# Collect issue and PR references from the changelog section
|
||||||
|
changelog_issues = set()
|
||||||
|
for num in re.findall(r'\[#(\d+)\]\(https://github\.com/penpot/penpot/issues/\d+\)', section):
|
||||||
|
changelog_issues.add(int(num))
|
||||||
|
for num in re.findall(r'\[Github #(\d+)\]', section):
|
||||||
|
changelog_issues.add(int(num))
|
||||||
|
|
||||||
|
changelog_prs = set()
|
||||||
|
for num in re.findall(r'\[#(\d+)\]\(https://github\.com/penpot/penpot/pull/\d+\)', section):
|
||||||
|
changelog_prs.add(int(num))
|
||||||
|
for num in re.findall(r'PR:\[(\d+)\]', section):
|
||||||
|
changelog_prs.add(int(num))
|
||||||
|
|
||||||
|
# Determine valid (non-excluded) milestone issues
|
||||||
|
EXCLUDED_LABELS = {'release blocker', 'no changelog'}
|
||||||
|
EXCLUDED_ISSUE_TYPES = {'Task'}
|
||||||
|
EXCLUDED_PROJECT_STATUS = {'Rejected'}
|
||||||
|
|
||||||
|
valid_issues = []
|
||||||
|
for issue in all_issues:
|
||||||
|
labels = set(issue.get('labels', []))
|
||||||
|
if issue.get('state') != 'CLOSED': continue
|
||||||
|
if issue.get('issue_type') in EXCLUDED_ISSUE_TYPES: continue
|
||||||
|
if issue.get('project_status') in EXCLUDED_PROJECT_STATUS: continue
|
||||||
|
if EXCLUDED_LABELS & labels: continue
|
||||||
|
valid_issues.append(issue)
|
||||||
|
valid_nums = {i['number'] for i in valid_issues}
|
||||||
|
|
||||||
|
# --- Gather anomalies ---
|
||||||
|
anomalies = []
|
||||||
|
|
||||||
|
# Type 1: Entries in changelog that should be excluded
|
||||||
|
for num in sorted(changelog_issues):
|
||||||
|
issue = issue_by_num.get(num)
|
||||||
|
if issue is None:
|
||||||
|
anomalies.append({
|
||||||
|
'type': 'should_remove',
|
||||||
|
'severity': 'HIGH',
|
||||||
|
'number': num,
|
||||||
|
'title': '',
|
||||||
|
'reason': 'Issue not found in milestone (deleted or moved)'
|
||||||
|
})
|
||||||
|
continue
|
||||||
|
labels = set(issue.get('labels', []))
|
||||||
|
reasons = []
|
||||||
|
if issue.get('state') != 'CLOSED':
|
||||||
|
reasons.append(f'state is "{issue["state"]}" (should be CLOSED)')
|
||||||
|
if 'release blocker' in labels:
|
||||||
|
reasons.append('has "release blocker" label')
|
||||||
|
if 'no changelog' in labels:
|
||||||
|
reasons.append('has "no changelog" label')
|
||||||
|
if issue.get('issue_type') == 'Task':
|
||||||
|
reasons.append(f'issue_type is Task (internal chore)')
|
||||||
|
if issue.get('project_status') == 'Rejected':
|
||||||
|
reasons.append('project_status is Rejected')
|
||||||
|
if reasons:
|
||||||
|
anomalies.append({
|
||||||
|
'type': 'should_remove',
|
||||||
|
'severity': 'MEDIUM' if issue.get('issue_type') == 'Task' else 'HIGH',
|
||||||
|
'number': num,
|
||||||
|
'title': issue.get('title', '')[:80],
|
||||||
|
'reason': '; '.join(reasons)
|
||||||
|
})
|
||||||
|
|
||||||
|
# Type 2: Valid issues not in changelog
|
||||||
|
for num in sorted(valid_nums - changelog_issues):
|
||||||
|
issue = issue_by_num[num]
|
||||||
|
info = {
|
||||||
|
'type': 'missing',
|
||||||
|
'severity': 'MEDIUM',
|
||||||
|
'number': num,
|
||||||
|
'title': issue['title'][:80],
|
||||||
|
'issue_type': issue['issue_type'],
|
||||||
|
'closing_prs': issue.get('closing_prs', []),
|
||||||
|
'note': ''
|
||||||
|
}
|
||||||
|
# Check for duplicate (same PR as existing entry)
|
||||||
|
existing = []
|
||||||
|
for pr_num in issue.get('closing_prs', []):
|
||||||
|
for cl_num in changelog_issues:
|
||||||
|
cl_issue = issue_by_num.get(cl_num)
|
||||||
|
if cl_issue and pr_num in cl_issue.get('closing_prs', []):
|
||||||
|
existing.append(f'#{cl_num}')
|
||||||
|
if existing:
|
||||||
|
info['note'] = f'DUPLICATE: same PR as existing entry(ies): {", ".join(existing)}'
|
||||||
|
# Check closing PRs not merged
|
||||||
|
unmerged = []
|
||||||
|
for pr_num in issue.get('closing_prs', []):
|
||||||
|
pr = pr_by_num.get(pr_num)
|
||||||
|
if pr is None:
|
||||||
|
unmerged.append(f'#{pr_num} (unknown)')
|
||||||
|
elif pr.get('state') != 'MERGED':
|
||||||
|
unmerged.append(f'#{pr_num} (state={pr["state"]})')
|
||||||
|
if unmerged:
|
||||||
|
info['note'] = (info['note'] + '; ' if info['note'] else '') + f'Closing PRs not merged: {", ".join(unmerged)}'
|
||||||
|
anomalies.append(info)
|
||||||
|
|
||||||
|
# Type 3: PRs in changelog that are not merged
|
||||||
|
for pr_num in sorted(changelog_prs):
|
||||||
|
pr = pr_by_num.get(pr_num)
|
||||||
|
if pr is None:
|
||||||
|
anomalies.append({
|
||||||
|
'type': 'unmerged_pr',
|
||||||
|
'severity': 'HIGH',
|
||||||
|
'number': pr_num,
|
||||||
|
'title': '',
|
||||||
|
'reason': 'PR not found in milestone PR list'
|
||||||
|
})
|
||||||
|
elif pr.get('state') != 'MERGED':
|
||||||
|
anomalies.append({
|
||||||
|
'type': 'unmerged_pr',
|
||||||
|
'severity': 'HIGH',
|
||||||
|
'number': pr_num,
|
||||||
|
'title': pr.get('title', '')[:80],
|
||||||
|
'reason': f'state={pr["state"]} (should be MERGED)'
|
||||||
|
})
|
||||||
|
|
||||||
|
# --- Write report to CHANGES-ISSUES.md ---
|
||||||
|
with open(OUTPUT, 'w') as f:
|
||||||
|
f.write(f'# Changelog Anomaly Report — {MILESTONE}\n\n')
|
||||||
|
f.write(f'Generated: {__import__("datetime").datetime.now().strftime("%Y-%m-%d %H:%M UTC")}\n\n')
|
||||||
|
f.write('---\n\n')
|
||||||
|
|
||||||
|
# Summary
|
||||||
|
n_remove = sum(1 for a in anomalies if a['type'] == 'should_remove')
|
||||||
|
n_missing = sum(1 for a in anomalies if a['type'] == 'missing')
|
||||||
|
n_pr = sum(1 for a in anomalies if a['type'] == 'unmerged_pr')
|
||||||
|
f.write(f'## Summary\n\n')
|
||||||
|
f.write(f'- **Issues to remove from changelog:** {n_remove}\n')
|
||||||
|
f.write(f'- **Valid issues missing from changelog:** {n_missing}\n')
|
||||||
|
f.write(f'- **Unmerged PRs referenced:** {n_pr}\n')
|
||||||
|
f.write(f'- **Total anomalies:** {len(anomalies)}\n\n')
|
||||||
|
|
||||||
|
if not anomalies:
|
||||||
|
f.write('✅ No anomalies found. The changelog is fully consistent with the milestone.\n\n')
|
||||||
|
else:
|
||||||
|
# Type 1
|
||||||
|
if n_remove:
|
||||||
|
f.write(f'## Issues to Remove\n\n')
|
||||||
|
f.write('These entries are in the changelog but should be excluded based on current issue metadata.\n\n')
|
||||||
|
for a in anomalies:
|
||||||
|
if a['type'] != 'should_remove': continue
|
||||||
|
badge = '🔴' if a['severity'] == 'HIGH' else '🟡'
|
||||||
|
f.write(f'{badge} **#{a["number"]}**')
|
||||||
|
if a.get('title'): f.write(f' — {a["title"]}')
|
||||||
|
f.write(f'\n - Reason: {a["reason"]}\n\n')
|
||||||
|
|
||||||
|
# Type 2
|
||||||
|
if n_missing:
|
||||||
|
f.write(f'## Valid Issues Not in Changelog\n\n')
|
||||||
|
f.write('These issues are closed, non-excluded milestone items that lack a changelog entry.\n\n')
|
||||||
|
for a in anomalies:
|
||||||
|
if a['type'] != 'missing': continue
|
||||||
|
f.write(f'❓ **#{a["number"]}** — {a["title"]}\n')
|
||||||
|
f.write(f' - Type: {a["issue_type"]}, Closing PRs: {a["closing_prs"]}\n')
|
||||||
|
if a.get('note'): f.write(f' - Note: {a["note"]}\n')
|
||||||
|
f.write('\n')
|
||||||
|
|
||||||
|
# Type 3
|
||||||
|
if n_pr:
|
||||||
|
f.write(f'## Unmerged PRs Referenced in Changelog\n\n')
|
||||||
|
f.write('These PR numbers appear in the changelog but are not merged.\n\n')
|
||||||
|
for a in anomalies:
|
||||||
|
if a['type'] != 'unmerged_pr': continue
|
||||||
|
f.write(f'🔴 **#{a["number"]}**')
|
||||||
|
if a.get('title'): f.write(f' — {a["title"]}')
|
||||||
|
f.write(f'\n - {a["reason"]}\n\n')
|
||||||
|
|
||||||
|
# Appendix: counts
|
||||||
|
f.write('---\n\n')
|
||||||
|
f.write(f'## Context\n\n')
|
||||||
|
f.write(f'- Milestone total issues (all states): {len(all_issues)}\n')
|
||||||
|
f.write(f'- Valid issues after exclusions: {len(valid_issues)}\n')
|
||||||
|
f.write(f'- Issues referenced in changelog: {len(changelog_issues)}\n')
|
||||||
|
f.write(f'- PRs referenced in changelog: {len(changelog_prs)}\n')
|
||||||
|
|
||||||
|
print(f"Anomaly report written to {OUTPUT}")
|
||||||
|
PYEOF
|
||||||
|
```
|
||||||
|
|
||||||
|
This generates `CHANGES-ISSUES.md` with three sections:
|
||||||
|
1. **Issues to Remove** — Entries in the changelog that should be excluded based
|
||||||
|
on current issue metadata (labels, type, project status, or deletion).
|
||||||
|
2. **Valid Issues Not in Changelog** — Closed, non-excluded milestone issues
|
||||||
|
that lack a changelog entry (with notes on duplicates and unmerged closing PRs).
|
||||||
|
3. **Unmerged PRs Referenced** — PRs in the changelog that are not merged.
|
||||||
|
|
||||||
|
The report is overwritten each time it's generated, reflecting the current
|
||||||
|
state of the milestone and changelog.
|
||||||
|
|
||||||
|
## Key Principles
|
||||||
|
|
||||||
|
- **Issue = changelog unit.** The primary link always points to the
|
||||||
|
user-facing issue, not the implementation PR.
|
||||||
|
- **PR = implementation detail.** Reference the PR inline so readers
|
||||||
|
can find the code changes.
|
||||||
|
- **Latest version first.** New sections are inserted at the top of the
|
||||||
|
changelog, below the `# CHANGELOG` header.
|
||||||
|
- **Issue Type determines section — exclusively.** Use the `issue_type` field from `gh.py` output (Bug → `:bug:`, Feature/Enhancement → `:sparkles:`). **Do not** use labels (`bug`, `enhancement`) or title emoji prefixes (`:bug:`, `:sparkles:`) — they are frequently wrong or contradictory. The `issue_type` is the single source of truth.
|
||||||
|
- **User-facing descriptions.** Write from the user's perspective — describe
|
||||||
|
what broke and what was fixed, not internal implementation details.
|
||||||
|
- **Community attribution.** When the issue or fix PR has the
|
||||||
|
`community contribution` label, add `(by @<username>)` on the entry line
|
||||||
|
between the description and the issue link. Use the **PR author** (not the
|
||||||
|
issue author) for the attribution.
|
||||||
|
- **Only closed issues.** An issue must have `state: "closed"` to appear in
|
||||||
|
the changelog. Open/unresolved issues are omitted.
|
||||||
|
- **Rejected project status.** Issues marked as "Rejected" in the "Main"
|
||||||
|
project board are automatically excluded by `gh.py`, even if they are
|
||||||
|
closed. The project status is distinct from the GitHub issue state.
|
||||||
|
Use `--include-rejected` to override this behavior.
|
||||||
|
- **Excluded issues.** Issues with `no changelog` label must be excluded.
|
||||||
|
Issues with `issue_type: "Task"` must also be excluded — they are internal
|
||||||
|
chores, not user-facing changes.
|
||||||
|
- **Multiple PRs per issue.** If multiple PRs fix the same issue, list them
|
||||||
|
comma-separated inline: `(PR: [#A](url), [#B](url))`.
|
||||||
|
- **Duplicate removal.** If an entry already exists in a prior version section,
|
||||||
|
remove it from the current version. Check for text-level duplicates (after
|
||||||
|
stripping links and attributions) across version sections.
|
||||||
|
- **Taiga references.** If a changelog entry references a Taiga URL
|
||||||
|
(`tree.taiga.io`), attempt to find a corresponding GitHub issue via the
|
||||||
|
Taiga description text or by searching GitHub PRs that reference the Taiga
|
||||||
|
URL. Replace the Taiga reference with the GitHub issue link and add the PR
|
||||||
|
reference if applicable.
|
||||||
|
- **Re-fetch before editing.** Milestones can change — always re-fetch issues
|
||||||
|
before making edits, don't rely on cached data.
|
||||||
|
- **Use `tools/gh.py`.** Prefer the helper script over raw `gh api` calls for
|
||||||
|
milestone issue listing and PR detail fetching. It handles GraphQL
|
||||||
|
pagination, batching, and label filtering automatically.
|
||||||
|
- **Verify PR merge status.** Not all closing PRs are merged — community PRs
|
||||||
|
can be superseded and closed without merging. Always check that every PR
|
||||||
|
referenced in the changelog has `state: MERGED`.
|
||||||
|
- **PR-level exclusions apply.** A PR can carry its own exclusion labels
|
||||||
|
(`release blocker`, `no issue required`) independent of its linked issue's
|
||||||
|
labels. Check both.
|
||||||
|
- **Cross-reference milestone PRs, not just issues.** The `--compare` flag on
|
||||||
|
the `issues` command only compares issue numbers. Merged PRs not linked to
|
||||||
|
any milestone issue can be missed. Use `python3 tools/gh.py prs --milestone`
|
||||||
|
for a full PR cross-reference.
|
||||||
|
- **False-positive PR-to-issue associations.** A PR may claim to close an
|
||||||
|
issue from a different project or context. If the PR title and issue title
|
||||||
|
are clearly unrelated, or the PR predates the issue by years, treat it as a
|
||||||
|
data glitch and skip it.
|
||||||
@ -1,32 +0,0 @@
|
|||||||
import assert from "node:assert/strict"
|
|
||||||
import test from "node:test"
|
|
||||||
|
|
||||||
import plugin from "../plugins/penpot.js"
|
|
||||||
|
|
||||||
test("exports only the OpenCode V2 plugin contract", () => {
|
|
||||||
assert.equal(plugin.id, "penpot")
|
|
||||||
assert.equal("server" in plugin, false)
|
|
||||||
})
|
|
||||||
|
|
||||||
test("registers the Penpot tools during setup", async () => {
|
|
||||||
const tools = []
|
|
||||||
const context = {
|
|
||||||
location: { directory: "/tmp/opencode/penpot-plugin-test" },
|
|
||||||
tool: {
|
|
||||||
async transform(apply) {
|
|
||||||
apply({
|
|
||||||
add(tool) {
|
|
||||||
tools.push(tool)
|
|
||||||
},
|
|
||||||
})
|
|
||||||
},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
await plugin.setup(context)
|
|
||||||
|
|
||||||
assert.deepEqual(
|
|
||||||
tools.map((tool) => tool.name).sort(),
|
|
||||||
["paren-repair", "penpot-psql"],
|
|
||||||
)
|
|
||||||
})
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user