diff --git a/skills/software-development/gitea-repo-management/SKILL.md b/skills/software-development/gitea-repo-management/SKILL.md index 6ac5539..e98ffb2 100644 --- a/skills/software-development/gitea-repo-management/SKILL.md +++ b/skills/software-development/gitea-repo-management/SKILL.md @@ -1,6 +1,6 @@ --- name: gitea-repo-management -description: Use when accessing or splitting gitea.mindboost.team repos. +description: Use for gitea.mindboost.team repos, PRs and n8n layout. --- # Gitea (gitea.mindboost.team) repo work @@ -11,6 +11,11 @@ description: Use when accessing or splitting gitea.mindboost.team repos. - SSH (`git@gitea.mindboost.team`) may be denied for the default key; the per-purpose aliases in `~/.ssh/config` (gitea-*, port 222) are deploy keys scoped to single repos. HTTPS with the working account is the general path. - Token scopes limit actions: creating a repo inside an org needs `write:organization`; `write:repository` alone returns 403. Do not work around it (personal repo + transfer). Prepare everything locally and ask the user to create the empty repo or supply a token with the scope. +## Pushing, PRs and CI via the API +- Push with the working user embedded in the URL (`https://USER:PW@host/...`), mask the password in output with sed, and keep the stored remote URL clean. Put restructuring work on a `feature/...` branch and open a PR via `POST /api/v1/repos///pulls` (Basic auth with the same account) instead of pushing to main. +- Check CI with `GET .../actions/runs?limit=N` (fields: `path`, `event`, `conclusion`) and `.../actions/runs//jobs`; secrets list is `.../actions/secrets`. The first push to main of a repo with an auto-deploy action runs it: without `N8N_*` secrets it fails harmlessly, but once secrets exist it deploys, so warn the user while another repo still deploys the same workflow ids. +- `empty: true` in the repo API can be stale right after the first push; compare `git rev-parse HEAD` with the fetched remote head instead. + ## Splitting part of a repo into a new repo (keeping history) Recipe and checks: `references/repo-split.md`. Short form: dependency analysis first, ask scope questions, `git filter-repo` on a throwaway single-branch clone, fix cross-repo paths, run the tests, only then create and push. @@ -21,9 +26,11 @@ Recipe and checks: `references/repo-split.md`. Short form: dependency analysis f - Do not move shared snapshots (copies of other repos' workflows) into the deploy folder. ## n8n workflow exports: readable layout -- Generate node positions and phase boxes from a spec file (phases with purpose, reason, node list) instead of moving nodes by hand; the tool must change only positions and sticky notes. Prove it by diffing every node (minus position) and the connections against the previous commit. -- Make unassigned nodes a hard error so new nodes force a documented phase, and add a test that fails on layout drift, overlap and nodes outside their box. -- Write box texts from the code, not the node names: read the code of ambiguous nodes first. +Depth and recipe: `references/n8n-layout.md`. Always-on rules: +- Never move nodes by hand. Generate positions and phase boxes (Zweck + Warum) from a spec file; the tool changes only positions and sticky notes. Prove it by diffing every node (minus position) and the connections against the previous commit. +- "Readable" includes the edges, not only non-overlapping nodes: measure crossings, backward edges and edges through nodes before and after, and gate them with a budget in a test. Overlap-free alone was rejected by the user. +- Cut phases along the real control flow and put parallel branches in lanes; stacking phases vertically creates long diagonal edges. +- Write box texts from the code, not the node names. ## Conventions for this user - Do destructive or visible steps (removing files from the original repo, pushing, creating repos) only as agreed; default is: build the new repo first, remove from the old one later in a separate PR. diff --git a/skills/software-development/gitea-repo-management/references/n8n-layout.md b/skills/software-development/gitea-repo-management/references/n8n-layout.md new file mode 100644 index 0000000..12ab984 --- /dev/null +++ b/skills/software-development/gitea-repo-management/references/n8n-layout.md @@ -0,0 +1,25 @@ +# Making n8n workflow exports human-readable (layout from a spec) + +Goal the user set: from machine-readable to human-readable. Per workflow: phase boxes with **Zweck** (what) and **Warum** (why this logic exists), no overlapping nodes, few edge crossings. Only positions and sticky notes may change. + +## Setup that worked +- `layouts/.json` per workflow: `workflow` path, `budget` (kreuzungen, rueckwaerts, durchKnoten), `phasen[]` with titel, zweck, warum, knoten (exact names or `re:` patterns, first match wins), optional `spur`/`nach`. +- `scripts/layout-workflow.mjs` computes positions + one sticky note per phase (`Box : `, deterministic ids, regenerated idempotently); other sticky notes (the original overview) move to a column left of the boxes. Unassigned node or empty phase = hard error. +- `tests/test-layout.mjs`: file equals computed layout (no drift), 20-px grid, no node overlap, every node in exactly one box, boxes disjoint, Zweck/Warum present, metrics within `budget`. Prove the negative cases once (drift, budget too low). +- Serialize with `JSON.stringify(wf, null, 2) + "\n"`; check first that a round-trip reproduces the file, otherwise the first run shows a whole-file diff (hand-indented exports). +- Before committing, diff every node (minus `position`), connections and all other top-level keys against the pre-layout commit; only `Box ...` notes may be new. + +## Layout rules that reduced edge crossings (measured, not guessed) +Measure first: crossings (straight segments from output right to input left), backward edges (target x < source x), edges passing through a foreign node. Report before/after numbers. +1. **Cut phases along the real control flow.** Read the connections between phases; a box that is fed backwards means the phase is cut wrong or ordered wrong (e.g. a shared response node belongs in its own sink box at the right end, not in the entry box). +2. **Parallel branches go in lanes** (`spur`, `nach` = box number(s) feeding this box), not one behind the other. Router + alternative branches (GET/POST/PDF, real-run/update) become lanes that converge on a shared sink box. Stacking phases vertically produces long diagonals across everything; side-by-side in flow direction keeps inter-box edges short and forward. +3. **Inside a phase:** longest-path layers, dummy nodes for edges spanning >1 layer (they reserve a channel), barycenter sweeps keeping the best ordering, rows aligned to predecessors. Try two row strategies per phase (A: align to neighbors; B: long edges keep their straight row, nodes in between step aside) and pick by the *whole-workflow* score (crossings + 5*through + 8*backward). Scoring per phase alone misses inter-box edges and made another workflow worse. +4. **Do not wrap a long phase into bands** (return edges cost more than the width); a very wide phase is a hint to split the workflow, not to fix the layout. +5. Row spacing ~200 px, column ~280 px: lets long edges pass between rows. + +## Box texts +Write them from the node code (comments, conditions), not from node names; read ambiguous nodes (`Route ...`, `Restore ...`, `Reject ...`) first. State only what the code supports; mark name-only descriptions as such to the user. + +## Related decisions of this user +- Richtwerte: max ~25 nodes per workflow, max ~150 lines/4 KB per Code node, 20-px grid, no overlapping nodes. HTML pages and mail templates belong in the repo (`templates/`, injected at deploy) rather than in Code nodes; new sub-workflows get new ids and never overwrite existing ones; order of splitting is open (recommend pure-logic phases first). +- A third-party n8n skill set (czlonkowski/n8n-skills, 14 skills, mostly assuming the n8n-mcp server) exists: relevant parts are the "native node before Code node + `Why Code:` note" gate and the sub-workflow guidance (typed inputs, verb-first names). Read-only review first; install only on the user's approval (the catalog install shows an approval card).