@nitra/cursor 1.8.8 → 1.8.11

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/mdc/docker.mdc CHANGED
@@ -32,7 +32,7 @@ CLI **`hadolint`** приймає лише **явні шляхи** (`[DOCKERFILE
32
32
 
33
33
  Якщо правило **`docker`** підключено в **`.n-cursor.json`** (масив **`rules`**), у **кореневому** `package.json` **обов'язково** мають бути скрипт **`lint-docker`** і виклик **`bun run lint-docker`** у агрегованому **`lint`** (див. **`bun.mdc`**). Це перевіряє **`npx @nitra/cursor check bun`**.
34
34
 
35
- Додай workflow **`.github/workflows/lint-docker.yml`** (гілка **`dev`**, лише **`.yml`**, узгоджено з **`ga.mdc`**):
35
+ Додай workflow **`.github/workflows/lint-docker.yml`** (гілки **`dev`** і **`main`**, лише **`.yml`**, узгоджено з **`ga.mdc`**):
36
36
 
37
37
  ```yaml title=".github/workflows/lint-docker.yml"
38
38
  name: Lint Docker
@@ -41,6 +41,7 @@ on:
41
41
  push:
42
42
  branches:
43
43
  - dev
44
+ - main
44
45
  paths:
45
46
  - '**/Dockerfile'
46
47
  - '**/*.Dockerfile'
@@ -49,6 +50,7 @@ on:
49
50
  pull_request:
50
51
  branches:
51
52
  - dev
53
+ - main
52
54
 
53
55
  concurrency:
54
56
  group: ${{ github.ref }}-${{ github.workflow }}
package/mdc/ga.mdc CHANGED
@@ -79,12 +79,14 @@ on:
79
79
  push:
80
80
  branches:
81
81
  - dev
82
+ - main
82
83
  paths:
83
84
  - '.github/actions/**'
84
85
  - '.github/workflows/**'
85
86
  pull_request:
86
87
  branches:
87
88
  - dev
89
+ - main
88
90
 
89
91
  concurrency:
90
92
  group: ${{ github.ref }}-${{ github.workflow }}
@@ -116,6 +118,29 @@ jobs:
116
118
  }
117
119
  ```
118
120
 
121
+ **ЗАБОРОНЕНО** дублювати кроки встановлення Bun та кешування безпосередньо у workflow файлах. Завжди використовуй локальний composite action.
122
+
123
+ ### Приклад (НЕПРАВИЛЬНО)
124
+
125
+ ```yaml
126
+ steps:
127
+ - uses: actions/checkout@v6
128
+ - uses: oven-sh/setup-bun@v2
129
+ - uses: actions/cache@v5
130
+ # ... багато рядків кешування ...
131
+ - run: bun install --frozen-lockfile
132
+ ```
133
+
134
+ ### Приклад (ПРАВИЛЬНО)
135
+
136
+ ```yaml
137
+ steps:
138
+ - uses: actions/checkout@v6
139
+ with:
140
+ persist-credentials: false
141
+ - uses: ./.github/actions/setup-bun-deps
142
+ ```
143
+
119
144
  **Лінт:** [actionlint](https://github.com/rhysd/actionlint) через [node-actionlint](https://www.npmjs.com/package/node-actionlint); [zizmor](https://docs.zizmor.sh) — `uvx`, офлайн. Скрипт у корені:
120
145
 
121
146
  ```json title="package.json"
package/mdc/js-lint.mdc CHANGED
@@ -62,6 +62,7 @@ on:
62
62
  push:
63
63
  branches:
64
64
  - dev
65
+ - main
65
66
  paths:
66
67
  - '**/*.js'
67
68
  - '**/*.mjs'
@@ -75,6 +76,7 @@ on:
75
76
  pull_request:
76
77
  branches:
77
78
  - dev
79
+ - main
78
80
 
79
81
  concurrency:
80
82
  group: ${{ github.ref }}-${{ github.workflow }}
package/mdc/k8s.mdc CHANGED
@@ -46,7 +46,7 @@ alwaysApply: false
46
46
 
47
47
  Шлях до скрипта підстав свій (`./scripts/…` після копіювання, `node_modules/@nitra/cursor/scripts/…` якщо пакет у залежностях).
48
48
 
49
- Додай workflow **`.github/workflows/lint-k8s.yml`** (гілка **`dev`**, лише **`.yml`**, узгоджено з **`ga.mdc`**):
49
+ Додай workflow **`.github/workflows/lint-k8s.yml`** (гілки **`dev`** і **`main`**, лише **`.yml`**, узгоджено з **`ga.mdc`**):
50
50
 
51
51
  ```yaml title=".github/workflows/lint-k8s.yml"
52
52
  name: Lint K8s
@@ -55,12 +55,14 @@ on:
55
55
  push:
56
56
  branches:
57
57
  - dev
58
+ - main
58
59
  paths:
59
60
  - '**/k8s/**/*.yml'
60
61
 
61
62
  pull_request:
62
63
  branches:
63
64
  - dev
65
+ - main
64
66
 
65
67
  concurrency:
66
68
  group: ${{ github.ref }}-${{ github.workflow }}
@@ -55,6 +55,7 @@ on:
55
55
  push:
56
56
  branches:
57
57
  - dev
58
+ - main
58
59
  paths:
59
60
  - '**/*.css'
60
61
  - '**/*.scss'
@@ -63,6 +64,7 @@ on:
63
64
  pull_request:
64
65
  branches:
65
66
  - dev
67
+ - main
66
68
  paths:
67
69
  - '**/*.css'
68
70
  - '**/*.scss'
package/mdc/text.mdc CHANGED
@@ -71,6 +71,7 @@ on:
71
71
  push:
72
72
  branches:
73
73
  - dev
74
+ - main
74
75
  paths:
75
76
  - '**/*.js'
76
77
  - '**/*.ts'
@@ -96,6 +97,7 @@ on:
96
97
  pull_request:
97
98
  branches:
98
99
  - dev
100
+ - main
99
101
 
100
102
  concurrency:
101
103
  group: ${{ github.ref }}-${{ github.workflow }}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nitra/cursor",
3
- "version": "1.8.8",
3
+ "version": "1.8.11",
4
4
  "description": "CLI для завантаження cursor-правил (префікс n-) у локальний репозиторій",
5
5
  "keywords": [
6
6
  "cli",
@@ -3,8 +3,11 @@
3
3
  *
4
4
  * Workflows лише з розширенням `.yml`, наявність clean/lint workflow, конфіг zizmor з ref-pin,
5
5
  * відсутність MegaLinter, коректний скрипт `lint-ga` у `package.json`, виклик у `lint-ga.yml`,
6
- * наявність composite `.github/actions/setup-bun-deps/action.yml` (його записує `npx \@nitra/cursor`),
6
+ * наявність composite `.github/actions/setup-bun-deps/action.yml` (його записує npx `\@nitra/cursor`),
7
7
  * перед `uses: ./…/setup-bun-deps` у workflow — `actions/checkout` (runner інакше не бачить локальний action).
8
+ *
9
+ * Заборонено дублювати кроки встановлення Bun та кешування безпосередньо у workflow файлах
10
+ * (oven-sh/setup-bun, actions/cache, bun install).
8
11
  */
9
12
  import { existsSync } from 'node:fs'
10
13
  import { readdir, readFile } from 'node:fs/promises'
@@ -48,6 +51,33 @@ function verifyCheckoutBeforeLocalSetupBunDeps(relPath, content, failFn, passFn)
48
51
  passFn(`${relPath}: перед setup-bun-deps є checkout`)
49
52
  }
50
53
 
54
+ /**
55
+ * Перевіряє, чи не використовуються oven-sh/setup-bun або actions/cache безпосередньо у workflow.
56
+ * @param {string} relPath шлях для повідомлень
57
+ * @param {string} content вміст YAML
58
+ * @param {(msg: string) => void} failFn реєструє порушення (exit 1)
59
+ * @param {(msg: string) => void} passFn реєструє успішну перевірку
60
+ */
61
+ function verifyNoDirectBunOrCache(relPath, content, failFn, passFn) {
62
+ const forbidden = [
63
+ { pattern: 'oven-sh/setup-bun', msg: 'використовуй .github/actions/setup-bun-deps замість oven-sh/setup-bun' },
64
+ { pattern: 'actions/cache', msg: 'використовуй .github/actions/setup-bun-deps замість actions/cache' },
65
+ { pattern: 'bun install', msg: 'використовуй .github/actions/setup-bun-deps замість bun install' }
66
+ ]
67
+
68
+ let foundForbidden = false
69
+ for (const { pattern, msg } of forbidden) {
70
+ if (content.includes(pattern)) {
71
+ failFn(`${relPath}: ${msg} (ga.mdc)`)
72
+ foundForbidden = true
73
+ }
74
+ }
75
+
76
+ if (!foundForbidden) {
77
+ passFn(`${relPath}: не містить заборонених кроків setup-bun/cache/install`)
78
+ }
79
+ }
80
+
51
81
  /**
52
82
  * Перевіряє відповідність проєкту правилам ga.mdc
53
83
  * @returns {Promise<number>} 0 — все OK, 1 — є проблеми
@@ -142,6 +172,12 @@ export async function check() {
142
172
  pass('Залишків MegaLinter не виявлено')
143
173
  }
144
174
 
175
+ for (const f of ymlWorkflows) {
176
+ const content = await readFile(join(wfDir, f), 'utf8')
177
+ verifyCheckoutBeforeLocalSetupBunDeps(`${wfDir}/${f}`, content, fail, pass)
178
+ verifyNoDirectBunOrCache(`${wfDir}/${f}`, content, fail, pass)
179
+ }
180
+
145
181
  const zizmorPath = '.github/zizmor.yml'
146
182
  if (existsSync(zizmorPath)) {
147
183
  const z = await readFile(zizmorPath, 'utf8')
@@ -190,15 +226,6 @@ export async function check() {
190
226
  } else {
191
227
  fail('lint-ga.yml: додай astral-sh/setup-uv для uvx zizmor (ga.mdc)')
192
228
  }
193
- verifyCheckoutBeforeLocalSetupBunDeps(`${wfDir}/lint-ga.yml`, lgContent, fail, pass)
194
- }
195
-
196
- for (const wfName of ['lint-js.yml', 'lint-text.yml']) {
197
- const p = join(wfDir, wfName)
198
- if (existsSync(p)) {
199
- const body = await readFile(p, 'utf8')
200
- verifyCheckoutBeforeLocalSetupBunDeps(`${wfDir}/${wfName}`, body, fail, pass)
201
- }
202
229
  }
203
230
 
204
231
  return exitCode