@nitra/cursor
Advanced tools
+1
-1
| { | ||
| "name": "@nitra/cursor", | ||
| "version": "11.4.0", | ||
| "version": "11.4.1", | ||
| "description": "CLI для завантаження cursor-правил (префікс n-) у локальний репозиторій", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -68,2 +68,41 @@ /** | ||
| /** | ||
| * Пушить release-коміт (із тегами) у апстрім, переживаючи паралельні push у ту саму гілку. | ||
| * `runGit` — ТИХИЙ раннер (повертає null при помилці), тож non-fast-forward push не кидає, а | ||
| * повертає null; цей хелпер ЯВНО перевіряє результат, щоб реліз не «вдався» без приземленого | ||
| * commit-back (саме така мовчазна поразка лишала npm попереду git). За відмовою push: | ||
| * fetch + rebase release-коміту на свіжий апстрім, пересунути теги на новий HEAD і повторити | ||
| * (до `attempts` разів). Без апстріму або при rebase-конфлікті — кидаємо, а не маскуємо. | ||
| * @param {(args: string[]) => Promise<string | null>} runGit git-раннер | ||
| * @param {string[]} tags теги релізу (вже створені на поточному HEAD) | ||
| * @param {number} [attempts] максимум спроб push | ||
| * @returns {Promise<void>} результат; кидає, якщо push так і не приземлився | ||
| */ | ||
| async function pushReleaseWithRetry(runGit, tags, attempts = 5) { | ||
| for (let attempt = 1; attempt <= attempts; attempt++) { | ||
| const pushed = await runGit(['push', '--follow-tags']) | ||
| if (pushed !== null) return | ||
| if (attempt === attempts) break | ||
| // push відхилено (найімовірніше non-fast-forward — апстрім пішов уперед) → інтегруємо й пробуємо ще | ||
| const upstream = (await runGit(['rev-parse', '--abbrev-ref', '--symbolic-full-name', '@{u}']))?.trim() | ||
| if (!upstream) { | ||
| throw new Error('release: git push відхилено, а upstream для rebase немає — commit-back не приземлився') | ||
| } | ||
| const remote = upstream.includes('/') ? upstream.slice(0, upstream.indexOf('/')) : 'origin' | ||
| await runGit(['fetch', remote]) | ||
| const rebased = await runGit(['rebase', upstream]) | ||
| if (rebased === null) { | ||
| await runGit(['rebase', '--abort']) | ||
| throw new Error(`release: push відхилено і rebase на ${upstream} дав конфлікт — розв'яжи вручну`) | ||
| } | ||
| // після rebase хеш release-коміту змінився → пересуваємо теги на новий HEAD | ||
| for (const tag of tags) { | ||
| await runGit(['tag', '-f', tag]) | ||
| } | ||
| } | ||
| throw new Error( | ||
| `release: git push не вдався після ${attempts} спроб (non-fast-forward?) — commit-back не приземлився, реліз неуспішний` | ||
| ) | ||
| } | ||
| /** | ||
| * @param {object} [opts] опції | ||
@@ -116,3 +155,3 @@ * @param {string} [opts.cwd] корінь | ||
| } | ||
| await runGit(['push', '--follow-tags']) | ||
| await pushReleaseWithRetry(runGit, tags) | ||
| } | ||
@@ -119,0 +158,0 @@ return released |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
AI-detected potential code anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Found 1 instance in 1 package
4583762
0.1%37218
0.1%