@nitra/cursor 1.13.82 → 1.13.83
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 +19 -0
- package/README.md +5 -5
- package/bin/n-cursor.js +16 -21
- package/package.json +1 -1
- package/rules/abie/abie.mdc +8 -8
- package/rules/abie/fix.mjs +15 -0
- package/rules/abie/policy/base_deployment_preem/base_deployment_preem.rego +2 -2
- package/rules/abie/policy/health_check_policy/health_check_policy.rego +2 -2
- package/rules/abie/policy/http_route_base/http_route_base.rego +1 -1
- package/rules/abie/utils/k8s-tree.mjs +1 -1
- package/rules/adr/adr.mdc +1 -1
- package/rules/adr/fix.mjs +15 -0
- package/rules/bun/fix.mjs +15 -0
- package/rules/capacitor/fix.mjs +15 -0
- package/rules/changelog/changelog.mdc +1 -1
- package/rules/changelog/fix.mjs +15 -0
- package/rules/ci4/fix.mjs +15 -0
- package/rules/docker/docker.mdc +3 -3
- package/rules/docker/fix.mjs +15 -0
- package/rules/docker/lint/lint.mjs +2 -2
- package/rules/efes/fix.mjs +15 -0
- package/rules/feedback/fix.mjs +15 -0
- package/rules/ga/fix.mjs +15 -0
- package/rules/ga/lint/lint.mjs +1 -1
- package/rules/graphql/fix.mjs +15 -0
- package/rules/graphql/{fix → js}/tooling/graphql-gql-scan.mjs +1 -1
- package/rules/hasura/fix.mjs +15 -0
- package/rules/hasura/policy/svc_hl/svc_hl.rego +1 -1
- package/rules/image-avif/fix.mjs +15 -0
- package/rules/image-compress/fix.mjs +15 -0
- package/rules/js-bun-db/fix.mjs +15 -0
- package/rules/js-bun-redis/fix.mjs +15 -0
- package/rules/js-bun-redis/policy/package_json/package_json.rego +1 -1
- package/rules/js-lint/fix.mjs +15 -0
- package/rules/js-lint/{fix → js}/tooling/check.mjs +3 -3
- package/rules/js-lint/{fix → js}/tooling/rebuild-oxlint-canonical.mjs +1 -1
- package/rules/js-lint/js-lint.mdc +2 -2
- package/rules/js-mssql/fix.mjs +15 -0
- package/rules/js-run/fix.mjs +15 -0
- package/rules/k8s/fix.mjs +15 -0
- package/rules/k8s/k8s.mdc +1 -1
- package/rules/nginx-default-tpl/fix.mjs +15 -0
- package/rules/nginx-default-tpl/{fix → js}/template/check.mjs +1 -1
- package/rules/npm-module/fix.mjs +15 -0
- package/rules/npm-module/{fix → js}/package_structure/check.mjs +1 -1
- package/rules/php/fix.mjs +15 -0
- package/rules/rego/fix.mjs +15 -0
- package/rules/security/fix.mjs +15 -0
- package/rules/security/security.mdc +2 -2
- package/rules/style-lint/fix.mjs +15 -0
- package/rules/tauri/fix.mjs +15 -0
- package/rules/test/fix.mjs +15 -0
- package/rules/test/test.mdc +1 -1
- package/rules/text/fix.mjs +15 -0
- package/rules/vue/fix.mjs +15 -0
- package/rules/vue/vue.mdc +1 -1
- package/scripts/auto-rules.mjs +3 -3
- package/scripts/sync-claude-config.mjs +2 -2
- package/scripts/utils/ast-scan-utils.mjs +3 -3
- package/scripts/utils/discover-checkable-rules.mjs +30 -18
- package/scripts/utils/list-rule-ids.mjs +23 -0
- package/scripts/utils/run-rule.mjs +7 -7
- package/scripts/utils/run-standard-rule.mjs +34 -0
- package/scripts/utils/walk-cache.mjs +24 -0
- package/scripts/utils/workspaces.mjs +1 -1
- /package/rules/abie/{fix → js}/applies/check.mjs +0 -0
- /package/rules/abie/{fix → js}/env_dns/check.mjs +0 -0
- /package/rules/abie/{fix → js}/firebase_hosting/check.mjs +0 -0
- /package/rules/abie/{fix → js}/hc_pairing/check.mjs +0 -0
- /package/rules/abie/{fix → js}/ua_http_route/check.mjs +0 -0
- /package/rules/abie/{fix → js}/ua_node_selector/check.mjs +0 -0
- /package/rules/adr/{fix → js}/hooks/check.mjs +0 -0
- /package/rules/adr/{fix → js}/hooks/template/.gitignore.snippet +0 -0
- /package/rules/bun/{fix → js}/layout/check.mjs +0 -0
- /package/rules/capacitor/{fix → js}/platforms/check.mjs +0 -0
- /package/rules/changelog/{fix → js}/consistency/check.mjs +0 -0
- /package/rules/changelog/{fix → js}/consistency/package-manifest.mjs +0 -0
- /package/rules/docker/{fix → js}/lint/check.mjs +0 -0
- /package/rules/docker/{fix → js}/lint/docker-hadolint.mjs +0 -0
- /package/rules/docker/{fix → js}/lint/docker-mirror.mjs +0 -0
- /package/rules/ga/{fix → js}/workflows/check.mjs +0 -0
- /package/rules/graphql/{fix → js}/tooling/check.mjs +0 -0
- /package/rules/hasura/{fix → js}/internal_urls/check.mjs +0 -0
- /package/rules/image-avif/{fix → js}/avif_generation/check.mjs +0 -0
- /package/rules/image-compress/{fix → js}/package_setup/check.mjs +0 -0
- /package/rules/js-bun-db/{fix → js}/safety/bun-sql-scan.mjs +0 -0
- /package/rules/js-bun-db/{fix → js}/safety/check.mjs +0 -0
- /package/rules/js-bun-redis/{fix → js}/imports/check.mjs +0 -0
- /package/rules/js-lint/{fix → js}/tooling/knip-canonical.json +0 -0
- /package/rules/js-lint/{fix → js}/tooling/oxlint-canonical-skeleton.json +0 -0
- /package/rules/js-lint/{fix → js}/tooling/oxlint-canonical.json +0 -0
- /package/rules/js-lint/{fix → js}/tooling/oxlint-rules.tsv +0 -0
- /package/rules/js-mssql/{fix → js}/deps/check.mjs +0 -0
- /package/rules/js-mssql/{fix → js}/deps/mssql-pool-scan.mjs +0 -0
- /package/rules/js-run/{fix → js}/runtime/bunyan-imports.mjs +0 -0
- /package/rules/js-run/{fix → js}/runtime/check-env-scan.mjs +0 -0
- /package/rules/js-run/{fix → js}/runtime/check.mjs +0 -0
- /package/rules/js-run/{fix → js}/runtime/conn-file-rules.mjs +0 -0
- /package/rules/js-run/{fix → js}/runtime/conn-imports-scan.mjs +0 -0
- /package/rules/js-run/{fix → js}/runtime/promise-settimeout-scan.mjs +0 -0
- /package/rules/k8s/{fix → js}/kubescape_exceptions/template/.kubescape-exceptions.json.snippet.json +0 -0
- /package/rules/k8s/{fix → js}/manifests/check.mjs +0 -0
- /package/rules/php/{fix → js}/tooling/check.mjs +0 -0
- /package/rules/rego/{fix → js}/applies/check.mjs +0 -0
- /package/rules/security/{fix → js}/sample_secret/check.mjs +0 -0
- /package/rules/security/{fix → js}/trufflehog/check.mjs +0 -0
- /package/rules/security/{fix → js}/trufflehog/template/.trufflehog-exclude.snippet.txt +0 -0
- /package/rules/style-lint/{fix → js}/tooling/check.mjs +0 -0
- /package/rules/tauri/{fix → js}/tooling/check.mjs +0 -0
- /package/rules/test/{fix → js}/location/check.mjs +0 -0
- /package/rules/text/{fix → js}/formatting/check.mjs +0 -0
- /package/rules/vue/{fix → js}/packages/check.mjs +0 -0
- /package/rules/vue/{fix → js}/packages/vue-forbidden-imports.mjs +0 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public API per-rule orchestration. Викликається з `rules/<id>/fix.mjs`.
|
|
3
|
+
*
|
|
4
|
+
* Інкапсулює: `discoverOneRule` → `runRule(applies → JS → policy → mdc-refs)`.
|
|
5
|
+
* Локальна логіка в правилах заборонена; розширення поведінки — через `ctx`-опції.
|
|
6
|
+
*/
|
|
7
|
+
import { basename, dirname } from 'node:path'
|
|
8
|
+
|
|
9
|
+
import { discoverOneRule } from './discover-checkable-rules.mjs'
|
|
10
|
+
import { runRule } from './run-rule.mjs'
|
|
11
|
+
import { getOrCreateWalkCache } from './walk-cache.mjs'
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* @typedef {object} RuleContext
|
|
15
|
+
* @property {Map<string, Promise<string[]>>} [walkCache] FS-walk cache між concerns одного прогону
|
|
16
|
+
*
|
|
17
|
+
* Зарезервовано на майбутнє (поки не реалізовано — додається, коли з'явиться потреба):
|
|
18
|
+
* - `skipMdcRefs`, `skipApplies`, `onlyConcerns`.
|
|
19
|
+
* Розширення поведінки правила робиться лише через нові поля тут, не через локальну
|
|
20
|
+
* логіку в `rules/<id>/fix.mjs`.
|
|
21
|
+
*/
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @param {string} ruleDir абсолютний шлях до `rules/<id>/`
|
|
25
|
+
* @param {RuleContext} [ctx] контекст прогону (walkCache тощо)
|
|
26
|
+
* @returns {Promise<number>} 0 OK, 1 violations
|
|
27
|
+
*/
|
|
28
|
+
export async function runStandardRule(ruleDir, ctx = {}) {
|
|
29
|
+
const ruleId = basename(ruleDir)
|
|
30
|
+
const bundledRulesDir = dirname(ruleDir)
|
|
31
|
+
const rule = await discoverOneRule(ruleDir, ruleId)
|
|
32
|
+
const walkCache = ctx.walkCache ?? getOrCreateWalkCache()
|
|
33
|
+
return runRule(rule, bundledRulesDir, walkCache)
|
|
34
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Module-singleton FS-walk cache, спільний для всіх concerns одного `check`-прогону.
|
|
3
|
+
* Ключі — рядкові glob/regex дескриптори; значення — `Promise<string[]>` зі списком файлів.
|
|
4
|
+
* Кеш живий у межах одного процесу (Node/Bun module-instance). Тести скидають через `resetWalkCache()`.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
/** @type {Map<string, Promise<string[]>> | null} */
|
|
8
|
+
let cache = null
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Повертає поточний cache; lazy-ініціалізує при першому виклику.
|
|
12
|
+
* @returns {Map<string, Promise<string[]>>} module-singleton walk cache
|
|
13
|
+
*/
|
|
14
|
+
export function getOrCreateWalkCache() {
|
|
15
|
+
if (cache === null) cache = new Map()
|
|
16
|
+
return cache
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Скидає cache (для тестів між кейсами).
|
|
21
|
+
*/
|
|
22
|
+
export function resetWalkCache() {
|
|
23
|
+
cache = new Map()
|
|
24
|
+
}
|
|
@@ -11,7 +11,7 @@ import { dirname, join, relative } from 'node:path'
|
|
|
11
11
|
const TRAILING_SLASH_RE = /\/$/
|
|
12
12
|
const LEADING_DOTSLASH_RE = /^\.\//
|
|
13
13
|
|
|
14
|
-
/** Glob-ігнор для workspace-патернів із `*` (узгоджено з `rules/changelog/
|
|
14
|
+
/** Glob-ігнор для workspace-патернів із `*` (узгоджено з `rules/changelog/js/consistency/package-manifest.mjs`). */
|
|
15
15
|
export const WORKSPACE_GLOB_IGNORE = Object.freeze(['**/node_modules/**', '**/.git/**', '**/.venv/**', '**/venv/**'])
|
|
16
16
|
|
|
17
17
|
/**
|
|
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
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
/package/rules/k8s/{fix → js}/kubescape_exceptions/template/.kubescape-exceptions.json.snippet.json
RENAMED
|
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
|