@nitra/cursor
Advanced tools
+1
-1
| { | ||
| "name": "@nitra/cursor", | ||
| "version": "11.2.0", | ||
| "version": "11.3.0", | ||
| "description": "CLI для завантаження cursor-правил (префікс n-) у локальний репозиторій", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -101,9 +101,10 @@ /** | ||
| * @param {string} [cwd] корінь репо | ||
| * @param {{ readOnly?: boolean }} [opts] readOnly: лише детект (CI/hook), без мутацій/LLM | ||
| * @param {{ readOnly?: boolean, llmFix?: boolean }} [opts] readOnly: лише детект (CI/hook); | ||
| * llmFix: opt-in opportunistic-генерація (з `meta.json: llmFix:true`) — без нього detect-only | ||
| * @returns {Promise<number>} 0 — доки свіжі; 1 — є застарілі (детект, fix пропущено чи помилка генерації) | ||
| */ | ||
| export async function lint(files, cwd = process.cwd(), { readOnly = false } = {}) { | ||
| export async function lint(files, cwd = process.cwd(), { readOnly = false, llmFix = false } = {}) { | ||
| const stale = collectStale(files, cwd) | ||
| if (stale.length === 0) return 0 | ||
| if (readOnly) return reportStale(stale) | ||
| if (readOnly || !llmFix) return reportStale(stale) | ||
@@ -110,0 +111,0 @@ // fix-by-default: opportunistic-генерація через спільне ядро (preflight omlx → |
@@ -111,3 +111,4 @@ /** | ||
| const ids = selectLintRules(readAllMeta(rulesDir), full) | ||
| const metaById = readAllMeta(rulesDir) | ||
| const ids = selectLintRules(metaById, full) | ||
| for (const id of ids) { | ||
@@ -119,4 +120,11 @@ const lintPath = join(rulesDir, id, 'js', 'lint.mjs') | ||
| } | ||
| // lintPath = join(rulesDir, id, …) — суто package-internal (rulesDir пакета + id зі | ||
| // selectLintRules за власним meta), не зовнішній вхід → ін'єкції немає. | ||
| // eslint-disable-next-line no-unsanitized/method | ||
| const mod = await import(lintPath) | ||
| const code = await mod.lint(changed, cwd, { readOnly }) | ||
| // `llmFix` (opt-in opportunistic LLM-fix, спека 2026-06-15): лише правила з | ||
| // `meta.json: llmFix:true` отримують fix-сходинку; решта — detect-only. Це й | ||
| // забезпечує safety-тріаж (логічні лінтери не вмикають LLM-fix випадково). | ||
| const llmFix = metaById[id]?.llmFix === true | ||
| const code = await mod.lint(changed, cwd, { readOnly, llmFix }) | ||
| if (code !== 0) return code | ||
@@ -123,0 +131,0 @@ } |
@@ -9,7 +9,8 @@ /** | ||
| * @param {string} [_cwd] корінь (ігнорується — CLI працює від process.cwd()) | ||
| * @param {{ readOnly?: boolean }} [opts] readOnly → детект без авто-фіксу (нуль мутацій) | ||
| * @param {{ readOnly?: boolean, llmFix?: boolean }} [opts] readOnly → детект без авто-фіксу (нуль мутацій); | ||
| * llmFix → opt-in omlx-класифікація cspell (з `meta.json: llmFix:true`) | ||
| * @returns {Promise<number>} exit code | ||
| */ | ||
| export function lint(_files, _cwd, opts = {}) { | ||
| return runLintTextCli({ readOnly: opts.readOnly === true }) | ||
| return runLintTextCli({ readOnly: opts.readOnly === true, llmFix: opts.llmFix === true }) | ||
| } |
@@ -116,5 +116,6 @@ /** | ||
| * @param {boolean} [readOnly] true → лише детект (нуль мутацій) | ||
| * @param {boolean} [llmFix] opt-in omlx-класифікація (з `meta.json: llmFix:true`); без нього — лише детект | ||
| * @returns {number} 0 — чисто; 1 — лишились знахідки / помилка середовища | ||
| */ | ||
| export function runCspellText(cwd = process.cwd(), readOnly = false) { | ||
| export function runCspellText(cwd = process.cwd(), readOnly = false, llmFix = false) { | ||
| const bin = resolveCmd('npx') | ||
@@ -128,3 +129,3 @@ if (!bin) { | ||
| if (first.code === 0) return 0 | ||
| if (readOnly) { | ||
| if (readOnly || !llmFix) { | ||
| process.stdout.write(first.out) | ||
@@ -131,0 +132,0 @@ return first.code |
@@ -100,5 +100,6 @@ /** | ||
| * @param {boolean} [readOnly] true → лише детект без авто-фіксу (нуль мутацій — CI/pre-commit) | ||
| * @param {boolean} [llmFix] opt-in omlx-класифікація cspell (інші кроки фіксяться детерміновано за readOnly) | ||
| * @returns {number} 0 — все OK, інакше — код першого кроку, що впав | ||
| */ | ||
| function runLintTextSteps(readOnly = false) { | ||
| function runLintTextSteps(readOnly = false, llmFix = false) { | ||
| // Auto-install: throws on failure → propagates as exit 1 from runStandardLint | ||
@@ -111,4 +112,4 @@ ensureTool('shellcheck') | ||
| console.log(`\n▶ cspell (${readOnly ? 'перевірка' : 'omlx-автофікс одруків + перевірка'})`) | ||
| const cspellCode = runCspellText(process.cwd(), readOnly) | ||
| console.log(`\n▶ cspell (${!readOnly && llmFix ? 'omlx-класифікація + словник + перевірка' : 'перевірка'})`) | ||
| const cspellCode = runCspellText(process.cwd(), readOnly, llmFix) | ||
| if (cspellCode !== 0) return cspellCode | ||
@@ -134,6 +135,7 @@ | ||
| * Публічна CLI-форма: серіалізує через `withLock('lint-text')` + дедуп за станом git-дерева. | ||
| * @param {{ readOnly?: boolean }} [opts] readOnly → детект без авто-фіксу | ||
| * @param {{ readOnly?: boolean, llmFix?: boolean }} [opts] readOnly → детект без авто-фіксу; | ||
| * llmFix → omlx-класифікація cspell (opt-in із `meta.json: llmFix:true`) | ||
| * @returns {Promise<number>} код виходу | ||
| */ | ||
| export const runLintTextCli = (opts = {}) => | ||
| runStandardLint(import.meta.dirname, () => runLintTextSteps(opts.readOnly === true)) | ||
| runStandardLint(import.meta.dirname, () => runLintTextSteps(opts.readOnly === true, opts.llmFix === true)) |
@@ -1,1 +0,1 @@ | ||
| { "auto": "завжди", "lint": "per-file" } | ||
| { "auto": "завжди", "lint": "per-file", "llmFix": true } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
4575834
0.06%37137
0.04%