@kirill.konshin/lint 0.4.4 → 0.4.6

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kirill.konshin/lint",
3
3
  "description": "ESLint + Prettier + lint-staged config and AI agent rules/skills for monorepos",
4
- "version": "0.4.4",
4
+ "version": "0.4.6",
5
5
  "type": "module",
6
6
  "skipGenerate": true,
7
7
  "bin": {
package/rules/db.md ADDED
@@ -0,0 +1,28 @@
1
+ ---
2
+ type: always_apply
3
+ description: Database persistence and migration rules
4
+ ---
5
+
6
+ # IndexedDB
7
+
8
+ - Use Dexie for browser-owned IndexedDB data.
9
+ - Do not keep IndexedDB as a second authority after migrating data to a server database.
10
+
11
+ # Postgres
12
+
13
+ - Use Neon Postgres with Drizzle and checked-in generated migrations.
14
+ - Prefer Neon HTTP for simple stateless operations; use the pooled serverless driver for transactions, migrations, and connection-oriented work.
15
+ - Keep schemas, repositories, tenancy, and authorization app-owned; keep reusable driver plumbing in `@kirill.konshin/db`.
16
+ - Import `@kirill.konshin/db` through focused driver, migration, URL, and type subpaths so unrelated drivers are not loaded.
17
+ - Keep database access server-only and separate the database/repository layer from API, UI, and state-management layers.
18
+ - Preserve canonical external identifiers as strings; never coerce opaque IDs or URNs to numbers.
19
+ - Model related state once per owner and entity when that avoids duplicate rows, and enforce invariants with keys, constraints, and indexes.
20
+ - Validate inputs at the application boundary and enforce critical invariants again in Postgres.
21
+ - Use `DATABASE_URL` at runtime; prefer `DATABASE_URL_UNPOOLED` for migrations and maintenance when available.
22
+ - Close owned pools in `finally`; do not leak clients or hide ownership of long-lived connections.
23
+ - Fold Neon Auth into [Iron Session](./auth.md): link identity server-side, store app context in the sealed session, then clear the transient Neon session.
24
+ - Enforce user and tenant scope on every read and mutation; authentication alone is not authorization.
25
+ - For LocalStorage or IndexedDB migrations, preserve behavior but improve the schema when normalization or consolidation is clearly safer.
26
+ - Make importers transactional, validated, idempotent, and count-verifiable; never delete server data merely because a mutable export became smaller.
27
+ - Keep one-off data transfers out of permanent migration machinery; verify source, destination, schema, counts, and runtime connectivity.
28
+ - After schema changes, generate migrations, confirm no drift, migrate a disposable database in tests, and run typecheck/build/tests.
package/rules/github.md CHANGED
@@ -3,8 +3,13 @@ type: always_apply
3
3
  description: Set of rules for projects which use Github
4
4
  paths:
5
5
  - '**/.github/*.yml'
6
+ - '**/.github/**/*.yml'
7
+ - '**/.github/**/*.yaml'
6
8
  ---
7
9
 
10
+ - Agentic review MUST verify this effective CI order: checkout -> enable Corepack -> setup Node with Yarn cache -> restore build caches -> immutable install -> prepare -> verification (lint/test/build) -> publish; publishing MUST depend on successful verification.
11
+ - In multi-job workflows, use job-specific build-cache keys with a same-run fallback so downstream jobs reuse upstream results without immutable-key collisions.
12
+
8
13
  # Example Workflow
9
14
 
10
15
  ```yml
@@ -42,46 +47,36 @@ jobs:
42
47
  - name: Checkout Repo
43
48
  uses: actions/checkout@v4
44
49
 
50
+ - name: Enable Corepack
51
+ run: corepack enable
52
+
45
53
  - name: Setup Node.js
46
54
  uses: actions/setup-node@v6
47
55
  with:
48
- node-version: 26
56
+ node-version: 24
49
57
  registry-url: 'https://registry.npmjs.org'
50
58
  cache: yarn
51
59
  cache-dependency-path: yarn.lock
52
60
 
53
- - name: Enable Corepack
54
- run: corepack enable
55
-
56
- - name: Get yarn cache directory path
57
- id: yarn-cache-dir-path
58
- run: echo "dir=$(yarn config get cacheFolder)" >> $GITHUB_OUTPUT
59
-
60
- - uses: actions/cache@v6
61
- id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
62
- with:
63
- path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
64
- key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
65
- restore-keys: |
66
- ${{ runner.os }}-yarn-
67
-
68
61
  #TODO https://turbo.build/repo/docs/guides/ci-vendors/github-actions#remote-caching
69
62
  #TODO https://turborepo.dev/docs/guides/ci-vendors/github-actions#remote-caching-with-github-actionscache
70
63
  - name: Cache Turbo
71
64
  uses: actions/cache@v6
72
65
  with:
73
66
  path: .turbo
74
- key: ${{ runner.os }}-turbo-${{ github.sha }}
67
+ key: ${{ runner.os }}-turbo-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}
75
68
  restore-keys: |
69
+ ${{ runner.os }}-turbo-${{ github.run_id }}-${{ github.run_attempt }}-
76
70
  ${{ runner.os }}-turbo-
77
71
 
78
- - name: Cache NX
72
+ - name: Cache Nx
79
73
  uses: actions/cache@v6
80
74
  with:
81
- path: .nx
82
- key: ${{ runner.os }}-turbo-${{ github.sha }}
75
+ path: .nx/cache
76
+ key: ${{ runner.os }}-nx-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}
83
77
  restore-keys: |
84
- ${{ runner.os }}-turbo-
78
+ ${{ runner.os }}-nx-${{ github.run_id }}-${{ github.run_attempt }}-
79
+ ${{ runner.os }}-nx-
85
80
 
86
81
  - name: Install dependencies
87
82
  run: yarn install --immutable
package/rules/gitlab.md CHANGED
@@ -3,10 +3,14 @@ type: always_apply
3
3
  description: Set of rules for projects which use Gitlab
4
4
  paths:
5
5
  - '**/.gitlab-ci.yml'
6
+ - '**/.gitlab/**/*.yml'
7
+ - '**/.gitlab/**/*.yaml'
6
8
  ---
7
9
 
8
10
  - Always collect coverage from tests
9
11
  - Always publish important build stats as artifacts
12
+ - Agentic review MUST verify this effective CI order: checkout and cache restore -> enable Corepack -> immutable install -> prepare -> verification (lint/test/build) -> publish; publishing MUST depend on successful verification.
13
+ - Keep local build-cache keys job-specific in parallel pipelines; use a remote Nx or Turbo cache when results must be shared across jobs.
10
14
 
11
15
  # Example
12
16
 
@@ -18,21 +22,23 @@ variables:
18
22
 
19
23
  cache:
20
24
  - key:
25
+ prefix: yarn
21
26
  files:
22
27
  - yarn.lock # dependencies cached based on lockfile
23
28
  paths:
24
- - .yarn
25
- - .pnp.js
26
- - yarn.lock
27
- - node_modules
28
- - '**/node_modules'
29
- - key: $CI_COMMIT_REF_NAME # build-related files cached per-branch
29
+ - .yarn/cache
30
+ policy: pull-push
31
+ # Job-specific keys prevent parallel jobs from replacing each other's local build cache.
32
+ - key: build-$CI_JOB_NAME_SLUG-$CI_COMMIT_REF_SLUG
33
+ fallback_keys:
34
+ - build-$CI_JOB_NAME_SLUG-$CI_DEFAULT_BRANCH
30
35
  paths:
31
- - '**/.turbo'
32
- - '**/.nx'
36
+ - .turbo
37
+ - .nx/cache
33
38
  - '**/.tscache'
34
39
  - '**/.tsbuildinfo'
35
40
  - '**/.next/cache'
41
+ policy: pull-push
36
42
 
37
43
  stages:
38
44
  - install
@@ -80,11 +86,4 @@ build:
80
86
  - web/build
81
87
  ```
82
88
 
83
- Cache `.yarn` individually is possible but not needed:
84
-
85
- ```yaml
86
- - .yarn/cache
87
- - .yarn/unplugged
88
- - .yarn/build-state.yml
89
- - .yarn/install-state.gz
90
- ```
89
+ - Use Nx Cloud or Turbo Remote Cache when build results must be shared safely across parallel jobs.
package/rules/npm-yarn.md CHANGED
@@ -123,3 +123,11 @@ Rules:
123
123
  - Unlinking: `yalc remove --all` cleans `.yalc/` and `yalc.lock` but leaves dangling symlinks in `node_modules` — delete them before `yarn install`
124
124
  - Yarn 4.17+ quarantines packages published <24h ago (`npmMinimalAgeGate`) — consumers need `npmPreapprovedPackages: ["@kirill.konshin/*"]` in `.yarnrc.yml` to install own packages right after release (older Yarn errors on that key — upgrade the consumer via `packageManager` first)
125
125
  - `.yarnrc.local.yml` is NOT a thing (open Yarn feature request, local overrides only via `YARN_*` env vars) and yalc runs NO registry (it is a file store in `~/.yalc`), so a registry override cannot replace linking — `yalc link` is the only mode that leaves all manifests untouched
126
+
127
+ # First Publish with OIDC
128
+
129
+ - Never bootstrap, publish, or push a release without explicit approval.
130
+ - Bootstrap a new npm package once from a locally authenticated session with `npm publish --access public --tag bootstrap`; complete npm's interactive 2FA challenge, or use `--otp=<code>` for TOTP.
131
+ - Configure its GitHub trusted publisher for organization/user `kirill-konshin`, repository `utils`, workflow `release.yml`, optional environment `npm-publish`, and check **Allow npm publish**.
132
+ - Under Publishing access, check **Require two-factor authentication and disallow bypass 2FA tokens (recommended)**; OIDC publishes remain allowed and should be used for every normal release.
133
+ - The first conventional `feat` release establishes the normal `latest` version.