@nitra/cursor 1.15.1 → 1.16.0
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 +12 -0
- package/bin/n-cursor.js +4 -4
- package/package.json +1 -1
- package/rules/abie/fix.mjs +3 -3
- package/rules/abie/js/applies.mjs +2 -2
- package/rules/abie/js/env_dns.mjs +3 -3
- package/rules/abie/js/firebase_hosting.mjs +1 -1
- package/rules/abie/js/hc_pairing.mjs +4 -4
- package/rules/abie/js/ua_http_route.mjs +6 -6
- package/rules/abie/js/ua_node_selector.mjs +5 -5
- package/rules/adr/fix.mjs +3 -3
- package/rules/adr/js/hooks.mjs +7 -7
- package/rules/bun/fix.mjs +3 -3
- package/rules/bun/js/layout.mjs +1 -1
- package/rules/capacitor/fix.mjs +3 -3
- package/rules/capacitor/js/platforms.mjs +1 -1
- package/rules/changelog/fix.mjs +3 -3
- package/rules/changelog/js/consistency.mjs +2 -2
- package/rules/changelog/{utils → lib}/package-manifest.mjs +1 -1
- package/rules/ci4/fix.mjs +3 -3
- package/rules/docker/fix.mjs +3 -3
- package/rules/docker/js/lint.mjs +4 -4
- package/rules/docker/lint/lint.mjs +4 -4
- package/rules/efes/fix.mjs +3 -3
- package/rules/feedback/fix.mjs +3 -3
- package/rules/ga/fix.mjs +3 -3
- package/rules/ga/js/workflows.mjs +4 -4
- package/rules/ga/lint/lint.mjs +2 -2
- package/rules/graphql/fix.mjs +3 -3
- package/rules/graphql/js/tooling.mjs +4 -4
- package/rules/hasura/fix.mjs +3 -3
- package/rules/hasura/js/internal_urls.mjs +2 -2
- package/rules/image-avif/fix.mjs +3 -3
- package/rules/image-avif/js/avif_generation.mjs +3 -3
- package/rules/image-compress/fix.mjs +3 -3
- package/rules/image-compress/js/package_setup.mjs +1 -1
- package/rules/js-bun-db/fix.mjs +3 -3
- package/rules/js-bun-db/js/safety.mjs +3 -3
- package/rules/js-bun-redis/fix.mjs +3 -3
- package/rules/js-bun-redis/js/imports.mjs +3 -3
- package/{scripts/utils → rules/js-bun-redis/lib}/redis-imports.mjs +1 -1
- package/rules/js-lint/fix.mjs +3 -3
- package/rules/js-lint/js/tooling.mjs +1 -1
- package/rules/js-lint/js/utils_imports.mjs +199 -0
- package/rules/js-lint/js-lint.mdc +2 -0
- package/rules/js-lint/{utils → lib}/rebuild-oxlint-canonical.mjs +1 -1
- package/rules/js-mssql/fix.mjs +3 -3
- package/rules/js-mssql/js/deps.mjs +3 -3
- package/rules/js-run/fix.mjs +3 -3
- package/rules/js-run/js/runtime.mjs +9 -9
- package/rules/k8s/fix.mjs +3 -3
- package/rules/k8s/js/manifests.mjs +3 -3
- package/rules/k8s/lint/lint.mjs +2 -2
- package/rules/nginx-default-tpl/fix.mjs +3 -3
- package/rules/nginx-default-tpl/js/template.mjs +3 -3
- package/rules/npm-module/fix.mjs +3 -3
- package/rules/npm-module/js/package_structure.mjs +2 -2
- package/rules/php/fix.mjs +3 -3
- package/rules/php/js/tooling.mjs +1 -1
- package/rules/php/lint/lint.mjs +1 -1
- package/rules/rego/fix.mjs +3 -3
- package/rules/rego/js/applies.mjs +2 -2
- package/rules/rego/lint/lint.mjs +1 -1
- package/rules/rust/fix.mjs +3 -3
- package/rules/rust/js/applies.mjs +2 -2
- package/rules/rust/{utils → lib}/has-cargo-toml.mjs +1 -1
- package/rules/security/fix.mjs +3 -3
- package/rules/security/js/sample_secret.mjs +1 -1
- package/rules/security/js/trufflehog.mjs +2 -2
- package/rules/style-lint/fix.mjs +3 -3
- package/rules/style-lint/js/tooling.mjs +2 -2
- package/rules/tauri/fix.mjs +3 -3
- package/rules/tauri/js/tooling.mjs +2 -2
- package/rules/test/fix.mjs +3 -3
- package/rules/test/js/location.mjs +2 -2
- package/rules/text/fix.mjs +3 -3
- package/rules/text/js/formatting.mjs +2 -2
- package/rules/text/lint/lint.mjs +2 -2
- package/rules/vue/fix.mjs +3 -3
- package/rules/vue/js/packages.mjs +4 -4
- package/scripts/auto-rules.mjs +3 -3
- package/scripts/{utils → lib}/check-reporter.mjs +1 -1
- package/scripts/{utils → lib}/resolve-target-files.mjs +1 -1
- package/scripts/{utils → lib}/run-conftest-batch.mjs +1 -1
- package/scripts/{utils → lib}/run-lint-step.mjs +1 -1
- package/scripts/{utils → lib}/run-rule-cli.mjs +1 -1
- package/scripts/{utils → lib}/run-standard-lint.mjs +2 -2
- package/scripts/{utils → lib}/run-standard-rule.mjs +2 -2
- package/scripts/rename-yaml-extensions.mjs +1 -1
- /package/rules/abie/{utils → lib}/enabled.mjs +0 -0
- /package/rules/abie/{utils → lib}/env-dns.mjs +0 -0
- /package/rules/abie/{utils → lib}/hc-yaml.mjs +0 -0
- /package/rules/abie/{utils → lib}/http-route.mjs +0 -0
- /package/rules/abie/{utils → lib}/k8s-tree.mjs +0 -0
- /package/rules/abie/{utils → lib}/kustomization-patches.mjs +0 -0
- /package/rules/abie/{utils → lib}/overlay-paths.mjs +0 -0
- /package/rules/abie/{utils → lib}/yaml.mjs +0 -0
- /package/rules/docker/{utils → lib}/docker-hadolint.mjs +0 -0
- /package/rules/docker/{utils → lib}/docker-mirror.mjs +0 -0
- /package/rules/graphql/{utils → lib}/graphql-gql-scan.mjs +0 -0
- /package/rules/js-bun-db/{utils → lib}/bun-sql-scan.mjs +0 -0
- /package/rules/js-mssql/{utils → lib}/mssql-pool-scan.mjs +0 -0
- /package/rules/js-run/{utils → lib}/bunyan-imports.mjs +0 -0
- /package/rules/js-run/{utils → lib}/check-env-scan.mjs +0 -0
- /package/rules/js-run/{utils → lib}/conn-file-rules.mjs +0 -0
- /package/rules/js-run/{utils → lib}/conn-imports-scan.mjs +0 -0
- /package/rules/js-run/{utils → lib}/promise-settimeout-scan.mjs +0 -0
- /package/rules/vue/{utils → lib}/vue-forbidden-imports.mjs +0 -0
- /package/scripts/{utils → lib}/check-mdc-template-refs.mjs +0 -0
- /package/scripts/{utils → lib}/discover-check-rules-from-cursor.mjs +0 -0
- /package/scripts/{utils → lib}/discover-checkable-rules.mjs +0 -0
- /package/scripts/{utils → lib}/generated-markdown.mjs +0 -0
- /package/scripts/{utils → lib}/gha-workflow.mjs +0 -0
- /package/scripts/{utils → lib}/inline-template-links.mjs +0 -0
- /package/scripts/{utils → lib}/list-rule-ids.mjs +0 -0
- /package/scripts/{utils → lib}/load-cursor-config.mjs +0 -0
- /package/scripts/{utils → lib}/read-n-cursor-config-lite.mjs +0 -0
- /package/scripts/{utils → lib}/run-rule.mjs +0 -0
- /package/scripts/{utils → lib}/template.mjs +0 -0
- /package/scripts/{utils → lib}/workspaces.mjs +0 -0
|
@@ -18,9 +18,9 @@ import { readdir, readFile, rename, unlink, writeFile } from 'node:fs/promises'
|
|
|
18
18
|
import { basename, dirname, join, relative } from 'node:path'
|
|
19
19
|
|
|
20
20
|
import { findDockerfilePaths } from '../../docker/js/lint.mjs'
|
|
21
|
-
import { createCheckReporter } from '../../../scripts/
|
|
22
|
-
import { loadCursorIgnorePaths } from '../../../scripts/
|
|
23
|
-
import { runConftestBatch } from '../../../scripts/
|
|
21
|
+
import { createCheckReporter } from '../../../scripts/lib/check-reporter.mjs'
|
|
22
|
+
import { loadCursorIgnorePaths } from '../../../scripts/lib/load-cursor-config.mjs'
|
|
23
|
+
import { runConftestBatch } from '../../../scripts/lib/run-conftest-batch.mjs'
|
|
24
24
|
import { walkDir } from '../../../scripts/utils/walkDir.mjs'
|
|
25
25
|
|
|
26
26
|
const LINE_SPLIT_RE = /\r?\n/u
|
package/rules/npm-module/fix.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { runStandardRule } from '../../scripts/
|
|
1
|
+
import { runStandardRule } from '../../scripts/lib/run-standard-rule.mjs'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Запускає правило: applies → JS-concerns → policy → mdc-refs (через runStandardRule).
|
|
5
5
|
* Library mode: викликається CLI orchestration через `import + run(ctx)`.
|
|
6
|
-
* @param {import('../../scripts/
|
|
6
|
+
* @param {import('../../scripts/lib/run-standard-rule.mjs').RuleContext} [ctx] контекст прогону (walkCache тощо)
|
|
7
7
|
* @returns {Promise<number>} 0 — OK, 1 — порушення
|
|
8
8
|
*/
|
|
9
9
|
export function run(ctx) {
|
|
@@ -13,7 +13,7 @@ export function run(ctx) {
|
|
|
13
13
|
if (import.meta.main) {
|
|
14
14
|
// Standalone: bun rules/<id>/fix.mjs — повний еквівалент `npx @nitra/cursor fix <id>`
|
|
15
15
|
// (config-loading + whitelist + summary). Дві ролі fix.mjs: library (run) + standalone (main).
|
|
16
|
-
const { runRuleCli } = await import('../../scripts/
|
|
16
|
+
const { runRuleCli } = await import('../../scripts/lib/run-rule-cli.mjs')
|
|
17
17
|
// eslint-disable-next-line unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
|
|
18
18
|
process.exit(await runRuleCli(import.meta.dirname))
|
|
19
19
|
}
|
|
@@ -38,8 +38,8 @@ import {
|
|
|
38
38
|
requireCallModule,
|
|
39
39
|
walkAstWithAncestors
|
|
40
40
|
} from '../../../scripts/utils/ast-scan-utils.mjs'
|
|
41
|
-
import { createCheckReporter } from '../../../scripts/
|
|
42
|
-
import { loadCursorIgnorePaths } from '../../../scripts/
|
|
41
|
+
import { createCheckReporter } from '../../../scripts/lib/check-reporter.mjs'
|
|
42
|
+
import { loadCursorIgnorePaths } from '../../../scripts/lib/load-cursor-config.mjs'
|
|
43
43
|
import { walkDir } from '../../../scripts/utils/walkDir.mjs'
|
|
44
44
|
|
|
45
45
|
const execFileAsync = promisify(execFile)
|
package/rules/php/fix.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { runStandardRule } from '../../scripts/
|
|
1
|
+
import { runStandardRule } from '../../scripts/lib/run-standard-rule.mjs'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Запускає правило: applies → JS-concerns → policy → mdc-refs (через runStandardRule).
|
|
5
5
|
* Library mode: викликається CLI orchestration через `import + run(ctx)`.
|
|
6
|
-
* @param {import('../../scripts/
|
|
6
|
+
* @param {import('../../scripts/lib/run-standard-rule.mjs').RuleContext} [ctx] контекст прогону (walkCache тощо)
|
|
7
7
|
* @returns {Promise<number>} 0 — OK, 1 — порушення
|
|
8
8
|
*/
|
|
9
9
|
export function run(ctx) {
|
|
@@ -13,7 +13,7 @@ export function run(ctx) {
|
|
|
13
13
|
if (import.meta.main) {
|
|
14
14
|
// Standalone: bun rules/<id>/fix.mjs — повний еквівалент `npx @nitra/cursor fix <id>`
|
|
15
15
|
// (config-loading + whitelist + summary). Дві ролі fix.mjs: library (run) + standalone (main).
|
|
16
|
-
const { runRuleCli } = await import('../../scripts/
|
|
16
|
+
const { runRuleCli } = await import('../../scripts/lib/run-rule-cli.mjs')
|
|
17
17
|
// eslint-disable-next-line unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
|
|
18
18
|
process.exit(await runRuleCli(import.meta.dirname))
|
|
19
19
|
}
|
package/rules/php/js/tooling.mjs
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { existsSync } from 'node:fs'
|
|
13
13
|
|
|
14
|
-
import { createCheckReporter } from '../../../scripts/
|
|
14
|
+
import { createCheckReporter } from '../../../scripts/lib/check-reporter.mjs'
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
17
|
* Перевіряє відповідність проєкту правилам php.mdc.
|
package/rules/php/lint/lint.mjs
CHANGED
|
@@ -13,7 +13,7 @@ import { existsSync, statSync } from 'node:fs'
|
|
|
13
13
|
import { join, resolve } from 'node:path'
|
|
14
14
|
|
|
15
15
|
import { isRunAsCli } from '../../../scripts/cli-entry.mjs'
|
|
16
|
-
import { createCheckReporter } from '../../../scripts/
|
|
16
|
+
import { createCheckReporter } from '../../../scripts/lib/check-reporter.mjs'
|
|
17
17
|
import { resolveCmd } from '../../../scripts/utils/resolve-cmd.mjs'
|
|
18
18
|
|
|
19
19
|
const PHPCS_CODE_DIR_CANDIDATES = ['app', 'src', 'lib', 'public', 'www']
|
package/rules/rego/fix.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { runStandardRule } from '../../scripts/
|
|
1
|
+
import { runStandardRule } from '../../scripts/lib/run-standard-rule.mjs'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Запускає правило: applies → JS-concerns → policy → mdc-refs (через runStandardRule).
|
|
5
5
|
* Library mode: викликається CLI orchestration через `import + run(ctx)`.
|
|
6
|
-
* @param {import('../../scripts/
|
|
6
|
+
* @param {import('../../scripts/lib/run-standard-rule.mjs').RuleContext} [ctx] контекст прогону (walkCache тощо)
|
|
7
7
|
* @returns {Promise<number>} 0 — OK, 1 — порушення
|
|
8
8
|
*/
|
|
9
9
|
export function run(ctx) {
|
|
@@ -13,7 +13,7 @@ export function run(ctx) {
|
|
|
13
13
|
if (import.meta.main) {
|
|
14
14
|
// Standalone: bun rules/<id>/fix.mjs — повний еквівалент `npx @nitra/cursor fix <id>`
|
|
15
15
|
// (config-loading + whitelist + summary). Дві ролі fix.mjs: library (run) + standalone (main).
|
|
16
|
-
const { runRuleCli } = await import('../../scripts/
|
|
16
|
+
const { runRuleCli } = await import('../../scripts/lib/run-rule-cli.mjs')
|
|
17
17
|
// eslint-disable-next-line unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
|
|
18
18
|
process.exit(await runRuleCli(import.meta.dirname))
|
|
19
19
|
}
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
* JS тут лишається лише як cross-file гейт: walkDir не виразити декларативно через `target.json`.
|
|
10
10
|
* Друк короткого pass-повідомлення з контекстом робить `check()` (необовʼязковий).
|
|
11
11
|
*/
|
|
12
|
-
import { createCheckReporter } from '../../../scripts/
|
|
13
|
-
import { loadCursorIgnorePaths } from '../../../scripts/
|
|
12
|
+
import { createCheckReporter } from '../../../scripts/lib/check-reporter.mjs'
|
|
13
|
+
import { loadCursorIgnorePaths } from '../../../scripts/lib/load-cursor-config.mjs'
|
|
14
14
|
import { walkDir } from '../../../scripts/utils/walkDir.mjs'
|
|
15
15
|
|
|
16
16
|
/**
|
package/rules/rego/lint/lint.mjs
CHANGED
|
@@ -32,7 +32,7 @@ import { resolve } from 'node:path'
|
|
|
32
32
|
|
|
33
33
|
import { isRunAsCli } from '../../../scripts/cli-entry.mjs'
|
|
34
34
|
import { resolveCmd } from '../../../scripts/utils/resolve-cmd.mjs'
|
|
35
|
-
import { runStandardLint } from '../../../scripts/
|
|
35
|
+
import { runStandardLint } from '../../../scripts/lib/run-standard-lint.mjs'
|
|
36
36
|
|
|
37
37
|
/** Шляхи з Rego-полісі (відносно cwd). Існують не всі на ранніх стадіях — фільтруємо нижче. */
|
|
38
38
|
const LINT_TARGETS = ['npm/rules']
|
package/rules/rust/fix.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { runStandardRule } from '../../scripts/
|
|
1
|
+
import { runStandardRule } from '../../scripts/lib/run-standard-rule.mjs'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Запускає правило: applies → JS-concerns → policy → mdc-refs (через runStandardRule).
|
|
5
5
|
* Library mode: викликається CLI orchestration через `import + run(ctx)`.
|
|
6
|
-
* @param {import('../../scripts/
|
|
6
|
+
* @param {import('../../scripts/lib/run-standard-rule.mjs').RuleContext} [ctx] контекст прогону (walkCache тощо)
|
|
7
7
|
* @returns {Promise<number>} 0 — OK, 1 — порушення
|
|
8
8
|
*/
|
|
9
9
|
export function run(ctx) {
|
|
@@ -13,7 +13,7 @@ export function run(ctx) {
|
|
|
13
13
|
if (import.meta.main) {
|
|
14
14
|
// Standalone: bun rules/<id>/fix.mjs — повний еквівалент `npx @nitra/cursor fix <id>`
|
|
15
15
|
// (config-loading + whitelist + summary). Дві ролі fix.mjs: library (run) + standalone (main).
|
|
16
|
-
const { runRuleCli } = await import('../../scripts/
|
|
16
|
+
const { runRuleCli } = await import('../../scripts/lib/run-rule-cli.mjs')
|
|
17
17
|
// eslint-disable-next-line unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
|
|
18
18
|
process.exit(await runRuleCli(import.meta.dirname))
|
|
19
19
|
}
|
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { existsSync } from 'node:fs'
|
|
9
9
|
|
|
10
|
-
import { createCheckReporter } from '../../../scripts/
|
|
10
|
+
import { createCheckReporter } from '../../../scripts/lib/check-reporter.mjs'
|
|
11
11
|
|
|
12
|
-
import { hasCargoTomlInTree } from '../
|
|
12
|
+
import { hasCargoTomlInTree } from '../lib/has-cargo-toml.mjs'
|
|
13
13
|
|
|
14
14
|
const IGNORED_DIR_NAMES = new Set(['node_modules', '.git', '.next', '.turbo'])
|
|
15
15
|
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* `.next`, `.turbo` за тим самим списком, що `npm/scripts/auto-rules.mjs`.
|
|
5
5
|
*
|
|
6
6
|
* Утиліта rule-local, бо лише `rust` потребує "знайти Cargo.toml у дереві";
|
|
7
|
-
* якщо з'явиться другий споживач — підняти у `npm/scripts/
|
|
7
|
+
* якщо з'явиться другий споживач — підняти у `npm/scripts/lib/`.
|
|
8
8
|
*/
|
|
9
9
|
import { readdirSync } from 'node:fs'
|
|
10
10
|
import { join } from 'node:path'
|
package/rules/security/fix.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { runStandardRule } from '../../scripts/
|
|
1
|
+
import { runStandardRule } from '../../scripts/lib/run-standard-rule.mjs'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Запускає правило: applies → JS-concerns → policy → mdc-refs (через runStandardRule).
|
|
5
5
|
* Library mode: викликається CLI orchestration через `import + run(ctx)`.
|
|
6
|
-
* @param {import('../../scripts/
|
|
6
|
+
* @param {import('../../scripts/lib/run-standard-rule.mjs').RuleContext} [ctx] контекст прогону (walkCache тощо)
|
|
7
7
|
* @returns {Promise<number>} 0 — OK, 1 — порушення
|
|
8
8
|
*/
|
|
9
9
|
export function run(ctx) {
|
|
@@ -13,7 +13,7 @@ export function run(ctx) {
|
|
|
13
13
|
if (import.meta.main) {
|
|
14
14
|
// Standalone: bun rules/<id>/fix.mjs — повний еквівалент `npx @nitra/cursor fix <id>`
|
|
15
15
|
// (config-loading + whitelist + summary). Дві ролі fix.mjs: library (run) + standalone (main).
|
|
16
|
-
const { runRuleCli } = await import('../../scripts/
|
|
16
|
+
const { runRuleCli } = await import('../../scripts/lib/run-rule-cli.mjs')
|
|
17
17
|
// eslint-disable-next-line unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
|
|
18
18
|
process.exit(await runRuleCli(import.meta.dirname))
|
|
19
19
|
}
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
import { readFile } from 'node:fs/promises'
|
|
30
30
|
import { relative, sep } from 'node:path'
|
|
31
31
|
|
|
32
|
-
import { createCheckReporter } from '../../../scripts/
|
|
32
|
+
import { createCheckReporter } from '../../../scripts/lib/check-reporter.mjs'
|
|
33
33
|
import { walkDir } from '../../../scripts/utils/walkDir.mjs'
|
|
34
34
|
|
|
35
35
|
/** Суфікс basename'а прикладного файлу (`config.example`, `.env.dist`). */
|
|
@@ -11,8 +11,8 @@ import { readFile } from 'node:fs/promises'
|
|
|
11
11
|
import { dirname, join } from 'node:path'
|
|
12
12
|
import { fileURLToPath } from 'node:url'
|
|
13
13
|
|
|
14
|
-
import { createCheckReporter } from '../../../scripts/
|
|
15
|
-
import { checkTextSubset } from '../../../scripts/
|
|
14
|
+
import { createCheckReporter } from '../../../scripts/lib/check-reporter.mjs'
|
|
15
|
+
import { checkTextSubset } from '../../../scripts/lib/template.mjs'
|
|
16
16
|
|
|
17
17
|
const HERE = dirname(fileURLToPath(import.meta.url))
|
|
18
18
|
const SNIPPET_PATH = join(HERE, 'templates', 'trufflehog', '.trufflehog-exclude.snippet.txt')
|
package/rules/style-lint/fix.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { runStandardRule } from '../../scripts/
|
|
1
|
+
import { runStandardRule } from '../../scripts/lib/run-standard-rule.mjs'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Запускає правило: applies → JS-concerns → policy → mdc-refs (через runStandardRule).
|
|
5
5
|
* Library mode: викликається CLI orchestration через `import + run(ctx)`.
|
|
6
|
-
* @param {import('../../scripts/
|
|
6
|
+
* @param {import('../../scripts/lib/run-standard-rule.mjs').RuleContext} [ctx] контекст прогону (walkCache тощо)
|
|
7
7
|
* @returns {Promise<number>} 0 — OK, 1 — порушення
|
|
8
8
|
*/
|
|
9
9
|
export function run(ctx) {
|
|
@@ -13,7 +13,7 @@ export function run(ctx) {
|
|
|
13
13
|
if (import.meta.main) {
|
|
14
14
|
// Standalone: bun rules/<id>/fix.mjs — повний еквівалент `npx @nitra/cursor fix <id>`
|
|
15
15
|
// (config-loading + whitelist + summary). Дві ролі fix.mjs: library (run) + standalone (main).
|
|
16
|
-
const { runRuleCli } = await import('../../scripts/
|
|
16
|
+
const { runRuleCli } = await import('../../scripts/lib/run-rule-cli.mjs')
|
|
17
17
|
// eslint-disable-next-line unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
|
|
18
18
|
process.exit(await runRuleCli(import.meta.dirname))
|
|
19
19
|
}
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
import { existsSync } from 'node:fs'
|
|
20
20
|
import { readFile } from 'node:fs/promises'
|
|
21
21
|
|
|
22
|
-
import { createCheckReporter } from '../../../scripts/
|
|
22
|
+
import { createCheckReporter } from '../../../scripts/lib/check-reporter.mjs'
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Альтернатива полю `stylelint` у `package.json` — зовнішній файл конфігу. Якщо
|
|
26
26
|
* поля немає і файлу немає, фейлимося; якщо є хоч щось — пропускаємо. Поле
|
|
27
27
|
* `stylelint.extends == "@nitra/stylelint-config"` сам формат — у Rego.
|
|
28
|
-
* @param {import('../../../../scripts/
|
|
28
|
+
* @param {import('../../../../scripts/lib/check-reporter.mjs').CheckReporter} reporter репортер
|
|
29
29
|
*/
|
|
30
30
|
async function checkStylelintConfigPresence(reporter) {
|
|
31
31
|
const { pass, fail } = reporter
|
package/rules/tauri/fix.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { runStandardRule } from '../../scripts/
|
|
1
|
+
import { runStandardRule } from '../../scripts/lib/run-standard-rule.mjs'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Запускає правило: applies → JS-concerns → policy → mdc-refs (через runStandardRule).
|
|
5
5
|
* Library mode: викликається CLI orchestration через `import + run(ctx)`.
|
|
6
|
-
* @param {import('../../scripts/
|
|
6
|
+
* @param {import('../../scripts/lib/run-standard-rule.mjs').RuleContext} [ctx] контекст прогону (walkCache тощо)
|
|
7
7
|
* @returns {Promise<number>} 0 — OK, 1 — порушення
|
|
8
8
|
*/
|
|
9
9
|
export function run(ctx) {
|
|
@@ -13,7 +13,7 @@ export function run(ctx) {
|
|
|
13
13
|
if (import.meta.main) {
|
|
14
14
|
// Standalone: bun rules/<id>/fix.mjs — повний еквівалент `npx @nitra/cursor fix <id>`
|
|
15
15
|
// (config-loading + whitelist + summary). Дві ролі fix.mjs: library (run) + standalone (main).
|
|
16
|
-
const { runRuleCli } = await import('../../scripts/
|
|
16
|
+
const { runRuleCli } = await import('../../scripts/lib/run-rule-cli.mjs')
|
|
17
17
|
// eslint-disable-next-line unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
|
|
18
18
|
process.exit(await runRuleCli(import.meta.dirname))
|
|
19
19
|
}
|
|
@@ -18,8 +18,8 @@
|
|
|
18
18
|
import { existsSync, statSync } from 'node:fs'
|
|
19
19
|
import { readFile } from 'node:fs/promises'
|
|
20
20
|
|
|
21
|
-
import { createCheckReporter } from '../../../scripts/
|
|
22
|
-
import { runConftestBatch } from '../../../scripts/
|
|
21
|
+
import { createCheckReporter } from '../../../scripts/lib/check-reporter.mjs'
|
|
22
|
+
import { runConftestBatch } from '../../../scripts/lib/run-conftest-batch.mjs'
|
|
23
23
|
|
|
24
24
|
/**
|
|
25
25
|
* Чи є префікс `@tauri-apps/` у ключах `dependencies` або `devDependencies`.
|
package/rules/test/fix.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { runStandardRule } from '../../scripts/
|
|
1
|
+
import { runStandardRule } from '../../scripts/lib/run-standard-rule.mjs'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Запускає правило: applies → JS-concerns → policy → mdc-refs (через runStandardRule).
|
|
5
5
|
* Library mode: викликається CLI orchestration через `import + run(ctx)`.
|
|
6
|
-
* @param {import('../../scripts/
|
|
6
|
+
* @param {import('../../scripts/lib/run-standard-rule.mjs').RuleContext} [ctx] контекст прогону (walkCache тощо)
|
|
7
7
|
* @returns {Promise<number>} 0 — OK, 1 — порушення
|
|
8
8
|
*/
|
|
9
9
|
export function run(ctx) {
|
|
@@ -13,7 +13,7 @@ export function run(ctx) {
|
|
|
13
13
|
if (import.meta.main) {
|
|
14
14
|
// Standalone: bun rules/<id>/fix.mjs — повний еквівалент `npx @nitra/cursor fix <id>`
|
|
15
15
|
// (config-loading + whitelist + summary). Дві ролі fix.mjs: library (run) + standalone (main).
|
|
16
|
-
const { runRuleCli } = await import('../../scripts/
|
|
16
|
+
const { runRuleCli } = await import('../../scripts/lib/run-rule-cli.mjs')
|
|
17
17
|
// eslint-disable-next-line unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
|
|
18
18
|
process.exit(await runRuleCli(import.meta.dirname))
|
|
19
19
|
}
|
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { basename, dirname, relative } from 'node:path'
|
|
11
11
|
|
|
12
|
-
import { createCheckReporter } from '../../../scripts/
|
|
13
|
-
import { loadCursorIgnorePaths } from '../../../scripts/
|
|
12
|
+
import { createCheckReporter } from '../../../scripts/lib/check-reporter.mjs'
|
|
13
|
+
import { loadCursorIgnorePaths } from '../../../scripts/lib/load-cursor-config.mjs'
|
|
14
14
|
import { walkDir } from '../../../scripts/utils/walkDir.mjs'
|
|
15
15
|
|
|
16
16
|
const TESTS_DIR_NAME = 'tests'
|
package/rules/text/fix.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { runStandardRule } from '../../scripts/
|
|
1
|
+
import { runStandardRule } from '../../scripts/lib/run-standard-rule.mjs'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Запускає правило: applies → JS-concerns → policy → mdc-refs (через runStandardRule).
|
|
5
5
|
* Library mode: викликається CLI orchestration через `import + run(ctx)`.
|
|
6
|
-
* @param {import('../../scripts/
|
|
6
|
+
* @param {import('../../scripts/lib/run-standard-rule.mjs').RuleContext} [ctx] контекст прогону (walkCache тощо)
|
|
7
7
|
* @returns {Promise<number>} 0 — OK, 1 — порушення
|
|
8
8
|
*/
|
|
9
9
|
export function run(ctx) {
|
|
@@ -13,7 +13,7 @@ export function run(ctx) {
|
|
|
13
13
|
if (import.meta.main) {
|
|
14
14
|
// Standalone: bun rules/<id>/fix.mjs — повний еквівалент `npx @nitra/cursor fix <id>`
|
|
15
15
|
// (config-loading + whitelist + summary). Дві ролі fix.mjs: library (run) + standalone (main).
|
|
16
|
-
const { runRuleCli } = await import('../../scripts/
|
|
16
|
+
const { runRuleCli } = await import('../../scripts/lib/run-rule-cli.mjs')
|
|
17
17
|
// eslint-disable-next-line unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
|
|
18
18
|
process.exit(await runRuleCli(import.meta.dirname))
|
|
19
19
|
}
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
import { existsSync } from 'node:fs'
|
|
33
33
|
import { readFile } from 'node:fs/promises'
|
|
34
34
|
|
|
35
|
-
import { createCheckReporter } from '../../../scripts/
|
|
36
|
-
import { anyRunStepIncludes, parseWorkflowYaml } from '../../../scripts/
|
|
35
|
+
import { createCheckReporter } from '../../../scripts/lib/check-reporter.mjs'
|
|
36
|
+
import { anyRunStepIncludes, parseWorkflowYaml } from '../../../scripts/lib/gha-workflow.mjs'
|
|
37
37
|
|
|
38
38
|
/** Заголовок абзацу про апостроф у text.mdc / n-text.mdc. */
|
|
39
39
|
const UK_APOSTROPHE_HEADING = '**Український апостроф:**'
|
package/rules/text/lint/lint.mjs
CHANGED
|
@@ -19,9 +19,9 @@
|
|
|
19
19
|
*/
|
|
20
20
|
import { platform } from 'node:process'
|
|
21
21
|
|
|
22
|
-
import { runLintStep } from '../../../scripts/
|
|
22
|
+
import { runLintStep } from '../../../scripts/lib/run-lint-step.mjs'
|
|
23
23
|
import { resolveCmd } from '../../../scripts/utils/resolve-cmd.mjs'
|
|
24
|
-
import { runStandardLint } from '../../../scripts/
|
|
24
|
+
import { runStandardLint } from '../../../scripts/lib/run-standard-lint.mjs'
|
|
25
25
|
import { runDotenvLinter } from './run-dotenv-linter.mjs'
|
|
26
26
|
import { runShellcheckText } from './run-shellcheck.mjs'
|
|
27
27
|
import { runV8rWithGlobs } from './run-v8r.mjs'
|
package/rules/vue/fix.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { runStandardRule } from '../../scripts/
|
|
1
|
+
import { runStandardRule } from '../../scripts/lib/run-standard-rule.mjs'
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
4
|
* Запускає правило: applies → JS-concerns → policy → mdc-refs (через runStandardRule).
|
|
5
5
|
* Library mode: викликається CLI orchestration через `import + run(ctx)`.
|
|
6
|
-
* @param {import('../../scripts/
|
|
6
|
+
* @param {import('../../scripts/lib/run-standard-rule.mjs').RuleContext} [ctx] контекст прогону (walkCache тощо)
|
|
7
7
|
* @returns {Promise<number>} 0 — OK, 1 — порушення
|
|
8
8
|
*/
|
|
9
9
|
export function run(ctx) {
|
|
@@ -13,7 +13,7 @@ export function run(ctx) {
|
|
|
13
13
|
if (import.meta.main) {
|
|
14
14
|
// Standalone: bun rules/<id>/fix.mjs — повний еквівалент `npx @nitra/cursor fix <id>`
|
|
15
15
|
// (config-loading + whitelist + summary). Дві ролі fix.mjs: library (run) + standalone (main).
|
|
16
|
-
const { runRuleCli } = await import('../../scripts/
|
|
16
|
+
const { runRuleCli } = await import('../../scripts/lib/run-rule-cli.mjs')
|
|
17
17
|
// eslint-disable-next-line unicorn/no-process-exit -- standalone entry-point має повертати exit-code для CI/IDE
|
|
18
18
|
process.exit(await runRuleCli(import.meta.dirname))
|
|
19
19
|
}
|
|
@@ -25,16 +25,16 @@ import { existsSync } from 'node:fs'
|
|
|
25
25
|
import { readFile } from 'node:fs/promises'
|
|
26
26
|
import { join, relative } from 'node:path'
|
|
27
27
|
|
|
28
|
-
import { createCheckReporter } from '../../../scripts/
|
|
28
|
+
import { createCheckReporter } from '../../../scripts/lib/check-reporter.mjs'
|
|
29
29
|
import {
|
|
30
30
|
findForbiddenNodeImportsInVueFile,
|
|
31
31
|
findForbiddenVueImportsInSourceFile,
|
|
32
32
|
isVueImportScanSourceFile,
|
|
33
33
|
shouldSkipFileForVueImportScan
|
|
34
|
-
} from '../
|
|
35
|
-
import { loadCursorIgnorePaths } from '../../../scripts/
|
|
34
|
+
} from '../lib/vue-forbidden-imports.mjs'
|
|
35
|
+
import { loadCursorIgnorePaths } from '../../../scripts/lib/load-cursor-config.mjs'
|
|
36
36
|
import { walkDir } from '../../../scripts/utils/walkDir.mjs'
|
|
37
|
-
import { getMonorepoPackageRootDirs } from '../../../scripts/
|
|
37
|
+
import { getMonorepoPackageRootDirs } from '../../../scripts/lib/workspaces.mjs'
|
|
38
38
|
|
|
39
39
|
const ESBUILD_RE = /\besbuild\b/
|
|
40
40
|
|
package/scripts/auto-rules.mjs
CHANGED
|
@@ -16,13 +16,13 @@ import { existsSync } from 'node:fs'
|
|
|
16
16
|
import { readdir, readFile } from 'node:fs/promises'
|
|
17
17
|
import { basename, join, relative } from 'node:path'
|
|
18
18
|
|
|
19
|
-
import { textHasBunSqlImport } from '../rules/js-bun-db/
|
|
19
|
+
import { textHasBunSqlImport } from '../rules/js-bun-db/lib/bun-sql-scan.mjs'
|
|
20
20
|
import {
|
|
21
21
|
isGqlScanSourceFile,
|
|
22
22
|
shouldSkipFileForGqlScan,
|
|
23
23
|
sourceFileHasGqlTaggedTemplate
|
|
24
|
-
} from '../rules/graphql/
|
|
25
|
-
import { contentForVueImportScan } from '../rules/vue/
|
|
24
|
+
} from '../rules/graphql/lib/graphql-gql-scan.mjs'
|
|
25
|
+
import { contentForVueImportScan } from '../rules/vue/lib/vue-forbidden-imports.mjs'
|
|
26
26
|
|
|
27
27
|
/** Порядок автододавання правил відповідно до `rules/<rule>/auto.md`. */
|
|
28
28
|
export const AUTO_RULE_ORDER = Object.freeze([
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Використовуй `getExitCode()` у `return`, а не деструктуризацію `exitCode` — геттер «знімається» один раз.
|
|
8
8
|
*/
|
|
9
|
-
import { pass } from '
|
|
9
|
+
import { pass } from '../utils/pass.mjs'
|
|
10
10
|
|
|
11
11
|
/**
|
|
12
12
|
* Створює пару `pass` / `fail` з накопиченням ненульового коду виходу.
|
|
@@ -18,7 +18,7 @@ import { isAbsolute, join, normalize, relative, sep } from 'node:path'
|
|
|
18
18
|
import picomatch from 'picomatch'
|
|
19
19
|
|
|
20
20
|
import { loadCursorIgnorePaths } from './load-cursor-config.mjs'
|
|
21
|
-
import { walkDir } from '
|
|
21
|
+
import { walkDir } from '../utils/walkDir.mjs'
|
|
22
22
|
|
|
23
23
|
/** Узгоджений regex для path-traversal: `..` як сегмент або абсолютний шлях. */
|
|
24
24
|
const PARENT_SEGMENT_RE = /(^|[\\/])\.\.([\\/]|$)/u
|
|
@@ -20,7 +20,7 @@ import { tmpdir } from 'node:os'
|
|
|
20
20
|
import { dirname, join } from 'node:path'
|
|
21
21
|
import { fileURLToPath } from 'node:url'
|
|
22
22
|
|
|
23
|
-
import { resolveCmd } from '
|
|
23
|
+
import { resolveCmd } from '../utils/resolve-cmd.mjs'
|
|
24
24
|
|
|
25
25
|
/**
|
|
26
26
|
Каталог пакета `@nitra/cursor`, від якого ресолвимо вшиті директорії правил.
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*/
|
|
9
9
|
import { spawnSync } from 'node:child_process'
|
|
10
10
|
|
|
11
|
-
import { resolveCmd } from '
|
|
11
|
+
import { resolveCmd } from '../utils/resolve-cmd.mjs'
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Запускає один крок lint-обгортки: резолвить `cmd` у PATH і `spawnSync` із успадкованим stdio.
|
|
@@ -10,7 +10,7 @@ import { basename } from 'node:path'
|
|
|
10
10
|
|
|
11
11
|
import { isRuleEnabled, readNCursorConfigLite } from './read-n-cursor-config-lite.mjs'
|
|
12
12
|
import { runStandardRule } from './run-standard-rule.mjs'
|
|
13
|
-
import { getOrCreateWalkCache } from '
|
|
13
|
+
import { getOrCreateWalkCache } from '../utils/walk-cache.mjs'
|
|
14
14
|
|
|
15
15
|
const PACKAGE_NAME = '@nitra/cursor'
|
|
16
16
|
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
* Інтеграція з боку правила:
|
|
13
13
|
*
|
|
14
14
|
* ```js
|
|
15
|
-
* import { runStandardLint } from '../../../scripts/
|
|
15
|
+
* import { runStandardLint } from '../../../scripts/lib/run-standard-lint.mjs'
|
|
16
16
|
*
|
|
17
17
|
* async function runLintFooSteps() { ... }
|
|
18
18
|
*
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
*/
|
|
22
22
|
import { basename, dirname } from 'node:path'
|
|
23
23
|
|
|
24
|
-
import { withLock } from '
|
|
24
|
+
import { withLock } from '../utils/with-lock.mjs'
|
|
25
25
|
|
|
26
26
|
/**
|
|
27
27
|
* @param {string} lintDir абсолютний шлях до `rules/<id>/lint/` (передавай `import.meta.dirname`)
|
|
@@ -14,8 +14,8 @@ import { basename, dirname } from 'node:path'
|
|
|
14
14
|
|
|
15
15
|
import { discoverOneRule } from './discover-checkable-rules.mjs'
|
|
16
16
|
import { runRule } from './run-rule.mjs'
|
|
17
|
-
import { getOrCreateWalkCache } from '
|
|
18
|
-
import { withLock } from '
|
|
17
|
+
import { getOrCreateWalkCache } from '../utils/walk-cache.mjs'
|
|
18
|
+
import { withLock } from '../utils/with-lock.mjs'
|
|
19
19
|
|
|
20
20
|
/**
|
|
21
21
|
* @typedef {object} RuleContext
|
|
@@ -14,7 +14,7 @@ import { rename } from 'node:fs/promises'
|
|
|
14
14
|
import { cwd } from 'node:process'
|
|
15
15
|
import { relative, resolve } from 'node:path'
|
|
16
16
|
|
|
17
|
-
import { loadCursorIgnorePaths } from './
|
|
17
|
+
import { loadCursorIgnorePaths } from './lib/load-cursor-config.mjs'
|
|
18
18
|
import { walkDir } from './utils/walkDir.mjs'
|
|
19
19
|
|
|
20
20
|
const K8S_YML_RE = /\.yml$/iu
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|