@kirill.konshin/lint 0.8.3 → 0.8.5

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/README.md CHANGED
@@ -216,7 +216,7 @@ What maps where:
216
216
  </tbody>
217
217
  </table>
218
218
 
219
- Not carried over: `@nx/dependency-checks` (Oxlint does not lint JSON), `@typescript-eslint/naming-convention` (type-aware only, off by default). `@nx/eslint-plugin` needs the `eslint` package installed (as a library; ESLint itself does not run). Oxlint type-aware linting and type checking (tsgolint, the TypeScript 7 engine) are on by default — `vp check` is the type check, `vp pack` does not type-check; `vitePlus: { typeAware: false }` turns them off. tsgolint rejects tsconfig options TypeScript 7 removed (`target: es5`, `moduleResolution: node`, `downlevelIteration`).
219
+ Not carried over: `@nx/dependency-checks` (Oxlint does not lint JSON), `@typescript-eslint/naming-convention` (type-aware only, off by default). `@nx/eslint-plugin` and the Tailwind plugin need the `eslint` package installed (as a library; ESLint itself does not run; Tailwind: a known gap, see [Issues](#issues)). Oxlint type-aware linting and type checking (tsgolint, the TypeScript 7 engine) are on by default — `vp check` is the type check, `vp pack` does not type-check; `vitePlus: { typeAware: false }` turns them off. tsgolint rejects tsconfig options TypeScript 7 removed (`target: es5`, `moduleResolution: node`, `downlevelIteration`).
220
220
 
221
221
  `package.json`:
222
222
 
@@ -484,10 +484,10 @@ In the project root, `lint-prepare`:
484
484
 
485
485
  - Creates real `rules/` and `skills/` directories in `.agents/` (canonical, cross-tool — Codex reads it) and `.claude/` (Claude Code).
486
486
  - Links every `rules/*.md` file into both, except the ones the `rules` map of [`lint.config.ts`](#lintconfigts) turns off (`rules: { redux: false }`). Links point straight at the installed package's real location (`node_modules/@kirill.konshin/lint`, or the workspace package). A rule of yours with the same name in `.agents/` wins, the package one is not installed.
487
- - Installs the skills of the `skills` map of `lint.config.ts`, merged over the defaults, with the [`skills` CLI](https://github.com/vercel-labs/skills), into `.agents/skills/` and from there into `.claude/skills/`. The map is keyed by source, each value uses the toggle notation; `skills: { name: true | false }` picks skills of a source — with no `true` entry every skill except the `false` ones:
487
+ - Installs the skills of the `skills` map of `lint.config.ts`, merged over the defaults, with the [`skills` CLI](https://github.com/vercel-labs/skills), into `.agents/skills/` and from there into `.claude/skills/`. The map is keyed by source, each value uses the toggle notation; `skills: { name: true | false | 'package' }` picks skills of a source — with no `true` or package entry every skill except the `false` ones; with one, only the skills that are on. A package name gates a skill: it is on when the root or a workspace package declares that package in `dependencies` or `devDependencies` (`'vercel-cli': 'vercel'`), off with `detection: false`; `true` / `false` in `lint.config.ts` overrides the gate:
488
488
  - npm packages (`@scope/name`, or a name without `/`) are dependencies that ship skills: `skills experimental_sync -y -r -a codex claude-code` links every `skills/<name>/` folder of the dependencies of the root and of every workspace package; the map only leaves some out (`--exclude`). Default: this package's own skills (`'@kirill.konshin/lint': true`) — e.g. `lint-repo`, which sets up the tooling above and audits the repo against the rules.
489
489
  - Git sources (`owner/repo`) are installed with `skills add`, at `ref` when set (pin a full 40-character commit SHA). A source whose skills `skills-lock.json` already has at the same ref is not fetched again. `lint.config.ts` owns the remote skills of `skills-lock.json`: a remote skill it no longer lists is removed (`skills remove`).
490
- - Defaults — every project gets them, turn off what it does not need: the [Core Pack](https://skills.sh/p/DxVN7q53wGdAcZQt) (`vercel-labs/agent-skills` incl. `web-design-guidelines`, `vercel/ai`, `shadcn-ui/ui`, `heroui-inc/heroui`, `mui/material-ui` without `material-ui-tailwind`, `neondatabase/agent-skills`) and the official skills of the libraries the rules cover (`vercel/next.js`, `reduxjs/redux-toolkit`, `vercel/turborepo`, `nrwl/nx-ai-agents-config`, `expo/skills`, `microsoft/playwright-cli`). Each source lists its skills and pins a commit: `DEFAULT_LINT_CONFIG` in `src/config.ts`.
490
+ - Defaults — every project gets them, turn off what it does not need: the [Core Pack](https://skills.sh/p/DxVN7q53wGdAcZQt) (`vercel-labs/agent-skills` incl. `web-design-guidelines`, `vercel/ai`, `shadcn-ui/ui`, `heroui-inc/heroui`, `mui/material-ui` without `material-ui-tailwind`, `neondatabase/agent-skills`) and the official skills of the libraries the rules cover (`vercel/next.js`, `reduxjs/redux-toolkit`, `vercel/turborepo`, `nrwl/nx-ai-agents-config`, `expo/skills`, `microsoft/playwright-cli`). Gated by the `vercel` dependency (projects that install the Vercel CLI): `vercel/vercel` (`vercel-cli`) and `deploy-to-vercel` of `vercel-labs/agent-skills`. Each source lists its skills and pins a commit: `DEFAULT_LINT_CONFIG` in `src/config.ts`.
491
491
  - A skill folder of yours with the same name in `.agents/skills/` wins.
492
492
  - A failed CLI run is a warning, the install goes on: run `lint-prepare` again.
493
493
  - On CI (`CI` set) nothing remote is fetched (`--no-remote`, no `skills add`): no network needed.
@@ -675,7 +675,7 @@ Due to limitations package visibility between leaf and root this package has to
675
675
 
676
676
  ¹ the plugins need the tool's package resolvable at lint time (`tailwindcss` for the theme-loading workers, `next` for `eslint-config-next`'s internal `require`s, `storybook` for its plugin's static import, `jest` for version sniffing) — resolvable from the workspace root, or the hard error of step 3 fires.
677
677
 
678
- `vitePlusConfig` runs the same gates (`src/gates.ts`, shared with the ESLint blocks), with three differences: Oxlint JS plugins load from this package, so only `storybook` (its plugin imports `storybook`) and `nx` (needs `eslint`) demand a resolvable package; `vitest` is ON unless set to `false` (Vite+ bundles it); `next` needs no package (Oxlint's `nextjs` plugin is native). `typeAware` differs by backend: `eslint.typeAware` is OFF by default (slow), `vitePlus.typeAware` ON.
678
+ `vitePlusConfig` runs the same gates (`src/gates.ts`, shared with the ESLint blocks), with three differences: Oxlint JS plugins load from this package, so only `storybook` (its plugin imports `storybook`), `nx` (needs `eslint`) and `tailwind` (needs `eslint`, a known gap, see [Issues](#issues), besides `tailwindcss`) demand a resolvable package; `vitest` is ON unless set to `false` (Vite+ bundles it); `next` needs no package (Oxlint's `nextjs` plugin is native). `typeAware` differs by backend: `eslint.typeAware` is OFF by default (slow), `vitePlus.typeAware` ON.
679
679
 
680
680
  The machinery is controlled by the `detection` key of `lint.config.ts` (same toggle notation as the tools):
681
681
 
@@ -712,6 +712,8 @@ paths:
712
712
  - [ ] pnpm — root detection via `@manypkg/find-root` (`pnpm-workspace.yaml`); `public-hoist-pattern` guidance unverified in a real pnpm workspace
713
713
  - [ ] npm — env fast-path (`npm_config_local_prefix`) verified previously; `@manypkg/find-root` fallback unverified since the switch
714
714
  - [x] Yarn [constraints](https://yarnpkg.com/features/constraints) helper enforces root overrides/resolutions or default dependency consistency
715
+ - Vite+
716
+ - [ ] `eslint-plugin-tailwindcss` as an Oxlint JS plugin needs the `eslint` package (a required peer, loaded through `@typescript-eslint/utils`): without it `vp check` stops before linting with `Cannot find module 'eslint'`. Workaround until fixed: `eslint` in the root `devDependencies`, as a library only (the `lint-tailwind` skill)
715
717
  - ESLint 9
716
718
  - [x] https://github.com/microsoft/rushstack/issues/4635 Failed to patch ESLint because the calling module was not recognized
717
719
  - [x] https://github.com/microsoft/rushstack/issues/4965 Failed to patch ESLint because the calling module was not recognized
package/dist/config.d.ts CHANGED
@@ -43,13 +43,15 @@ export type VitePlusOptions = UserConfig & {
43
43
  typeAware?: boolean | ToggleOptions;
44
44
  };
45
45
  /**
46
- * One skill source. `skills` names skills of the source: `true` installs one, `false` leaves one out. With no `true`
47
- * entry, every skill of the source is installed except the `false` ones.
46
+ * One skill source. `skills` names skills of the source: `true` installs one, `false` leaves one out, a package name
47
+ * installs one when the root or a workspace package declares that package in `dependencies` or `devDependencies`
48
+ * (none with `detection: false`). With no `true` or package entry, every skill of the source is installed except the
49
+ * `false` ones; with one, only the skills that are on, none when every one is off.
48
50
  */
49
51
  export type SkillSourceOptions = ToggleOptions & {
50
52
  /** Git ref of a remote source. */
51
53
  ref?: string;
52
- skills?: Record<string, boolean>;
54
+ skills?: Record<string, boolean | string>;
53
55
  };
54
56
  /**
55
57
  * Skill sources, keyed by source: a git source (`owner/repo`) is installed with `skills add`; an npm package
@@ -75,8 +77,9 @@ export type LintConfig = {
75
77
  };
76
78
  export declare const LINT_CONFIG_FILE = "lint.config.ts";
77
79
  /**
78
- * The base every resolved config starts from. Every project gets every skill below; `lint.config.ts` turns off what it
79
- * does not need (`'expo/skills': false`).
80
+ * The base every resolved config starts from. Every project gets every skill below, except the skills a package name
81
+ * gates (`'vercel-cli': 'vercel'`), which only the projects depending on that package get; `lint.config.ts` turns off
82
+ * what it does not need (`'expo/skills': false`) and turns a gated skill on or off with `true` / `false`.
80
83
  *
81
84
  * Remote sources follow the Core Pack https://skills.sh/p/DxVN7q53wGdAcZQt (synced by hand, see the repository's
82
85
  * `curated-skills-update` skill), plus the official skills of the libraries the rules cover. Each source lists its
package/dist/config.js CHANGED
@@ -8,8 +8,9 @@ const LINT_CONFIG_FILE = "lint.config.ts";
8
8
  /** `{ name: true }` for each name. */
9
9
  const only = (...names) => Object.fromEntries(names.map((name) => [name, true]));
10
10
  /**
11
- * The base every resolved config starts from. Every project gets every skill below; `lint.config.ts` turns off what it
12
- * does not need (`'expo/skills': false`).
11
+ * The base every resolved config starts from. Every project gets every skill below, except the skills a package name
12
+ * gates (`'vercel-cli': 'vercel'`), which only the projects depending on that package get; `lint.config.ts` turns off
13
+ * what it does not need (`'expo/skills': false`) and turns a gated skill on or off with `true` / `false`.
13
14
  *
14
15
  * Remote sources follow the Core Pack https://skills.sh/p/DxVN7q53wGdAcZQt (synced by hand, see the repository's
15
16
  * `curated-skills-update` skill), plus the official skills of the libraries the rules cover. Each source lists its
@@ -19,7 +20,10 @@ const DEFAULT_LINT_CONFIG = { skills: {
19
20
  "@kirill.konshin/lint": true,
20
21
  "vercel-labs/agent-skills": {
21
22
  ref: "063bee94c3f4df8453406c830b0a7df0f2860278",
22
- skills: only("vercel-react-best-practices", "vercel-composition-patterns", "vercel-react-native-skills", "vercel-react-view-transitions", "web-design-guidelines")
23
+ skills: {
24
+ ...only("vercel-react-best-practices", "vercel-composition-patterns", "vercel-react-native-skills", "vercel-react-view-transitions", "web-design-guidelines"),
25
+ "deploy-to-vercel": "vercel"
26
+ }
23
27
  },
24
28
  "vercel/ai": {
25
29
  ref: "682e2dd71456f14f9da33a1b983d1998c3a1184c",
@@ -53,6 +57,10 @@ const DEFAULT_LINT_CONFIG = { skills: {
53
57
  ref: "8003ff0fe919160f68367cd08465b179410e0692",
54
58
  skills: only("turborepo")
55
59
  },
60
+ "vercel/vercel": {
61
+ ref: "84878e532142f0ac584953695658b324eb9e5b80",
62
+ skills: { "vercel-cli": "vercel" }
63
+ },
56
64
  "nrwl/nx-ai-agents-config": {
57
65
  ref: "525ce266e22ec54e006d630d3b560658e8c3001c",
58
66
  skills: only("link-workspace-packages", "monitor-ci", "nx-cloud-api", "nx-cloud-cache-investigator", "nx-cloud-ci-failure-review", "nx-generate", "nx-import", "nx-plugins", "nx-run-tasks", "nx-workspace")
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { eslintExts, eslintExtsRaw, markupExtsRaw, prettierExts, prettierExtsRaw, tsExts, tsExtsRaw } from "./exts.js";
2
- import { GLOBAL_IGNORES, asOptions, findNextRoots, findWorkspaceRoot, hasJest, hasNext, hasNx, hasStorybook, hasTailwind, hasTurbo, hasVite, hasVitest, isPackageResolvable, packageDirOf, scanWorkspace, toolGate } from "./lib.js";
2
+ import { GLOBAL_IGNORES, asOptions, findNextRoots, findWorkspaceRoot, hasJest, hasNext, hasNx, hasStorybook, hasTailwind, hasTurbo, hasVite, hasVitest, isPackageResolvable, packageDirOf, scanWorkspace, toolGate, workspaceDependsOn } from "./lib.js";
3
3
  import { DEFAULT_LINT_CONFIG, DefaultIgnoreOptions, DetectionOptions, EslintOptions, LINT_CONFIG_FILE, LintConfig, NextOptions, SkillSourceOptions, SkillsConfig, TailwindOptions, ToggleOptions, TypeAwareOptions, VitePlusOptions, defineLintConfig, loadLintConfig, mergeLintConfig, resolveLintConfig } from "./config.js";
4
4
  import { baseConfig, defaultIgnoreConfig, includeIgnoreFile } from "./configs/base.js";
5
5
  import { importSortConfig, importXConfig, unusedImportsConfig } from "./configs/imports.js";
@@ -31,4 +31,4 @@ import { Linter } from "eslint";
31
31
  */
32
32
  export declare function eslintConfig(overrides?: LintConfig): Promise<Linter.Config[]>;
33
33
  //#endregion
34
- export { DEFAULT_LINT_CONFIG, DefaultIgnoreOptions, DetectionOptions, EslintOptions, GLOBAL_IGNORES, LINT_CONFIG_FILE, LintConfig, NextOptions, Restriction, SkillSourceOptions, SkillsConfig, TailwindOptions, ToggleOptions, TypeAwareOptions, VitePlusOptions, asOptions, baseConfig, defaultIgnoreConfig, defineLintConfig, eslintExts, eslintExtsRaw, findNextRoots, findTailwindEntry, findWorkspaceRoot, hasJest, hasNext, hasNx, hasStorybook, hasTailwind, hasTurbo, hasVite, hasVitest, importSortConfig, importXConfig, includeIgnoreFile, isPackageResolvable, jestConfig, jestGate, jestPlugin, listStaged, loadLintConfig, markupExtsRaw, mergeLintConfig, nextBaseConfig, nextConfig, nextGate, nextOverridesConfig, nextPlugin, nxConfig, nxGate, nxPlugin, packageDirOf, prettier, prettierConfig, prettierExts, prettierExtsRaw, promiseConfig, reactBaseConfig, reactConfig, reactSettingsConfig, resolveLintConfig, restrictions, scanWorkspace, storybookConfig, storybookGate, tailwindConfig, tailwindGate, testConfig, toolGate, tsExts, tsExtsRaw, turboConfig, turboGate, turboPlugin, typeAwareConfig, typescriptOverridesConfig, unicornConfig, unusedImportsConfig, vitestConfig, vitestGate, vitestPlugin };
34
+ export { DEFAULT_LINT_CONFIG, DefaultIgnoreOptions, DetectionOptions, EslintOptions, GLOBAL_IGNORES, LINT_CONFIG_FILE, LintConfig, NextOptions, Restriction, SkillSourceOptions, SkillsConfig, TailwindOptions, ToggleOptions, TypeAwareOptions, VitePlusOptions, asOptions, baseConfig, defaultIgnoreConfig, defineLintConfig, eslintExts, eslintExtsRaw, findNextRoots, findTailwindEntry, findWorkspaceRoot, hasJest, hasNext, hasNx, hasStorybook, hasTailwind, hasTurbo, hasVite, hasVitest, importSortConfig, importXConfig, includeIgnoreFile, isPackageResolvable, jestConfig, jestGate, jestPlugin, listStaged, loadLintConfig, markupExtsRaw, mergeLintConfig, nextBaseConfig, nextConfig, nextGate, nextOverridesConfig, nextPlugin, nxConfig, nxGate, nxPlugin, packageDirOf, prettier, prettierConfig, prettierExts, prettierExtsRaw, promiseConfig, reactBaseConfig, reactConfig, reactSettingsConfig, resolveLintConfig, restrictions, scanWorkspace, storybookConfig, storybookGate, tailwindConfig, tailwindGate, testConfig, toolGate, tsExts, tsExtsRaw, turboConfig, turboGate, turboPlugin, typeAwareConfig, typescriptOverridesConfig, unicornConfig, unusedImportsConfig, vitestConfig, vitestGate, vitestPlugin, workspaceDependsOn };
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { GLOBAL_IGNORES, asOptions, findNextRoots, findWorkspaceRoot, hasJest, hasNext, hasNx, hasStorybook, hasTailwind, hasTurbo, hasVite, hasVitest, isPackageResolvable, packageDirOf, scanWorkspace, toolGate } from "./lib.js";
1
+ import { GLOBAL_IGNORES, asOptions, findNextRoots, findWorkspaceRoot, hasJest, hasNext, hasNx, hasStorybook, hasTailwind, hasTurbo, hasVite, hasVitest, isPackageResolvable, packageDirOf, scanWorkspace, toolGate, workspaceDependsOn } from "./lib.js";
2
2
  import { eslintExts, eslintExtsRaw, markupExtsRaw, prettierExts, prettierExtsRaw, tsExts, tsExtsRaw } from "./exts.js";
3
3
  import { DEFAULT_LINT_CONFIG, LINT_CONFIG_FILE, defineLintConfig, loadLintConfig, mergeLintConfig, resolveLintConfig } from "./config.js";
4
4
  import { findTailwindEntry, jestGate, nextGate, nxGate, storybookGate, tailwindGate, turboGate, vitestGate } from "./gates.js";
@@ -54,4 +54,4 @@ async function eslintConfig(overrides = {}) {
54
54
  ];
55
55
  }
56
56
  //#endregion
57
- export { DEFAULT_LINT_CONFIG, GLOBAL_IGNORES, LINT_CONFIG_FILE, asOptions, baseConfig, defaultIgnoreConfig, defineLintConfig, eslintConfig, eslintExts, eslintExtsRaw, findNextRoots, findTailwindEntry, findWorkspaceRoot, hasJest, hasNext, hasNx, hasStorybook, hasTailwind, hasTurbo, hasVite, hasVitest, importSortConfig, importXConfig, includeIgnoreFile, isPackageResolvable, jestConfig, jestGate, jestPlugin, listStaged, loadLintConfig, markupExtsRaw, mergeLintConfig, nextBaseConfig, nextConfig, nextGate, nextOverridesConfig, nextPlugin, nxConfig, nxGate, nxPlugin, packageDirOf, prettier, prettierConfig, prettierExts, prettierExtsRaw, promiseConfig, reactBaseConfig, reactConfig, reactSettingsConfig, resolveLintConfig, restrictions, scanWorkspace, storybookConfig, storybookGate, tailwindConfig, tailwindGate, testConfig, toolGate, tsExts, tsExtsRaw, turboConfig, turboGate, turboPlugin, typeAwareConfig, typescriptOverridesConfig, unicornConfig, unusedImportsConfig, vitestConfig, vitestGate, vitestPlugin };
57
+ export { DEFAULT_LINT_CONFIG, GLOBAL_IGNORES, LINT_CONFIG_FILE, asOptions, baseConfig, defaultIgnoreConfig, defineLintConfig, eslintConfig, eslintExts, eslintExtsRaw, findNextRoots, findTailwindEntry, findWorkspaceRoot, hasJest, hasNext, hasNx, hasStorybook, hasTailwind, hasTurbo, hasVite, hasVitest, importSortConfig, importXConfig, includeIgnoreFile, isPackageResolvable, jestConfig, jestGate, jestPlugin, listStaged, loadLintConfig, markupExtsRaw, mergeLintConfig, nextBaseConfig, nextConfig, nextGate, nextOverridesConfig, nextPlugin, nxConfig, nxGate, nxPlugin, packageDirOf, prettier, prettierConfig, prettierExts, prettierExtsRaw, promiseConfig, reactBaseConfig, reactConfig, reactSettingsConfig, resolveLintConfig, restrictions, scanWorkspace, storybookConfig, storybookGate, tailwindConfig, tailwindGate, testConfig, toolGate, tsExts, tsExtsRaw, turboConfig, turboGate, turboPlugin, typeAwareConfig, typescriptOverridesConfig, unicornConfig, unusedImportsConfig, vitestConfig, vitestGate, vitestPlugin, workspaceDependsOn };
package/dist/lib.d.ts CHANGED
@@ -45,6 +45,12 @@ export declare function isPackageResolvable(packageName: string): boolean;
45
45
  * Returns an absolute path, or `cwd` itself when there is no package.json anywhere above.
46
46
  */
47
47
  export declare function findWorkspaceRoot(cwd?: string): string;
48
+ /**
49
+ * Does the root or a workspace package of `root` declare `packageName` in `dependencies` or `devDependencies`?
50
+ * Peer/optional declarations are ignored, as in {@link dependsOnNext}. Reads the manifests the workspace globs name
51
+ * (`@manypkg/get-packages`), no scan; false without a `package.json`.
52
+ */
53
+ export declare function workspaceDependsOn(packageName: string, root?: string): boolean;
48
54
  /**
49
55
  * The workspace package owning `file` (e.g. the Tailwind entry CSS) - matched against the real
50
56
  * workspace package dirs (see {@link findWorkspacePackages}), NOT by walking to the nearest
package/dist/lib.js CHANGED
@@ -91,6 +91,22 @@ function findWorkspacePackages() {
91
91
  return dirs;
92
92
  }
93
93
  /**
94
+ * Does the root or a workspace package of `root` declare `packageName` in `dependencies` or `devDependencies`?
95
+ * Peer/optional declarations are ignored, as in {@link dependsOnNext}. Reads the manifests the workspace globs name
96
+ * (`@manypkg/get-packages`), no scan; false without a `package.json`.
97
+ */
98
+ function workspaceDependsOn(packageName, root = findWorkspaceRoot()) {
99
+ try {
100
+ const { rootPackage, packages } = getPackagesSync(root);
101
+ return [rootPackage, ...packages].some((pkg) => {
102
+ const { dependencies, devDependencies } = pkg?.packageJson ?? {};
103
+ return Boolean(dependencies?.[packageName] ?? devDependencies?.[packageName]);
104
+ });
105
+ } catch {
106
+ return false;
107
+ }
108
+ }
109
+ /**
94
110
  * The workspace package owning `file` (e.g. the Tailwind entry CSS) - matched against the real
95
111
  * workspace package dirs (see {@link findWorkspacePackages}), NOT by walking to the nearest
96
112
  * package.json: a directory that is not a declared workspace member belongs to the root. Returns
@@ -321,4 +337,4 @@ function toolGate(option, strict, spec) {
321
337
  }, enabled ? "forced on" : "detected");
322
338
  }
323
339
  //#endregion
324
- export { GLOBAL_IGNORES, asOptions, findNextRoots, findWorkspaceRoot, hasJest, hasNext, hasNx, hasStorybook, hasTailwind, hasTurbo, hasVite, hasVitest, isPackageResolvable, packageDirOf, scanWorkspace, toolGate };
340
+ export { GLOBAL_IGNORES, asOptions, findNextRoots, findWorkspaceRoot, hasJest, hasNext, hasNx, hasStorybook, hasTailwind, hasTurbo, hasVite, hasVitest, isPackageResolvable, packageDirOf, scanWorkspace, toolGate, workspaceDependsOn };
@@ -82,11 +82,12 @@ export type SkillsPlan = {
82
82
  */
83
83
  export declare function readPackageSkills(cwd: string, packageName: string): string[];
84
84
  /**
85
- * Turn the `skills` map into CLI work. npm sources become `experimental_sync` exclusions: a disabled package, the
86
- * `false` skills, or - when a package lists `true` skills - every other skill it ships. Enabled git sources become
87
- * `skills add` work.
85
+ * Turn the `skills` map into CLI work. A skill gated by a package name is on when `hasDependency` says the workspace
86
+ * declares that package. npm sources become `experimental_sync` exclusions: a disabled package, the `false` skills,
87
+ * or - when a package lists `true` or gated skills - every other skill it ships. Enabled git sources become
88
+ * `skills add` work; a source whose listed skills are all off is left out.
88
89
  */
89
- export declare function planSkills(skills: SkillsConfig, packageSkills?: (packageName: string) => string[]): SkillsPlan;
90
+ export declare function planSkills(skills: SkillsConfig, packageSkills?: (packageName: string) => string[], hasDependency?: (packageName: string) => boolean): SkillsPlan;
90
91
  /**
91
92
  * Install the git sources of the plan with `skills add`, skipping a source whose skills the lock already has at the
92
93
  * same ref, then remove what the plan no longer wants: `lint.config.ts` owns the remote skills of `skills-lock.json`
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { asOptions, findWorkspaceRoot } from "./lib.js";
2
+ import { asOptions, findWorkspaceRoot, workspaceDependsOn } from "./lib.js";
3
3
  import { LINT_CONFIG_FILE, resolveLintConfig } from "./config.js";
4
4
  import { createRequire } from "node:module";
5
5
  import fs from "node:fs";
@@ -364,31 +364,37 @@ function readPackageSkills(cwd, packageName) {
364
364
  });
365
365
  }
366
366
  /**
367
- * Turn the `skills` map into CLI work. npm sources become `experimental_sync` exclusions: a disabled package, the
368
- * `false` skills, or - when a package lists `true` skills - every other skill it ships. Enabled git sources become
369
- * `skills add` work.
367
+ * Turn the `skills` map into CLI work. A skill gated by a package name is on when `hasDependency` says the workspace
368
+ * declares that package. npm sources become `experimental_sync` exclusions: a disabled package, the `false` skills,
369
+ * or - when a package lists `true` or gated skills - every other skill it ships. Enabled git sources become
370
+ * `skills add` work; a source whose listed skills are all off is left out.
370
371
  */
371
- function planSkills(skills, packageSkills = () => []) {
372
+ function planSkills(skills, packageSkills = () => [], hasDependency = () => false) {
372
373
  const plan = {
373
374
  syncExclude: [],
374
375
  remote: []
375
376
  };
376
377
  for (const [source, option] of Object.entries(skills)) {
377
- const { enabled = true, ref, skills: names = {} } = asOptions(option);
378
- const listed = Object.keys(names).filter((name) => names[name]);
379
- const excluded = Object.keys(names).filter((name) => !names[name]);
378
+ const { enabled = true, ref, skills: entries = {} } = asOptions(option);
379
+ const names = Object.entries(entries).map(([name, on]) => ({
380
+ name,
381
+ on: typeof on === "string" ? hasDependency(on) : on
382
+ }));
383
+ const listed = names.filter(({ on }) => on).map(({ name }) => name);
384
+ const excluded = names.filter(({ on }) => !on).map(({ name }) => name);
385
+ const picky = Object.values(entries).some((on) => on !== false);
380
386
  if (isNpmSkillSource(source)) {
381
387
  if (!enabled) plan.syncExclude.push(source);
382
388
  else {
383
- const left = listed.length ? packageSkills(source).filter((name) => !listed.includes(name)) : excluded;
389
+ const left = picky ? packageSkills(source).filter((name) => !listed.includes(name)) : excluded;
384
390
  plan.syncExclude.push(...left.map((name) => `${source}#${name}`));
385
391
  }
386
392
  continue;
387
393
  }
388
- if (enabled) plan.remote.push({
394
+ if (enabled && (!picky || listed.length)) plan.remote.push({
389
395
  source,
390
396
  ref,
391
- skills: listed.length ? listed : "*",
397
+ skills: picky ? listed : "*",
392
398
  exclude: excluded
393
399
  });
394
400
  }
@@ -599,7 +605,8 @@ async function main() {
599
605
  const userEntries = readUserEntries(cwd);
600
606
  syncAgentDirs(cwd, packageEntries(rules), userEntries);
601
607
  console.log(`Synced ${AGENT_DIRS.join(", ")}, mirrored ${userEntries.size} own entries from ${CANONICAL_AGENT_DIR}`);
602
- const plan = planSkills(config.skills ?? {}, (packageName) => readPackageSkills(cwd, packageName));
608
+ const { enabled: detect = true } = asOptions(config.detection);
609
+ const plan = planSkills(config.skills ?? {}, (packageName) => readPackageSkills(cwd, packageName), detect ? (packageName) => workspaceDependsOn(packageName, root) : void 0);
603
610
  if (runSkillsSync(cwd, spawnSync, plan.syncExclude)) console.log(`Synced skills with the skills CLI, see ${SKILLS_LOCK}`);
604
611
  syncRemoteSkills(cwd, plan.remote);
605
612
  recordSyncedSkills(cwd);
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "keywords": [
5
5
  "tanstack-intent"
6
6
  ],
7
- "version": "0.8.3",
7
+ "version": "0.8.5",
8
8
  "type": "module",
9
9
  "skipGenerate": true,
10
10
  "bin": {
package/rules/agent.md CHANGED
@@ -123,3 +123,12 @@ Do not use `.claude/commands` for anything. It's not portable (`.agent/commands`
123
123
  - If project uses Spec Driven Development framework like OpenSpec, these files should be free from product specifications / external behavior, and only focused on general coding instructions
124
124
  - Preferred instructions/rules syntax how to structure plain human language: `EARS` for requirements and `BDD` (Given/When/Then) for scenarios
125
125
  - Rules & instructions in these files can't be cited from tests or code, so their proof is tooling, never a citation
126
+
127
+ # Machine resources
128
+
129
+ - Before a build, codegen, branch switch, mass edit or anything else that rewrites many files, ask the user to turn on the IDE's power save mode (JetBrains: File → Power Save Mode) and wait for the answer: the IDE indexes every changed file, and indexing that already runs keeps going after power save turns on
130
+ - While tests or builds run, watch CPU (`top -o cpu` on macOS, `top` or `htop` elsewhere); when the machine saturates, stop the run and report
131
+ - Verification runs on the user's own machine: run the narrowest check that covers the change, the full suite once at the end of a change
132
+ - Cap parallelism (Vitest `--maxWorkers=2`, Turbo `--concurrency=2`, Nx `--parallel=2`) and run heavy commands at background priority (`taskpolicy -b` on macOS, `nice` elsewhere)
133
+ - Full builds, packaging, signing and deploys only when the user asks, once per request; never in a retry loop; deploy only after a build that exited 0
134
+ - On a network error or when the user reports slowness, stop and report instead of retrying
@@ -0,0 +1,7 @@
1
+ ---
2
+ type: always_apply
3
+ description: Security rules for every project
4
+ ---
5
+
6
+ - A form that carries a password, token or other secret ALWAYS submits with POST: `<form action={serverAction}>` gets it from React, every other form sets `method="post"` explicitly, also when JavaScript handles the submit — a submit before hydration is the browser's own, and its default GET puts the secret in the URL
7
+ - NEVER put credentials or secrets in a URL: query strings, redirects, links and request logs keep them
@@ -0,0 +1,14 @@
1
+ ---
2
+ type: always_apply
3
+ description: Set of rules for projects which use Vercel
4
+ paths:
5
+ - '**/vercel.json'
6
+ - '**/.vercel/**'
7
+ - '**/.gitignore'
8
+ ---
9
+
10
+ - Applies only when the project uses Vercel (a `vercel` dependency, `vercel.json` or `.vercel/`)
11
+ - The Vercel CLI is a `devDependency`
12
+ - `.vercel/repo.json` (from `vercel link --repo`) is committed; the rest of `.vercel/` stays ignored: `.vercel/*` with `!.vercel/repo.json` in `.gitignore`, never a bare `.vercel` line
13
+ - After `vercel link`, remove the `.vercel` line it appends to `.gitignore`
14
+ - Setup and checks: the `lint-vercel` skill
@@ -34,7 +34,7 @@ All settings move into one `lint.config.ts` in the workspace root (README "`lint
34
34
  - **Prerequisites**: Node `^22.18 || ^24.11 || >=26`, Vite 8+, Vitest 4.1+, `node-modules` linker
35
35
  - **Set up** Vite+ by hand per the README "Vite+" section — not `vp migrate`: it copies every expanded ESLint rule, writes absolute paths and broken regexes, and rewrites dependencies; if it was run, replace its `lint` / `fmt` blocks with `vitePlusConfig`
36
36
  - **Carry over**: rules from `eslint.config.*` → `lint.rules` / `lint.overrides` (`@typescript-eslint/x` → `typescript/x`, `react-hooks/x` → `react/x`, `import-x/x` → `import/x`, `@nx/*` unchanged); extra `.prettierignore` entries → `fmt.ignorePatterns`; root `vitest.config.*` → the `test` block
37
- - **Remove**: `eslint.config.*`, `.prettierrc*`, `.prettierignore`, `.lintstagedrc*`, `vitest.config.*`, `tsdown.config.*` (→ `pack`), `.husky/` (→ `.vite-hooks/`; `git config --unset core.hooksPath`); dependencies `prettier`, `lint-staged`, `husky`, `vitest`, `tsdown`, `vite-plugin-dts`, `rollup-preserve-directives` — keep `eslint` only for `@nx/eslint-plugin`
37
+ - **Remove**: `eslint.config.*`, `.prettierrc*`, `.prettierignore`, `.lintstagedrc*`, `vitest.config.*`, `tsdown.config.*` (→ `pack`), `.husky/` (→ `.vite-hooks/`; `git config --unset core.hooksPath`); dependencies `prettier`, `lint-staged`, `husky`, `vitest`, `tsdown`, `vite-plugin-dts`, `rollup-preserve-directives` — keep `eslint` for `@nx/eslint-plugin` and for Tailwind (a known gap, the `lint-tailwind` skill)
38
38
  - **Rewrite**: `from 'vitest'` → `from 'vite-plus/test'` (keep `declare module 'vitest'`); `defineConfig` from `vite-plus`; library `vite build` with `preserveModules` → `pack` with `unbundle: true`, `dts: true`, `deps: { neverBundle: true }`; inline disables of file-name rules → `lint.overrides`
39
39
  - **Expect**: a one-time Oxfmt reformat (commit as `style:` / `chore:`); type errors the old setup never reported (`typeAware` is on), TS 7-removed tsconfig options (`target: es5`, `moduleResolution: node`, `downlevelIteration`) and TS 6's empty default `types` (list `["node", "vite-plus/client"]`); new Oxlint findings are real — fix, or override with a reason; `@nx/dependency-checks` is gone (Oxlint lints no JSON)
40
40
  - **Verify**: every package's build and tests; `dist` file lists and `package.json` `exports` unchanged
@@ -1,10 +1,24 @@
1
1
  ---
2
2
  name: lint-nextjs
3
- description: Our Next.js App Router conventions on top of the vendor Next.js skills - typed `LayoutProps` / `PageProps`, auth-guarded layouts, `params` / `searchParams` in server and client pages, page and component file placement, where `next.config.ts` details are. Use when writing or reviewing Next.js pages, layouts, route handlers or `next.config.ts`.
3
+ description: Our Next.js App Router conventions on top of the vendor Next.js skills - `next typegen` in `postinstall`, typed `LayoutProps` / `PageProps`, auth-guarded layouts, `params` / `searchParams` in server and client pages, page and component file placement, where `next.config.ts` details are. Use when writing or reviewing Next.js pages, layouts, route handlers or `next.config.ts`.
4
4
  ---
5
5
 
6
6
  The binding rules are in [rules/nextjs.md](../../rules/nextjs.md). Next.js API knowledge: the docs that `next` bundles (`node_modules/next/dist/docs/`), the `next-*` skills and the `vercel-react-best-practices` skill; MUI setup: the `material-ui-nextjs` skill.
7
7
 
8
+ # Route types in `postinstall`
9
+
10
+ `LayoutProps`, `PageProps` and `RouteContext` are global types that Next.js generates into `.next/types`, referenced from `next-env.d.ts` (both gitignored). `next dev` and `next build` write them, so a fresh clone or a CI type check (`vp check`) fails without them. Every Next.js app runs `next typegen` in `postinstall`:
11
+
12
+ ```jsonc
13
+ {
14
+ "scripts": {
15
+ "postinstall": "lint-prepare init && vp config && next typegen",
16
+ },
17
+ }
18
+ ```
19
+
20
+ - Monorepo: `next typegen` goes into the `postinstall` of each Next.js app package, not the root
21
+
8
22
  # Layouts
9
23
 
10
24
  Always use https://nextjs.org/docs/app/api-reference/file-conventions/layout#layout-props-helper:
@@ -24,7 +24,7 @@ Do not use Yarn PnP ([rules/npm-yarn.md](../../rules/npm-yarn.md)). IF the proje
24
24
 
25
25
  Write the config by hand. `vp migrate` is only an optional first pass: it copies every expanded ESLint rule, absolute paths and broken regexes into `vite.config.ts`, so clean up after it as the `lint-migrate` skill describes.
26
26
 
27
- 1. **Install** — add `vite-plus`, `@kirill.konshin/lint` (+ `eslint` only for Nx module-boundary rules); pin `vite`/`vitest` at the root (README "Yarn constraints").
27
+ 1. **Install** — add `vite-plus`, `@kirill.konshin/lint` (+ `eslint` for Nx module-boundary rules and for Tailwind, a known gap: the `lint-tailwind` skill); pin `vite`/`vitest` at the root (README "Yarn constraints").
28
28
  2. **Config** — `lint.config.ts` in the workspace root, always (README "`lint.config.ts`"; `"type": "module"` in the root `package.json`): tool toggles, `skills`, `rules`, and under `vitePlus` the `typeAware` setting and the project blocks — rule overrides in `lint.rules` / `lint.overrides`, ignores in `lint.ignorePatterns`, `test`, `fmt`. Root `vite.config.ts` is exactly `export default defineConfig(vitePlusConfig());`. Keep `.editorconfig`.
29
29
  3. **Hooks** — `lint-prepare init && vp config` in `prepare`/`postinstall` — in this order: `vp config` fills the Vite+ section `lint-prepare` writes into `AGENTS.md` (same choice as below), `.vite-hooks/pre-commit` with `vp staged`; scripts `lint: vp check --fix`, `lint:staged: vp staged`; workspace-wide scripts move from `yarn workspaces foreach` to `vp run -r` ([rules/npm-yarn.md](../../rules/npm-yarn.md)).
30
30
  4. **Tests/builds** — tests import from `vite-plus/test`; libraries `vp pack`, apps `vp build`.
@@ -32,6 +32,7 @@ The binding rules are in [rules/tailwind.md](../../rules/tailwind.md). This skil
32
32
  # ESLint (eslint-plugin-tailwindcss, bundled with @kirill.konshin/lint)
33
33
 
34
34
  - With Vite+ the same plugin runs as an Oxlint JS plugin with the same detection; both read `tailwind` from `lint.config.ts`
35
+ - Known gap: the plugin needs the `eslint` package (a required peer, loaded through `@typescript-eslint/utils`) also with Vite+, where ESLint does not run; without it `vp check` stops before linting with `Failed to load JS plugin … Cannot find module 'eslint'`. Temporary workaround: add `eslint` to the root `devDependencies`, as a library only (no `eslint.config.*`)
35
36
  - The plugin MUST be able to resolve the Tailwind entry CSS or it hard-crashes lint (ENOENT)
36
37
  - Zero-config happy path: when the workspace contains exactly ONE `*.css` with `@import "tailwindcss"` (scanned across the root + every workspace package, `.gitignore`-aware), rules auto-enable with that entry
37
38
  - Rules auto-scope to the workspace package owning the entry CSS (block `basePath`); pass `tailwind: { scoped: false }` to lint the whole workspace
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: lint-vercel
3
+ description: Vercel project setup - the Vercel CLI as a dev dependency, the committed repository link (`.vercel/repo.json`) so every clone is linked without `vercel link`, what stays out of git in `.vercel/`, the Yarn install command for projects whose root package is ESM. Use when adding Vercel to a project, running `vercel link`, editing `vercel.json`, editing the `.vercel` lines of `.gitignore`, or when a Vercel install fails with Yarn / Corepack.
4
+ ---
5
+
6
+ Platform operations (deploy, env vars, domains, logs): the `vercel-cli` skill.
7
+
8
+ # CLI
9
+
10
+ - `vercel` is a `devDependency` of the root `package.json`, run through the package manager (`vp exec vercel`, `yarn vercel`), never a global install
11
+ - The `vercel` dependency turns on the `vercel-cli` and `deploy-to-vercel` skills (`lint-prepare`)
12
+ - Login: `vercel login` once per machine, credentials stay outside the repository; CI uses a `VERCEL_TOKEN` secret
13
+
14
+ # Repository link
15
+
16
+ Link with `vercel link --repo`: it writes `.vercel/repo.json`, which maps the Git remote to the team and its projects (one entry per project root, monorepos included). It holds IDs and the remote name, no secrets. Commit it: every clone and machine is then linked.
17
+
18
+ Everything else in `.vercel/` is local and stays out of git: env files of `vercel pull` (`.vercel/.env.*.local`, secrets), build output of `vercel build` (`.vercel/output`), the per-directory link of plain `vercel link` (`.vercel/project.json`), `README.txt`.
19
+
20
+ `.gitignore`:
21
+
22
+ ```gitignore
23
+ # Vercel: the repository link is shared, the rest of .vercel is local (env files with secrets, build output)
24
+ .vercel/*
25
+ !.vercel/repo.json
26
+ ```
27
+
28
+ - `.vercel/*`, not `.vercel`: git cannot re-include a file inside an ignored directory
29
+ - `vercel link` appends a `.vercel` line to `.gitignore` when that exact line is missing, which silently drops the exception: after every `vercel link`, remove the appended `.vercel` line
30
+ - Check: `git check-ignore -q .vercel/repo.json` exits 1 (not ignored), `git status -uall` shows `.vercel/repo.json` and nothing else from `.vercel/`
31
+
32
+ # Install with Yarn
33
+
34
+ The root `package.json` has `"type": "module"` (`@kirill.konshin/lint` requires it). With `ENABLE_EXPERIMENTAL_COREPACK=1`, Vercel downloads Yarn into `.vercel/cache/corepack/`, inside the repository, so Node loads Yarn's CommonJS bundle as ESM and `yarn install` crashes with `Dynamic require of "util" is not supported`. Set the install command in `vercel.json` instead:
35
+
36
+ ```json
37
+ {
38
+ "installCommand": "npm i -g corepack@latest && corepack enable && yarn install --immutable"
39
+ }
40
+ ```
41
+
42
+ - Remove the `ENABLE_EXPERIMENTAL_COREPACK` env var from the Vercel project
43
+ - Yarn's files then live outside the repository, as on GitLab (the `lint-gitlab` skill), and `"type": "module"` stays
44
+ - Not tested on Vercel yet: global npm installs normally work there; confirm on the first deploy
45
+ - Do not remove `"type": "module"` from the root `package.json`, the workaround Vercel staff suggest: it works, but `@kirill.konshin/lint` requires the field and Node warns on every load of `lint.config.ts`