@nitra/cursor 3.18.2 → 3.20.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.
Files changed (31) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/bin/n-cursor.js +12 -0
  3. package/package.json +1 -1
  4. package/rules/docker/docker.mdc +3 -3
  5. package/rules/docker/js/lint.mjs +1 -1
  6. package/rules/docker/lib/docker-hadolint.mjs +27 -55
  7. package/rules/ga/lint/lint.mjs +18 -54
  8. package/rules/image-compress/meta.json +1 -1
  9. package/rules/k8s/lint/lint.mjs +3 -10
  10. package/rules/nginx-default-tpl/js/template.mjs +39 -1
  11. package/rules/nginx-default-tpl/nginx-default-tpl.mdc +3 -1
  12. package/rules/npm-module/js/package_structure.mjs +40 -9
  13. package/rules/npm-module/npm-module.mdc +1 -1
  14. package/rules/npm-module/policy/npm_publish_yml/target.json +1 -0
  15. package/rules/rego/lint/lint.mjs +10 -55
  16. package/rules/text/lint/lint.mjs +11 -40
  17. package/rules/worktree/policy/vscode_settings/target.json +5 -0
  18. package/rules/worktree/policy/vscode_settings/template/settings.json.snippet.json +8 -0
  19. package/rules/worktree/policy/zed_settings/target.json +5 -0
  20. package/rules/worktree/policy/zed_settings/template/settings.json.snippet.json +12 -0
  21. package/rules/worktree/worktree.mdc +52 -0
  22. package/schemas/target.json +5 -0
  23. package/scripts/lib/assert-project-root.mjs +74 -0
  24. package/scripts/lib/ensure-tool.mjs +352 -0
  25. package/scripts/lib/run-conftest-batch.mjs +6 -28
  26. package/scripts/lib/run-rule.mjs +61 -5
  27. package/scripts/lib/template.mjs +29 -3
  28. package/scripts/lib/worktree-notice.mjs +52 -1
  29. package/skills/fix/SKILL.md +4 -4
  30. package/types/bin/n-cursor.d.ts +1 -1
  31. package/rules/npm-module/policy/npm_publish_yml/npm_publish_yml.rego +0 -87
@@ -12,10 +12,10 @@ description: >-
12
12
 
13
13
  ## Workflow
14
14
 
15
- 1. **Діагностика** — запусти перевірку (за замовчуванням лише правила з `.cursor/rules/*.mdc`, для яких у пакеті є programmatic check; повний набір — явні аргументи: `npx @nitra/cursor fix bun ga …`):
15
+ 1. **Діагностика** — запусти перевірку через retry-обгортку `n_cursor_npx` (визначена у worktree-preflight, крок 0.1: переживає транзитну CDN-гонку щойно опублікованої версії, а реальний `❌` від `fix` віддає одразу). За замовчуванням лише правила з `.cursor/rules/*.mdc`, для яких у пакеті є programmatic check; повний набір — явні аргументи: `n_cursor_npx fix bun ga …`:
16
16
 
17
17
  ```bash
18
- npx @nitra/cursor fix
18
+ n_cursor_npx fix
19
19
  ```
20
20
 
21
21
  2. **Аналіз** — зчитай вивід, знайди всі `❌` та визнач які правила порушено
@@ -40,10 +40,10 @@ bun i
40
40
  oxfmt .
41
41
  ```
42
42
 
43
- 6. **Верифікація** — перевір що все виправлено:
43
+ 6. **Верифікація** — перевір що все виправлено (та сама retry-обгортка `n_cursor_npx`):
44
44
 
45
45
  ```bash
46
- npx @nitra/cursor fix
46
+ n_cursor_npx fix
47
47
  ```
48
48
 
49
49
  7. **Результат** — всі `❌` від `npx @nitra/cursor fix` мають стати `✅`. Якщо залишились `❌` — повтори кроки 3-6. Лінт-помилки від `bun run lint` тут **не виправляй** — вони на скіл `/n-lint`.
@@ -1,2 +1,2 @@
1
1
  #!/usr/bin/env node
2
- export {}
2
+ export {};
@@ -1,87 +0,0 @@
1
- # Перевірка `.github/workflows/npm-publish.yml` (npm-module.mdc).
2
- #
3
- # Канон надходить через --data: { "template": { "snippet": ... } }
4
- # Структура --data сформована з template/npm-publish.yml.snippet.yml.
5
- # Per-concern field-by-field: path/substring-маркери з expected_uses_set читаються
6
- # зі steps template, експектації branches/paths — subset-of.
7
- #
8
- # Універсальні workflow-перевірки (concurrency, заборонені setup-bun/cache/install,
9
- # shell line-continuation) — у `ga.workflow_common`.
10
- package npm_module.npm_publish_yml
11
-
12
- import rego.v1
13
-
14
- # YAML 1.1 quirk: ключ `on:` → boolean true → у конфтесті ключ "true".
15
- gha_on := input["true"]
16
-
17
- # Required marker — substring у `uses` для ідентифікації npm-publish кроку.
18
- publish_action_marker := "JS-DevTools/npm-publish"
19
-
20
- # Очікувані літерали з template.
21
- expected_paths := {p | some p in data.template.snippet.on.push.paths}
22
-
23
- expected_branches := {b | some b in data.template.snippet.on.push.branches}
24
-
25
- expected_permissions := data.template.snippet.jobs["release-publish"].permissions
26
-
27
- # Required publish-step (за маркером): expected `with.package` value з template.
28
- expected_publish_with_package := s.with.package if {
29
- some s in data.template.snippet.jobs["release-publish"].steps
30
- contains(object.get(s, "uses", ""), publish_action_marker)
31
- }
32
-
33
- # ── deny: paths містить кожне з expected_paths (subset-of) ───────────────
34
-
35
- deny contains msg if {
36
- some required_path in expected_paths
37
- not path_present(required_path)
38
- msg := sprintf("npm-publish.yml: у on.push.paths має бути `%s` (npm-module.mdc)", [required_path])
39
- }
40
-
41
- # ── deny: branches містить кожне з expected_branches (subset-of) ─────────
42
-
43
- deny contains msg if {
44
- some required_branch in expected_branches
45
- not required_branch in {b | some b in gha_on.push.branches}
46
- msg := sprintf("npm-publish.yml: on.push.branches має містити `%s` (npm-module.mdc)", [required_branch])
47
- }
48
-
49
- # ── deny: id-token: write у permissions хоч одного job ────────────────────
50
-
51
- deny contains msg if {
52
- required := expected_permissions["id-token"]
53
- not any_job_has_id_token(required)
54
- msg := sprintf("npm-publish.yml: permissions має містити `id-token: %s` (OIDC) (npm-module.mdc)", [required])
55
- }
56
-
57
- # ── deny: крок з uses-маркером npm-publish та канонічним with.package ────
58
-
59
- deny contains msg if {
60
- not has_npm_publish_step
61
- msg := sprintf(
62
- "npm-publish.yml: очікується `uses: %s` з `with.package: %s` (npm-module.mdc)",
63
- [publish_action_marker, expected_publish_with_package],
64
- )
65
- }
66
-
67
- # ── helpers ────────────────────────────────────────────────────────────────
68
-
69
- # Path присутній, якщо хоч один шлях у actual містить required як substring
70
- # (npm/** glob у workflow може бути записаний як `npm/**` або `'npm/**'`).
71
- path_present(required) if {
72
- some p in gha_on.push.paths
73
- is_string(p)
74
- contains(p, required)
75
- }
76
-
77
- any_job_has_id_token(required) if {
78
- some job in object.get(input, "jobs", {})
79
- job.permissions["id-token"] == required
80
- }
81
-
82
- has_npm_publish_step if {
83
- some job in object.get(input, "jobs", {})
84
- some step in object.get(job, "steps", [])
85
- contains(object.get(step, "uses", ""), publish_action_marker)
86
- step.with.package == expected_publish_with_package
87
- }