@nitra/cursor 1.17.2 → 1.17.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -4,6 +4,21 @@
|
|
|
4
4
|
|
|
5
5
|
Формат — [Keep a Changelog](https://keepachangelog.com/uk/1.1.0/), нумерація — [SemVer](https://semver.org/lang/uk/).
|
|
6
6
|
|
|
7
|
+
## [1.17.3] - 2026-05-24
|
|
8
|
+
|
|
9
|
+
### Added
|
|
10
|
+
|
|
11
|
+
- Концерн `stryker_config` правила `test` тепер ідемпотентно додає у кореневий `.gitignore` патерни Stryker-output-у:
|
|
12
|
+
- `**/reports/stryker/.tmp/` — in-place backup-каталог (з baseline-у `tempDirName`).
|
|
13
|
+
- `**/reports/stryker/mutation.json` — JSON-репорт мутацій.
|
|
14
|
+
- Header-секція `# Stryker mutation testing (test.mdc)`, sectioning через `ensureGitignoreEntries`.
|
|
15
|
+
- Спільний helper `npm/scripts/utils/ensure-gitignore-entries.mjs` — append-only оновлювач `.gitignore` з header-секціями. Idempotent (точне співпадіння рядка після `trim`), створює файл якщо немає, зберігає trailing-newline. 5 unit-тестів.
|
|
16
|
+
|
|
17
|
+
### Changed
|
|
18
|
+
|
|
19
|
+
- `test.mdc` 2.0 → 2.1: додано параграф про gitignore-керування Stryker-output-у в секцію «Налаштування mutation-testing».
|
|
20
|
+
- `stryker_config` concern: додано виклик `ensureGitignoreEntries` після копіювання baseline-ів; репортер видає pass-повідомлення про додані патерни.
|
|
21
|
+
|
|
7
22
|
## [1.17.2] - 2026-05-24
|
|
8
23
|
|
|
9
24
|
### Added
|
package/package.json
CHANGED
|
@@ -17,11 +17,18 @@ import { fileURLToPath } from 'node:url'
|
|
|
17
17
|
|
|
18
18
|
import { createCheckReporter } from '../../../scripts/lib/check-reporter.mjs'
|
|
19
19
|
import { readNCursorConfigLite } from '../../../scripts/lib/read-n-cursor-config-lite.mjs'
|
|
20
|
+
import { ensureGitignoreEntries } from '../../../scripts/utils/ensure-gitignore-entries.mjs'
|
|
20
21
|
import { resolveAllJsRoots } from '../../../scripts/utils/resolve-js-root.mjs'
|
|
21
22
|
|
|
22
23
|
const HERE = dirname(fileURLToPath(import.meta.url))
|
|
23
24
|
const BASELINE_PATH = join(HERE, 'data', 'stryker_config', 'stryker.config.baseline.mjs')
|
|
24
25
|
|
|
26
|
+
// Stryker-output патерни для .gitignore: temp-каталог з backup-файлами
|
|
27
|
+
// (`tempDirName: 'reports/stryker/.tmp'` у baseline) і JSON-репорт мутацій.
|
|
28
|
+
// Канон in-place mode у baseline лишає backup'и у `reports/stryker/.tmp/backup-XXX/`,
|
|
29
|
+
// які НЕ можна комітити. Подвійний-зірочка-префікс покриває всі workspaces.
|
|
30
|
+
const STRYKER_GITIGNORE_ENTRIES = ['**/reports/stryker/.tmp/', '**/reports/stryker/mutation.json']
|
|
31
|
+
|
|
25
32
|
/**
|
|
26
33
|
* @returns {Promise<number>} 0 — OK або silently skipped, 1 — порушення
|
|
27
34
|
*/
|
|
@@ -57,5 +64,12 @@ export async function check() {
|
|
|
57
64
|
await copyFile(BASELINE_PATH, target)
|
|
58
65
|
reporter.pass(`stryker.config.mjs створено з canonical baseline (${relative(cwd, target)}) (test.mdc)`)
|
|
59
66
|
}
|
|
67
|
+
|
|
68
|
+
// Гарантуємо що Stryker temp/output ніколи не комітяться. Patterns
|
|
69
|
+
// покривають усі workspaces через `**/`-префікс (єдиний root .gitignore).
|
|
70
|
+
const { added } = await ensureGitignoreEntries(cwd, STRYKER_GITIGNORE_ENTRIES, 'Stryker mutation testing (test.mdc)')
|
|
71
|
+
if (added.length > 0) {
|
|
72
|
+
reporter.pass(`.gitignore: додано Stryker-патерни (${added.join(', ')}) (test.mdc)`)
|
|
73
|
+
}
|
|
60
74
|
return reporter.getExitCode()
|
|
61
75
|
}
|
package/rules/test/test.mdc
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
description: JS-тести (*.test.mjs) живуть у tests/. Правило `test` керує stryker.config.mjs (якщо js-lint enabled) і .cargo/mutants.toml (якщо rust enabled).
|
|
3
|
-
version: '2.
|
|
3
|
+
version: '2.1'
|
|
4
4
|
globs: "**/{.n-cursor.json,package.json,Cargo.toml,stryker.config.mjs,.cargo/mutants.toml},**/*.test.mjs"
|
|
5
5
|
alwaysApply: false
|
|
6
6
|
---
|
|
@@ -81,3 +81,5 @@ Recursive globs ловлять файли всередині `tests/` так с
|
|
|
81
81
|
Канон cargo-mutants config: [mutants.toml.baseline](./js/data/cargo_mutants_config/mutants.toml.baseline)
|
|
82
82
|
|
|
83
83
|
Customization (mutate patterns, exclude rules, timeout) — відповідальність проєкту-споживача; концерни лише забезпечують наявність файлу як стартового baseline в кожному з виявлених workspace-каталогів.
|
|
84
|
+
|
|
85
|
+
Додатково: коли `js-lint` enabled, концерн `stryker_config` ідемпотентно додає у кореневий `.gitignore` патерни Stryker-output-у — `**/reports/stryker/.tmp/` (in-place backup-каталог з baseline-у) і `**/reports/stryker/mutation.json` (JSON-репорт). Це запобігає випадковому коміту backup-копій вихідного коду та мутаційного звіту як build-артефактів.
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Idempotent append-only оновлювач `.gitignore` у корені проєкту. Перевіряє,
|
|
3
|
+
* чи задані entries уже присутні (точне співпадіння рядка після `trim`); відсутні
|
|
4
|
+
* дописує під header-комент, не порушуючи решту файлу. Якщо `.gitignore` немає —
|
|
5
|
+
* створюється з заданими entries + header.
|
|
6
|
+
*
|
|
7
|
+
* Викликається з test-концерну `stryker_config` (gitignore Stryker temp dirs).
|
|
8
|
+
*/
|
|
9
|
+
import { existsSync } from 'node:fs'
|
|
10
|
+
import { readFile, writeFile } from 'node:fs/promises'
|
|
11
|
+
import { join } from 'node:path'
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @param {string} cwd корінь репо (де знаходиться `.gitignore`)
|
|
15
|
+
* @param {string[]} entries патерни для .gitignore (порядок збережено)
|
|
16
|
+
* @param {string} sectionLabel header-коментар над секцією (без `#`-префікса)
|
|
17
|
+
* @returns {Promise<{added: string[]}>} перелік патернів, що були дописані
|
|
18
|
+
*/
|
|
19
|
+
export async function ensureGitignoreEntries(cwd, entries, sectionLabel) {
|
|
20
|
+
const gitignorePath = join(cwd, '.gitignore')
|
|
21
|
+
const existing = existsSync(gitignorePath) ? await readFile(gitignorePath, 'utf8') : ''
|
|
22
|
+
const existingLines = new Set(existing.split('\n').map(line => line.trim()))
|
|
23
|
+
const missing = entries.filter(entry => !existingLines.has(entry))
|
|
24
|
+
if (missing.length === 0) return { added: [] }
|
|
25
|
+
|
|
26
|
+
const prefix = existing.length === 0 || existing.endsWith('\n') ? '' : '\n'
|
|
27
|
+
const block = `${prefix}\n# ${sectionLabel}\n${missing.join('\n')}\n`
|
|
28
|
+
await writeFile(gitignorePath, existing + block)
|
|
29
|
+
return { added: missing }
|
|
30
|
+
}
|