Skills von blackbook: software-development/gitea-repo-management
This commit is contained in:
@@ -0,0 +1,25 @@
|
||||
---
|
||||
name: gitea-repo-management
|
||||
description: Use when accessing or splitting gitea.mindboost.team repos.
|
||||
---
|
||||
|
||||
# Gitea (gitea.mindboost.team) repo work
|
||||
|
||||
## Access: find the working account first
|
||||
- A browser URL returning 404 usually means "no access", not "missing". Check `~/.git-credentials` (never print the secret; mask with sed) for the gitea accounts.
|
||||
- Test each account against `GET /api/v1/user` and `GET /api/v1/repos/<owner>/<repo>`. Different accounts see different repos; the first stored account is NOT necessarily the one with access. Git's credential helper picks the first match for the host, so clone with the working user embedded (`https://USER:PW@host/...`) and then `git remote set-url origin` to the clean URL so no password lands in `.git/config`.
|
||||
- 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.
|
||||
|
||||
## 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.
|
||||
|
||||
## Restructuring a freshly split repo
|
||||
- Move files with `git mv` in one commit so history follows. Then rewrite path literals in tests, deploy registry and CI triggers, and run the whole test set; tests that lived outside the CI runner may fail silently otherwise.
|
||||
- A deploy script that maps registry entries to files needs a path-aware prefix check (use basename). Auto-deploy triggers must match the new folder glob.
|
||||
- Add a docs check (every workflow named in project-map and workflow doc, no dead links) and prove it with a negative test.
|
||||
- Do not move shared snapshots (copies of other repos' workflows) into the deploy folder.
|
||||
|
||||
## 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.
|
||||
- Write results in German; report what was verified (tests run) and what is still open.
|
||||
@@ -0,0 +1,14 @@
|
||||
# Splitting a workflow cluster out of a monorepo (n8n JSON repos)
|
||||
|
||||
1. **Map the cluster.** Load every `*.json` export, collect `executeWorkflow` nodes (target id/name) and webhook paths, then search the other exports for the cluster's ids/names to find callers. Read the repo's workflow index/catalog and `deploy/workflows.json` (file -> n8n id).
|
||||
2. **Find hidden file dependencies.** grep the tests/scripts for `readFileSync`/`loadWorkflow` string literals. Tests often load shared gateway exports (e.g. KAN, KNOW) and even unrelated config files (e.g. a LiteLLM config). Those cannot stay behind or the tests fail.
|
||||
3. **Ask scope questions before touching anything**: shared dependencies (stay + document vs. copy), what happens to the original (default: later separate PR), keep history, repo name and visibility. If a question is skipped, take the recommended default and say so.
|
||||
4. **Extract with history**: `pip3 install --user git-filter-repo` (binary lands in `~/Library/Python/<ver>/bin` on macOS; add to PATH). Work in `git clone --no-local --single-branch --branch main <local clone>`. Use `--path` for exact files (umlaut names work) and `--path-regex` for test/doc families. Do not filter in the original clone.
|
||||
5. **Make it standalone**:
|
||||
- Put read-only snapshots of shared exports in `external/` (NOT the repo root: auto-deploy actions deploy root `*.json`). Rewrite the test path literals to `external/...`, add a README there with the source commit SHA and a sync script.
|
||||
- Reduce `deploy/workflows.json` to the cluster, keep the n8n ids unchanged (the workflows keep running in n8n; only the source changes).
|
||||
- Copy deploy script + its tests, CI workflows, and a test runner script. Legacy exports go to `legacy/`.
|
||||
- Exclude CLI-style tests that need arguments/network from the runner.
|
||||
- Write README, AGENTS.md and a dependencies doc (callers, callees, ids, webhook paths, env). Verify every claim in it against the JSON (a note mentioning a workflow is not a call).
|
||||
6. **Verify**: run `node scripts/n8n-workflows.mjs validate` and all tests; compare any failing test with the original repo before blaming the move.
|
||||
7. **Pitfalls**: while both repos hold the same export, only one may auto-deploy or they overwrite each other in n8n; new repo needs its own `N8N_BASE_URL`/`N8N_API_KEY` secrets; move the finished repo out of the scratch dir (pruned after 24h).
|
||||
Reference in New Issue
Block a user