@nitra/cursor 1.17.0 → 1.17.1

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.
Files changed (46) hide show
  1. package/CHANGELOG.md +6 -0
  2. package/bin/n-cursor.js +16 -16
  3. package/package.json +2 -1
  4. package/rules/abie/fix.mjs +3 -3
  5. package/rules/adr/fix.mjs +3 -3
  6. package/rules/adr/js/hooks.mjs +6 -6
  7. package/rules/bun/fix.mjs +3 -3
  8. package/rules/capacitor/fix.mjs +3 -3
  9. package/rules/changelog/fix.mjs +3 -3
  10. package/rules/changelog/js/consistency.mjs +15 -15
  11. package/rules/ci4/fix.mjs +3 -3
  12. package/rules/docker/fix.mjs +3 -3
  13. package/rules/efes/fix.mjs +3 -3
  14. package/rules/feedback/fix.mjs +3 -3
  15. package/rules/ga/fix.mjs +3 -3
  16. package/rules/graphql/fix.mjs +3 -3
  17. package/rules/hasura/fix.mjs +3 -3
  18. package/rules/image-avif/fix.mjs +3 -3
  19. package/rules/image-compress/fix.mjs +3 -3
  20. package/rules/js-bun-db/fix.mjs +3 -3
  21. package/rules/js-bun-redis/fix.mjs +3 -3
  22. package/rules/js-lint/coverage/coverage.mjs +22 -20
  23. package/rules/js-lint/fix.mjs +3 -3
  24. package/rules/js-mssql/fix.mjs +3 -3
  25. package/rules/js-run/fix.mjs +3 -3
  26. package/rules/k8s/fix.mjs +3 -3
  27. package/rules/nginx-default-tpl/fix.mjs +3 -3
  28. package/rules/npm-module/fix.mjs +3 -3
  29. package/rules/php/fix.mjs +3 -3
  30. package/rules/rego/fix.mjs +3 -3
  31. package/rules/rust/coverage/coverage.mjs +19 -20
  32. package/rules/rust/fix.mjs +3 -3
  33. package/rules/rust/lib/has-cargo-toml.mjs +1 -3
  34. package/rules/security/fix.mjs +3 -3
  35. package/rules/style-lint/fix.mjs +3 -3
  36. package/rules/style-lint/js/tooling.mjs +1 -1
  37. package/rules/tauri/fix.mjs +3 -3
  38. package/rules/test/coverage/coverage.mjs +27 -25
  39. package/rules/test/fix.mjs +3 -3
  40. package/rules/test/js/location.mjs +1 -1
  41. package/rules/text/fix.mjs +3 -3
  42. package/rules/vue/fix.mjs +3 -3
  43. package/scripts/lib/run-rule-cli.mjs +11 -0
  44. package/scripts/lib/run-standard-rule.mjs +1 -1
  45. package/scripts/utils/with-lock.mjs +27 -16
  46. package/scripts/utils/worktree-fingerprint.mjs +10 -7
package/CHANGELOG.md CHANGED
@@ -4,6 +4,12 @@
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.1] - 2026-05-24
8
+
9
+ ### Fixed
10
+
11
+ - **`js-lint/coverage/coverage.mjs` + `rust/coverage/coverage.mjs`** — `Bun.spawn` (runtime-only) замінено на `node:child_process.spawnSync`. CLI `n-cursor` запускається через `#!/usr/bin/env node` shebang, отже Node-runtime — `Bun.*` API недоступні в реальному прогоні (тести використовували ін'єктований runner і не виявляли цього). Тестова ін'єкція runner-а лишається тією самою (контракт `runJsCoverage`/`runStryker`/`runLlvmCov`/`runCargoMutants` mock-ів — без змін).
12
+
7
13
  ## [1.17.0] - 2026-05-24
8
14
 
9
15
  ### Added
package/bin/n-cursor.js CHANGED
@@ -224,6 +224,22 @@ async function migrateLegacyConfigIfNeeded() {
224
224
  }
225
225
  }
226
226
 
227
+ /**
228
+ * Повертає розпарсений package.json з кореня або null, якщо файл відсутній/некоректний.
229
+ * @returns {Promise<unknown | null>} обʼєкт package.json або null
230
+ */
231
+ async function readRootPackageJsonSafe() {
232
+ const packageJsonPath = join(cwd(), 'package.json')
233
+ if (!existsSync(packageJsonPath)) {
234
+ return null
235
+ }
236
+ try {
237
+ return JSON.parse(await readFile(packageJsonPath, 'utf8'))
238
+ } catch {
239
+ return null
240
+ }
241
+ }
242
+
227
243
  /**
228
244
  * Зчитує конфіг .n-cursor.json з поточної директорії
229
245
  * @param {{ bundledRulesDir?: string, bundledSkillsDir?: string }} [paths] каталоги з пакету-джерела (після `bun i` — зазвичай `node_modules/@nitra/cursor`)
@@ -237,22 +253,6 @@ async function readConfig(paths = {}) {
237
253
  const availableRules = await discoverBundledRuleNames(bundledRulesDir)
238
254
  const availableSkills = await discoverBundledSkillNames(bundledSkillsDir)
239
255
 
240
- /**
241
- * Повертає розпарсений package.json з кореня або null, якщо файл відсутній/некоректний.
242
- * @returns {Promise<unknown | null>} Обʼєкт package.json або null, якщо файл недоступний чи JSON невалідний.
243
- */
244
- async function readRootPackageJsonSafe() {
245
- const packageJsonPath = join(cwd(), 'package.json')
246
- if (!existsSync(packageJsonPath)) {
247
- return null
248
- }
249
- try {
250
- return JSON.parse(await readFile(packageJsonPath, 'utf8'))
251
- } catch {
252
- return null
253
- }
254
- }
255
-
256
256
  /**
257
257
  * Автодописує правила/skills за `rules/<rule>/auto.md` і синхронізує `$schema`.
258
258
  * @param {Record<string, unknown>} parsedConfig сирий обʼєкт конфігу
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nitra/cursor",
3
- "version": "1.17.0",
3
+ "version": "1.17.1",
4
4
  "description": "CLI для завантаження cursor-правил (префікс n-) у локальний репозиторій",
5
5
  "keywords": [
6
6
  "cli",
@@ -43,6 +43,7 @@
43
43
  "types": "./types/bin/n-cursor.d.ts",
44
44
  "scripts": {
45
45
  "test": "bun test",
46
+ "test:coverage": "bun test --coverage",
46
47
  "start": "bun ./bin/n-cursor.js",
47
48
  "rename-yaml-extensions": "bun ./bin/n-cursor.js rename-yaml-extensions"
48
49
  },
@@ -1,3 +1,4 @@
1
+ import { isRunAsCli, runRuleCli } from '../../scripts/lib/run-rule-cli.mjs'
1
2
  import { runStandardRule } from '../../scripts/lib/run-standard-rule.mjs'
2
3
 
3
4
  /**
@@ -10,10 +11,9 @@ export function run(ctx) {
10
11
  return runStandardRule(import.meta.dirname, ctx)
11
12
  }
12
13
 
13
- if (import.meta.main) {
14
+ if (isRunAsCli()) {
14
15
  // Standalone: bun rules/<id>/fix.mjs — повний еквівалент `npx @nitra/cursor fix <id>`
15
16
  // (config-loading + whitelist + summary). Дві ролі fix.mjs: library (run) + standalone (main).
16
- const { runRuleCli } = await import('../../scripts/lib/run-rule-cli.mjs')
17
- // eslint-disable-next-line unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
17
+ // eslint-disable-next-line n/no-process-exit, unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
18
18
  process.exit(await runRuleCli(import.meta.dirname))
19
19
  }
package/rules/adr/fix.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import { isRunAsCli, runRuleCli } from '../../scripts/lib/run-rule-cli.mjs'
1
2
  import { runStandardRule } from '../../scripts/lib/run-standard-rule.mjs'
2
3
 
3
4
  /**
@@ -10,10 +11,9 @@ export function run(ctx) {
10
11
  return runStandardRule(import.meta.dirname, ctx)
11
12
  }
12
13
 
13
- if (import.meta.main) {
14
+ if (isRunAsCli()) {
14
15
  // Standalone: bun rules/<id>/fix.mjs — повний еквівалент `npx @nitra/cursor fix <id>`
15
16
  // (config-loading + whitelist + summary). Дві ролі fix.mjs: library (run) + standalone (main).
16
- const { runRuleCli } = await import('../../scripts/lib/run-rule-cli.mjs')
17
- // eslint-disable-next-line unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
17
+ // eslint-disable-next-line n/no-process-exit, unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
18
18
  process.exit(await runRuleCli(import.meta.dirname))
19
19
  }
@@ -82,7 +82,7 @@ function gitignoreLineCoversHookLog(line, logPath) {
82
82
 
83
83
  /**
84
84
  * Перевіряє наявність і канонічність одного hook-скрипта.
85
- * @param {import('../../../../scripts/lib/check-reporter.mjs').CheckReporter} reporter репортер для збору результатів
85
+ * @param {import('../../../scripts/lib/check-reporter.mjs').CheckReporter} reporter репортер для збору результатів
86
86
  * @param {string} scriptName базове ім'я скрипта (наприклад `capture-decisions.sh`)
87
87
  * @returns {Promise<void>}
88
88
  */
@@ -111,7 +111,7 @@ async function checkHookScript(reporter, scriptName) {
111
111
  * `.claude/settings.local.json`. Структуру (`hooks.Stop[]` містить групу з
112
112
  * `capture-decisions.sh`; `settings.local.json` не дублює) валідують
113
113
  * `npm/policy/adr/settings_json/` і `npm/policy/adr/settings_local_json/`.
114
- * @param {import('../../../../scripts/lib/check-reporter.mjs').CheckReporter} reporter репортер
114
+ * @param {import('../../../scripts/lib/check-reporter.mjs').CheckReporter} reporter репортер
115
115
  */
116
116
  function checkProjectSettings(reporter) {
117
117
  const { pass, fail } = reporter
@@ -164,7 +164,7 @@ function cursorConfigHasStopHook(config, marker) {
164
164
 
165
165
  /**
166
166
  * Перевіряє project-level Cursor hooks config для ADR stop-hooks.
167
- * @param {import('../../../../scripts/lib/check-reporter.mjs').CheckReporter} reporter репортер
167
+ * @param {import('../../../scripts/lib/check-reporter.mjs').CheckReporter} reporter репортер
168
168
  * @returns {Promise<void>}
169
169
  */
170
170
  async function checkCursorHooks(reporter) {
@@ -190,7 +190,7 @@ async function checkCursorHooks(reporter) {
190
190
 
191
191
  /**
192
192
  * Перевіряє `.gitignore` на ігнорування лог-файлу одного хука.
193
- * @param {import('../../../../scripts/lib/check-reporter.mjs').CheckReporter} reporter репортер для збору результатів
193
+ * @param {import('../../../scripts/lib/check-reporter.mjs').CheckReporter} reporter репортер для збору результатів
194
194
  * @param {string} logName базове ім'я лог-файлу (наприклад `capture-decisions.log`)
195
195
  * @param {string} gitignoreContent попередньо прочитаний вміст `.gitignore`
196
196
  * @returns {void}
@@ -211,7 +211,7 @@ function checkGitignoreForLog(reporter, logName, gitignoreContent) {
211
211
 
212
212
  /**
213
213
  * Перевіряє `.gitignore` для всіх hook-логів одним проходом.
214
- * @param {import('../../../../scripts/lib/check-reporter.mjs').CheckReporter} reporter репортер для збору результатів
214
+ * @param {import('../../../scripts/lib/check-reporter.mjs').CheckReporter} reporter репортер для збору результатів
215
215
  * @returns {Promise<void>}
216
216
  */
217
217
  async function checkGitignore(reporter) {
@@ -251,7 +251,7 @@ function isBinaryInPath(name) {
251
251
  /**
252
252
  * Інформативна перевірка: чи доступний бодай один LLM CLI (`claude` або `cursor-agent`).
253
253
  * Якщо жодного немає — це warning (`pass` з підказкою), бо хук просто мовчки no-op'ає.
254
- * @param {import('../../../../scripts/lib/check-reporter.mjs').CheckReporter} reporter репортер для збору результатів
254
+ * @param {import('../../../scripts/lib/check-reporter.mjs').CheckReporter} reporter репортер для збору результатів
255
255
  * @returns {void}
256
256
  */
257
257
  function checkLlmCliAvailable(reporter) {
package/rules/bun/fix.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import { isRunAsCli, runRuleCli } from '../../scripts/lib/run-rule-cli.mjs'
1
2
  import { runStandardRule } from '../../scripts/lib/run-standard-rule.mjs'
2
3
 
3
4
  /**
@@ -10,10 +11,9 @@ export function run(ctx) {
10
11
  return runStandardRule(import.meta.dirname, ctx)
11
12
  }
12
13
 
13
- if (import.meta.main) {
14
+ if (isRunAsCli()) {
14
15
  // Standalone: bun rules/<id>/fix.mjs — повний еквівалент `npx @nitra/cursor fix <id>`
15
16
  // (config-loading + whitelist + summary). Дві ролі fix.mjs: library (run) + standalone (main).
16
- const { runRuleCli } = await import('../../scripts/lib/run-rule-cli.mjs')
17
- // eslint-disable-next-line unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
17
+ // eslint-disable-next-line n/no-process-exit, unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
18
18
  process.exit(await runRuleCli(import.meta.dirname))
19
19
  }
@@ -1,3 +1,4 @@
1
+ import { isRunAsCli, runRuleCli } from '../../scripts/lib/run-rule-cli.mjs'
1
2
  import { runStandardRule } from '../../scripts/lib/run-standard-rule.mjs'
2
3
 
3
4
  /**
@@ -10,10 +11,9 @@ export function run(ctx) {
10
11
  return runStandardRule(import.meta.dirname, ctx)
11
12
  }
12
13
 
13
- if (import.meta.main) {
14
+ if (isRunAsCli()) {
14
15
  // Standalone: bun rules/<id>/fix.mjs — повний еквівалент `npx @nitra/cursor fix <id>`
15
16
  // (config-loading + whitelist + summary). Дві ролі fix.mjs: library (run) + standalone (main).
16
- const { runRuleCli } = await import('../../scripts/lib/run-rule-cli.mjs')
17
- // eslint-disable-next-line unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
17
+ // eslint-disable-next-line n/no-process-exit, unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
18
18
  process.exit(await runRuleCli(import.meta.dirname))
19
19
  }
@@ -1,3 +1,4 @@
1
+ import { isRunAsCli, runRuleCli } from '../../scripts/lib/run-rule-cli.mjs'
1
2
  import { runStandardRule } from '../../scripts/lib/run-standard-rule.mjs'
2
3
 
3
4
  /**
@@ -10,10 +11,9 @@ export function run(ctx) {
10
11
  return runStandardRule(import.meta.dirname, ctx)
11
12
  }
12
13
 
13
- if (import.meta.main) {
14
+ if (isRunAsCli()) {
14
15
  // Standalone: bun rules/<id>/fix.mjs — повний еквівалент `npx @nitra/cursor fix <id>`
15
16
  // (config-loading + whitelist + summary). Дві ролі fix.mjs: library (run) + standalone (main).
16
- const { runRuleCli } = await import('../../scripts/lib/run-rule-cli.mjs')
17
- // eslint-disable-next-line unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
17
+ // eslint-disable-next-line n/no-process-exit, unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
18
18
  process.exit(await runRuleCli(import.meta.dirname))
19
19
  }
@@ -247,7 +247,7 @@ async function workspaceHasRelevantChangesAgainstBase(baseRef, ws, subWorkspaces
247
247
  /**
248
248
  * Версія з маніфесту на `baseRef`.
249
249
  * @param {string} baseRef параметр
250
- * @param {import('./package-manifest.mjs').PackageManifest} manifest параметр
250
+ * @param {import('../lib/package-manifest.mjs').PackageManifest} manifest параметр
251
251
  * @returns {Promise<string | null>} результат
252
252
  */
253
253
  async function readBaseVersion(baseRef, manifest) {
@@ -308,8 +308,8 @@ async function defaultGetPublishedPyPiVersion(name) {
308
308
  }
309
309
 
310
310
  /**
311
- * @param {import('./package-manifest.mjs').PackageManifest} manifest параметр
312
- * @param {(name: string, kind?: import('./package-manifest.mjs').PackageKind) => Promise<string | null>} getPublishedVersion параметр
311
+ * @param {import('../lib/package-manifest.mjs').PackageManifest} manifest параметр
312
+ * @param {(name: string, kind?: import('../lib/package-manifest.mjs').PackageKind) => Promise<string | null>} getPublishedVersion параметр
313
313
  * @returns {Promise<string | null>} результат
314
314
  */
315
315
  function resolvePublishedVersion(manifest, getPublishedVersion) {
@@ -319,7 +319,7 @@ function resolvePublishedVersion(manifest, getPublishedVersion) {
319
319
 
320
320
  /**
321
321
  * @param {string} name пакет
322
- * @param {import('./package-manifest.mjs').PackageKind} [kind] тип пакета
322
+ * @param {import('../lib/package-manifest.mjs').PackageKind} [kind] тип пакета
323
323
  * @returns {Promise<string | null>} опублікована версія або null
324
324
  */
325
325
  function defaultGetPublishedVersion(name, kind = 'npm') {
@@ -330,14 +330,14 @@ function defaultGetPublishedVersion(name, kind = 'npm') {
330
330
  }
331
331
 
332
332
  /**
333
- * @returns {(name: string, kind?: import('./package-manifest.mjs').PackageKind) => Promise<string | null>} стандартний резолвер
333
+ * @returns {(name: string, kind?: import('../lib/package-manifest.mjs').PackageKind) => Promise<string | null>} стандартний резолвер
334
334
  */
335
335
  function createDefaultGetPublishedVersion() {
336
336
  return defaultGetPublishedVersion
337
337
  }
338
338
 
339
339
  /**
340
- * @param {import('./package-manifest.mjs').PackageManifest} manifest параметр
340
+ * @param {import('../lib/package-manifest.mjs').PackageManifest} manifest параметр
341
341
  * @param {(msg: string) => void} pass параметр
342
342
  * @param {(msg: string) => void} fail параметр
343
343
  */
@@ -375,7 +375,7 @@ async function verifyChangelogEntry(ws, version, pass, fail) {
375
375
  }
376
376
 
377
377
  /**
378
- * @param {import('./package-manifest.mjs').PackageManifest} manifest параметр
378
+ * @param {import('../lib/package-manifest.mjs').PackageManifest} manifest параметр
379
379
  * @returns {string} результат
380
380
  */
381
381
  function workspaceLabel(manifest) {
@@ -383,7 +383,7 @@ function workspaceLabel(manifest) {
383
383
  }
384
384
 
385
385
  /**
386
- * @param {import('./package-manifest.mjs').PackageManifest} manifest параметр
386
+ * @param {import('../lib/package-manifest.mjs').PackageManifest} manifest параметр
387
387
  * @param {string} Vcurrent параметр
388
388
  * @param {string[]} subWorkspaces параметр
389
389
  * @param {(msg: string) => void} pass параметр
@@ -438,9 +438,9 @@ async function checkPublishedWorkspacePendingGitChanges(manifest, Vcurrent, subW
438
438
  }
439
439
 
440
440
  /**
441
- * @param {import('./package-manifest.mjs').PackageManifest} manifest параметр
441
+ * @param {import('../lib/package-manifest.mjs').PackageManifest} manifest параметр
442
442
  * @param {string[]} subWorkspaces параметр
443
- * @param {(name: string, kind?: import('./package-manifest.mjs').PackageKind) => Promise<string | null>} getPublishedVersion параметр
443
+ * @param {(name: string, kind?: import('../lib/package-manifest.mjs').PackageKind) => Promise<string | null>} getPublishedVersion параметр
444
444
  * @param {(msg: string) => void} pass параметр
445
445
  * @param {(msg: string) => void} fail параметр
446
446
  * @returns {Promise<void>} результат
@@ -475,7 +475,7 @@ async function checkPublishedWorkspace(manifest, subWorkspaces, getPublishedVers
475
475
 
476
476
  /**
477
477
  * @param {string} comparisonRef ref/SHA для `git diff` / `git show`
478
- * @param {import('./package-manifest.mjs').PackageManifest} manifest параметр
478
+ * @param {import('../lib/package-manifest.mjs').PackageManifest} manifest параметр
479
479
  * @param {string} baseLabel параметр
480
480
  * @param {(msg: string) => void} pass параметр
481
481
  * @param {(msg: string) => void} fail параметр
@@ -507,7 +507,7 @@ async function checkLocalOnlyChangedWorkspace(comparisonRef, manifest, baseLabel
507
507
  }
508
508
 
509
509
  /**
510
- * @param {import('./package-manifest.mjs').PackageManifest[]} localOnly параметр
510
+ * @param {import('../lib/package-manifest.mjs').PackageManifest[]} localOnly параметр
511
511
  * @param {string[]} subWorkspaces параметр
512
512
  * @param {(msg: string) => void} pass параметр
513
513
  * @param {(msg: string) => void} fail параметр
@@ -543,7 +543,7 @@ async function runLocalOnlyChecks(localOnly, subWorkspaces, pass, fail) {
543
543
 
544
544
  /**
545
545
  * @param {object} [opts] опції перевірки
546
- * @param {(name: string, kind?: import('./package-manifest.mjs').PackageKind) => Promise<string | null>} [opts.getPublishedVersion] перевизначення npm/PyPI у тестах
546
+ * @param {(name: string, kind?: import('../lib/package-manifest.mjs').PackageKind) => Promise<string | null>} [opts.getPublishedVersion] перевизначення npm/PyPI у тестах
547
547
  * @returns {Promise<number>} exit-код перевірки
548
548
  */
549
549
  export async function check(opts = {}) {
@@ -558,11 +558,11 @@ export async function check(opts = {}) {
558
558
  const isMonorepoRoot = subWorkspaces.length > 0
559
559
 
560
560
  /**
561
- @type {import('./package-manifest.mjs').PackageManifest[]}
561
+ @type {import('../lib/package-manifest.mjs').PackageManifest[]}
562
562
  */
563
563
  const published = []
564
564
  /**
565
- @type {import('./package-manifest.mjs').PackageManifest[]}
565
+ @type {import('../lib/package-manifest.mjs').PackageManifest[]}
566
566
  */
567
567
  const localOnly = []
568
568
 
package/rules/ci4/fix.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import { isRunAsCli, runRuleCli } from '../../scripts/lib/run-rule-cli.mjs'
1
2
  import { runStandardRule } from '../../scripts/lib/run-standard-rule.mjs'
2
3
 
3
4
  /**
@@ -10,10 +11,9 @@ export function run(ctx) {
10
11
  return runStandardRule(import.meta.dirname, ctx)
11
12
  }
12
13
 
13
- if (import.meta.main) {
14
+ if (isRunAsCli()) {
14
15
  // Standalone: bun rules/<id>/fix.mjs — повний еквівалент `npx @nitra/cursor fix <id>`
15
16
  // (config-loading + whitelist + summary). Дві ролі fix.mjs: library (run) + standalone (main).
16
- const { runRuleCli } = await import('../../scripts/lib/run-rule-cli.mjs')
17
- // eslint-disable-next-line unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
17
+ // eslint-disable-next-line n/no-process-exit, unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
18
18
  process.exit(await runRuleCli(import.meta.dirname))
19
19
  }
@@ -1,3 +1,4 @@
1
+ import { isRunAsCli, runRuleCli } from '../../scripts/lib/run-rule-cli.mjs'
1
2
  import { runStandardRule } from '../../scripts/lib/run-standard-rule.mjs'
2
3
 
3
4
  /**
@@ -10,10 +11,9 @@ export function run(ctx) {
10
11
  return runStandardRule(import.meta.dirname, ctx)
11
12
  }
12
13
 
13
- if (import.meta.main) {
14
+ if (isRunAsCli()) {
14
15
  // Standalone: bun rules/<id>/fix.mjs — повний еквівалент `npx @nitra/cursor fix <id>`
15
16
  // (config-loading + whitelist + summary). Дві ролі fix.mjs: library (run) + standalone (main).
16
- const { runRuleCli } = await import('../../scripts/lib/run-rule-cli.mjs')
17
- // eslint-disable-next-line unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
17
+ // eslint-disable-next-line n/no-process-exit, unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
18
18
  process.exit(await runRuleCli(import.meta.dirname))
19
19
  }
@@ -1,3 +1,4 @@
1
+ import { isRunAsCli, runRuleCli } from '../../scripts/lib/run-rule-cli.mjs'
1
2
  import { runStandardRule } from '../../scripts/lib/run-standard-rule.mjs'
2
3
 
3
4
  /**
@@ -10,10 +11,9 @@ export function run(ctx) {
10
11
  return runStandardRule(import.meta.dirname, ctx)
11
12
  }
12
13
 
13
- if (import.meta.main) {
14
+ if (isRunAsCli()) {
14
15
  // Standalone: bun rules/<id>/fix.mjs — повний еквівалент `npx @nitra/cursor fix <id>`
15
16
  // (config-loading + whitelist + summary). Дві ролі fix.mjs: library (run) + standalone (main).
16
- const { runRuleCli } = await import('../../scripts/lib/run-rule-cli.mjs')
17
- // eslint-disable-next-line unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
17
+ // eslint-disable-next-line n/no-process-exit, unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
18
18
  process.exit(await runRuleCli(import.meta.dirname))
19
19
  }
@@ -1,3 +1,4 @@
1
+ import { isRunAsCli, runRuleCli } from '../../scripts/lib/run-rule-cli.mjs'
1
2
  import { runStandardRule } from '../../scripts/lib/run-standard-rule.mjs'
2
3
 
3
4
  /**
@@ -10,10 +11,9 @@ export function run(ctx) {
10
11
  return runStandardRule(import.meta.dirname, ctx)
11
12
  }
12
13
 
13
- if (import.meta.main) {
14
+ if (isRunAsCli()) {
14
15
  // Standalone: bun rules/<id>/fix.mjs — повний еквівалент `npx @nitra/cursor fix <id>`
15
16
  // (config-loading + whitelist + summary). Дві ролі fix.mjs: library (run) + standalone (main).
16
- const { runRuleCli } = await import('../../scripts/lib/run-rule-cli.mjs')
17
- // eslint-disable-next-line unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
17
+ // eslint-disable-next-line n/no-process-exit, unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
18
18
  process.exit(await runRuleCli(import.meta.dirname))
19
19
  }
package/rules/ga/fix.mjs CHANGED
@@ -1,3 +1,4 @@
1
+ import { isRunAsCli, runRuleCli } from '../../scripts/lib/run-rule-cli.mjs'
1
2
  import { runStandardRule } from '../../scripts/lib/run-standard-rule.mjs'
2
3
 
3
4
  /**
@@ -10,10 +11,9 @@ export function run(ctx) {
10
11
  return runStandardRule(import.meta.dirname, ctx)
11
12
  }
12
13
 
13
- if (import.meta.main) {
14
+ if (isRunAsCli()) {
14
15
  // Standalone: bun rules/<id>/fix.mjs — повний еквівалент `npx @nitra/cursor fix <id>`
15
16
  // (config-loading + whitelist + summary). Дві ролі fix.mjs: library (run) + standalone (main).
16
- const { runRuleCli } = await import('../../scripts/lib/run-rule-cli.mjs')
17
- // eslint-disable-next-line unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
17
+ // eslint-disable-next-line n/no-process-exit, unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
18
18
  process.exit(await runRuleCli(import.meta.dirname))
19
19
  }
@@ -1,3 +1,4 @@
1
+ import { isRunAsCli, runRuleCli } from '../../scripts/lib/run-rule-cli.mjs'
1
2
  import { runStandardRule } from '../../scripts/lib/run-standard-rule.mjs'
2
3
 
3
4
  /**
@@ -10,10 +11,9 @@ export function run(ctx) {
10
11
  return runStandardRule(import.meta.dirname, ctx)
11
12
  }
12
13
 
13
- if (import.meta.main) {
14
+ if (isRunAsCli()) {
14
15
  // Standalone: bun rules/<id>/fix.mjs — повний еквівалент `npx @nitra/cursor fix <id>`
15
16
  // (config-loading + whitelist + summary). Дві ролі fix.mjs: library (run) + standalone (main).
16
- const { runRuleCli } = await import('../../scripts/lib/run-rule-cli.mjs')
17
- // eslint-disable-next-line unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
17
+ // eslint-disable-next-line n/no-process-exit, unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
18
18
  process.exit(await runRuleCli(import.meta.dirname))
19
19
  }
@@ -1,3 +1,4 @@
1
+ import { isRunAsCli, runRuleCli } from '../../scripts/lib/run-rule-cli.mjs'
1
2
  import { runStandardRule } from '../../scripts/lib/run-standard-rule.mjs'
2
3
 
3
4
  /**
@@ -10,10 +11,9 @@ export function run(ctx) {
10
11
  return runStandardRule(import.meta.dirname, ctx)
11
12
  }
12
13
 
13
- if (import.meta.main) {
14
+ if (isRunAsCli()) {
14
15
  // Standalone: bun rules/<id>/fix.mjs — повний еквівалент `npx @nitra/cursor fix <id>`
15
16
  // (config-loading + whitelist + summary). Дві ролі fix.mjs: library (run) + standalone (main).
16
- const { runRuleCli } = await import('../../scripts/lib/run-rule-cli.mjs')
17
- // eslint-disable-next-line unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
17
+ // eslint-disable-next-line n/no-process-exit, unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
18
18
  process.exit(await runRuleCli(import.meta.dirname))
19
19
  }
@@ -1,3 +1,4 @@
1
+ import { isRunAsCli, runRuleCli } from '../../scripts/lib/run-rule-cli.mjs'
1
2
  import { runStandardRule } from '../../scripts/lib/run-standard-rule.mjs'
2
3
 
3
4
  /**
@@ -10,10 +11,9 @@ export function run(ctx) {
10
11
  return runStandardRule(import.meta.dirname, ctx)
11
12
  }
12
13
 
13
- if (import.meta.main) {
14
+ if (isRunAsCli()) {
14
15
  // Standalone: bun rules/<id>/fix.mjs — повний еквівалент `npx @nitra/cursor fix <id>`
15
16
  // (config-loading + whitelist + summary). Дві ролі fix.mjs: library (run) + standalone (main).
16
- const { runRuleCli } = await import('../../scripts/lib/run-rule-cli.mjs')
17
- // eslint-disable-next-line unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
17
+ // eslint-disable-next-line n/no-process-exit, unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
18
18
  process.exit(await runRuleCli(import.meta.dirname))
19
19
  }
@@ -1,3 +1,4 @@
1
+ import { isRunAsCli, runRuleCli } from '../../scripts/lib/run-rule-cli.mjs'
1
2
  import { runStandardRule } from '../../scripts/lib/run-standard-rule.mjs'
2
3
 
3
4
  /**
@@ -10,10 +11,9 @@ export function run(ctx) {
10
11
  return runStandardRule(import.meta.dirname, ctx)
11
12
  }
12
13
 
13
- if (import.meta.main) {
14
+ if (isRunAsCli()) {
14
15
  // Standalone: bun rules/<id>/fix.mjs — повний еквівалент `npx @nitra/cursor fix <id>`
15
16
  // (config-loading + whitelist + summary). Дві ролі fix.mjs: library (run) + standalone (main).
16
- const { runRuleCli } = await import('../../scripts/lib/run-rule-cli.mjs')
17
- // eslint-disable-next-line unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
17
+ // eslint-disable-next-line n/no-process-exit, unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
18
18
  process.exit(await runRuleCli(import.meta.dirname))
19
19
  }
@@ -1,3 +1,4 @@
1
+ import { isRunAsCli, runRuleCli } from '../../scripts/lib/run-rule-cli.mjs'
1
2
  import { runStandardRule } from '../../scripts/lib/run-standard-rule.mjs'
2
3
 
3
4
  /**
@@ -10,10 +11,9 @@ export function run(ctx) {
10
11
  return runStandardRule(import.meta.dirname, ctx)
11
12
  }
12
13
 
13
- if (import.meta.main) {
14
+ if (isRunAsCli()) {
14
15
  // Standalone: bun rules/<id>/fix.mjs — повний еквівалент `npx @nitra/cursor fix <id>`
15
16
  // (config-loading + whitelist + summary). Дві ролі fix.mjs: library (run) + standalone (main).
16
- const { runRuleCli } = await import('../../scripts/lib/run-rule-cli.mjs')
17
- // eslint-disable-next-line unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
17
+ // eslint-disable-next-line n/no-process-exit, unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
18
18
  process.exit(await runRuleCli(import.meta.dirname))
19
19
  }
@@ -1,3 +1,4 @@
1
+ import { isRunAsCli, runRuleCli } from '../../scripts/lib/run-rule-cli.mjs'
1
2
  import { runStandardRule } from '../../scripts/lib/run-standard-rule.mjs'
2
3
 
3
4
  /**
@@ -10,10 +11,9 @@ export function run(ctx) {
10
11
  return runStandardRule(import.meta.dirname, ctx)
11
12
  }
12
13
 
13
- if (import.meta.main) {
14
+ if (isRunAsCli()) {
14
15
  // Standalone: bun rules/<id>/fix.mjs — повний еквівалент `npx @nitra/cursor fix <id>`
15
16
  // (config-loading + whitelist + summary). Дві ролі fix.mjs: library (run) + standalone (main).
16
- const { runRuleCli } = await import('../../scripts/lib/run-rule-cli.mjs')
17
- // eslint-disable-next-line unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
17
+ // eslint-disable-next-line n/no-process-exit, unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
18
18
  process.exit(await runRuleCli(import.meta.dirname))
19
19
  }