@nitra/cursor 1.5.2 → 1.5.3

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/ga.mdc CHANGED
@@ -41,6 +41,9 @@ on:
41
41
  jobs:
42
42
  cleanup_old_workflows:
43
43
  runs-on: ubuntu-latest
44
+ permissions:
45
+ actions: write
46
+ contents: read
44
47
  steps:
45
48
  - name: Delete workflow runs
46
49
  uses: dmvict/clean-workflow-runs@v1.0.0
@@ -67,6 +70,8 @@ on:
67
70
  jobs:
68
71
  cleanup_old_branches:
69
72
  runs-on: ubuntu-latest
73
+ permissions:
74
+ contents: write
70
75
  steps:
71
76
  - id: delete_stuff
72
77
  name: Delete those pesky dead branches
@@ -78,11 +83,68 @@ jobs:
78
83
  dry_run: no
79
84
 
80
85
  - name: Get output
81
- run: "echo 'Deleted branches: ${{ steps.delete_stuff.outputs.deleted_branches }}'"
86
+ env:
87
+ DELETED_BRANCHES: ${{ steps.delete_stuff.outputs.deleted_branches }}
88
+ run: |
89
+ echo "Deleted branches: ${DELETED_BRANCHES}"
82
90
  ```
83
91
 
84
92
  якщо в ignore_branches задані інші бранчі, то це допустимо.
85
93
 
94
+ Повинен бути файл .github/workflows/lint-ga.yml, зі змістом:
95
+
96
+ ```yaml
97
+ name: Lint GA
98
+
99
+ on:
100
+ push:
101
+ branches:
102
+ - dev
103
+ paths:
104
+ - '.github/workflows/**'
105
+ - '.github/zizmor.yml'
106
+ - 'package.json'
107
+ - 'bun.lock'
108
+
109
+ pull_request:
110
+ branches:
111
+ - dev
112
+
113
+ concurrency:
114
+ group: ${{ github.ref }}-${{ github.workflow }}
115
+ cancel-in-progress: true
116
+
117
+ jobs:
118
+ lint-ga:
119
+ runs-on: ubuntu-latest
120
+ permissions:
121
+ contents: read
122
+ steps:
123
+ - uses: actions/checkout@v4
124
+ with:
125
+ persist-credentials: false
126
+
127
+ - uses: oven-sh/setup-bun@v2
128
+
129
+ - name: Cache Bun dependencies
130
+ uses: actions/cache@v4
131
+ with:
132
+ path: |
133
+ ~/.bun/install/cache
134
+ node_modules
135
+ key: ${{ runner.os }}-bun-${{ hashFiles('**/bun.lock') }}
136
+ restore-keys: |
137
+ ${{ runner.os }}-bun-
138
+
139
+ - name: Install dependencies
140
+ run: bun install --frozen-lockfile
141
+
142
+ - uses: astral-sh/setup-uv@v6
143
+
144
+ - name: Lint GA
145
+ run: bun run lint-ga
146
+ ```
147
+
86
148
  в файлі .vscode/extensions.json є налаштування для GitHub Actions:
87
149
 
88
150
  ```json title=".vscode/extensions.json"
@@ -91,6 +153,29 @@ jobs:
91
153
  }
92
154
  ```
93
155
 
156
+ ## actionlint
157
+
158
+ Статична перевірка синтаксису та виразів GitHub Actions: [actionlint](https://github.com/rhysd/actionlint).
159
+
160
+ У кореневому `package.json` у скрипті `lint-ga` викликай **actionlint** через **`bunx node-actionlint`** (пакет [node-actionlint](https://www.npmjs.com/package/node-actionlint) постає бінарник actionlint для Node-екосистеми).
161
+
162
+ ## zizmor
163
+
164
+ Статичний аналіз безпеки для GitHub Actions: [zizmor documentation](https://docs.zizmor.sh).
165
+
166
+ У кореневому `package.json` має бути скрипт:
167
+
168
+ ```json title="package.json"
169
+ "scripts": {
170
+ "lint-ga": "bunx node-actionlint && uvx zizmor --offline --collect=workflows ."
171
+ }
172
+ ```
173
+
174
+ Параметр `--offline` обмежує аналіз офлайн-аудитами (без GitHub API);
175
+
176
+ За замовчуванням audit [unpinned-uses](https://docs.zizmor.sh/audits/#unpinned-uses) вимагає повний commit SHA для кожного `uses:`. У всих проєктах прийняті **семантичні теги** (`@v4`, `@v2` тощо), додай `.github/zizmor.yml` з політикою `ref-pin` (приклад у цьому репозиторії).
177
+
94
178
  ## Перевірка
95
179
 
96
- `npx @nitra/cursor check ga`
180
+ - `bun run lint-ga` — actionlint (node-actionlint) і zizmor
181
+ - `npx @nitra/cursor check ga`
package/mdc/js-lint.mdc CHANGED
@@ -25,7 +25,7 @@ version: '1.4'
25
25
  "lint-js": "oxlint --fix && bunx eslint --fix . && bunx jscpd ."
26
26
  },
27
27
  "devDependencies": {
28
- "@nitra/eslint-config": "^3.3.0"
28
+ "@nitra/eslint-config": "^3.4.0"
29
29
  }
30
30
  ```
31
31
 
@@ -74,8 +74,12 @@ concurrency:
74
74
  jobs:
75
75
  eslint:
76
76
  runs-on: ubuntu-latest
77
+ permissions:
78
+ contents: read
77
79
  steps:
78
80
  - uses: actions/checkout@v4
81
+ with:
82
+ persist-credentials: false
79
83
 
80
84
  - uses: oven-sh/setup-bun@v2
81
85
 
package/mdc/text.mdc CHANGED
@@ -118,8 +118,12 @@ concurrency:
118
118
  jobs:
119
119
  text:
120
120
  runs-on: ubuntu-latest
121
+ permissions:
122
+ contents: read
121
123
  steps:
122
124
  - uses: actions/checkout@v4
125
+ with:
126
+ persist-credentials: false
123
127
 
124
128
  - uses: oven-sh/setup-bun@v2
125
129
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nitra/cursor",
3
- "version": "1.5.2",
3
+ "version": "1.5.3",
4
4
  "description": "CLI для завантаження cursor-правил (префікс n-) у локальний репозиторій",
5
5
  "keywords": [
6
6
  "cli",
@@ -25,6 +25,7 @@
25
25
  "files": [
26
26
  "mdc",
27
27
  "bin",
28
+ "schemas",
28
29
  "scripts",
29
30
  "skills",
30
31
  "AGENTS.template.md"
@@ -0,0 +1,27 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://unpkg.com/@nitra/cursor/schemas/n-cursor.json",
4
+ "title": "n-cursor project config",
5
+ "description": "Конфігурація правил і skills для CLI @nitra/cursor (файл .n-cursor.json у корені репозиторію).",
6
+ "type": "object",
7
+ "additionalProperties": true,
8
+ "properties": {
9
+ "rules": {
10
+ "type": "array",
11
+ "description": "Ідентифікатори правил без префікса n- (відповідають файлам n-<id>.mdc).",
12
+ "items": {
13
+ "type": "string",
14
+ "minLength": 1
15
+ }
16
+ },
17
+ "skills": {
18
+ "type": "array",
19
+ "description": "Ідентифікатори skills без префікса n- (каталог .cursor/skills).",
20
+ "items": {
21
+ "type": "string",
22
+ "minLength": 1
23
+ }
24
+ }
25
+ },
26
+ "required": ["rules", "skills"]
27
+ }
@@ -30,7 +30,7 @@ export async function check() {
30
30
  pass('Всі workflows мають розширення .yml')
31
31
  }
32
32
 
33
- for (const f of ['clean-ga-workflows.yml', 'clean-merged-branch.yml']) {
33
+ for (const f of ['clean-ga-workflows.yml', 'clean-merged-branch.yml', 'lint-ga.yml']) {
34
34
  if (files.includes(f)) {
35
35
  pass(`${f} існує`)
36
36
  } else {
@@ -33,9 +33,7 @@ export async function check() {
33
33
  fail('lint-js має викликати jscpd — додай "&& bunx jscpd ." у кінець скрипта')
34
34
  }
35
35
  } else {
36
- fail(
37
- 'package.json не містить скрипт "lint-js" — додай: "oxlint --fix && bunx eslint --fix . && bunx jscpd ."'
38
- )
36
+ fail('package.json не містить скрипт "lint-js" — додай: "oxlint --fix && bunx eslint --fix . && bunx jscpd ."')
39
37
  }
40
38
 
41
39
  if (pkg.devDependencies?.['@nitra/eslint-config']) {