@kirill.konshin/lint 0.8.2 → 0.8.4

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
@@ -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.
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.2",
7
+ "version": "0.8.4",
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
package/rules/auth.md CHANGED
@@ -6,24 +6,16 @@ paths:
6
6
  - '**/*.ts'
7
7
  ---
8
8
 
9
- - ALWAYS use [`@kirill.konshin/auth`](https://github.com/kirill-konshin/utils/tree/main/packages/auth) ([npm](https://www.npmjs.com/package/@kirill.konshin/auth)) for authentication in Next.js apps, NEVER hand-roll `iron-session` wrappers
10
- - Follow the canonical patterns from the [package README](https://github.com/kirill-konshin/utils/blob/main/packages/auth/README.md) (session module, layout guard, login page, actions, route handlers, proxy) and its migration table when refactoring existing hand-rolled auth
11
- - ONE auth instance per app in `src/auth.ts`: `createPasswordAuth` (password-protected admin) or `createAuth` (token/OAuth)
12
- - `isValid` defaults to checking the lib-owned `AUTHENTICATED` marker field (set by `login()`, default session shape `PasswordSession`, nothing to configure) — token/OAuth apps pass their own session type + `isValid` (e.g. access token present & not expired)
13
- - Pass Next's `Route` as the routes generic (`createPasswordAuth<Route>` / `createAuth<Session, Route>`) so `urls` and the return-URL helpers are type-checked (`typedRoutes` is set by `defineNextConfig`, see [nextjs.md](nextjs.md))
14
- - Auth module MUST start with `import 'server-only'` and MUST NOT be module-level `'use server'` (that would expose session getters as callable server actions) — export `loginAction`/`logoutAction` from the SAME module as thin async wrappers with function-level `'use server'`, NO separate `actions.ts`; plain re-exports (`export const loginAction = auth.loginFormAction`) are NOT registered as actions; ENFORCED BY AGENT: no ESLint rule checks this, add on creation, flag on review (see [nextjs.md](nextjs.md))
15
- - Client Components MUST NOT import the auth module (`server-only` + function-level actions are not client-importable) — Server Components pass `loginAction`/`logoutAction` down as props
16
- - Cookie name MUST be unique per app (`<app>_session`), NEVER generic `session`
17
- - Cookie secret `SESSION_SECRET` (≥32 chars) and login password `ADMIN_PASSWORD` are SEPARATE env vars, never reuse one for the other
18
- - NEVER compare passwords with `===`, use `verifyPassword` / `timingSafeEqualStrings` (timing-safe)
19
- - Guard pages/layouts with `redirectNonAuthenticated()` (redirects to login), Server Actions and Route Handlers with `throwNonAuthenticated()` or `authenticatedRouteHandler()` (401), the whole `/api` surface with `proxyGuard()` in `proxy.ts`, login page with `redirectIfAuthenticated()`
20
- - Declare API visibility as `urls.public` / `urls.protected` globs and keep them exhaustive — `proxyGuard()` throws on overlap and warns (treating as public) on unknown paths; `allow` is only for request-level tweaks
21
- - Session lifetime via `ttl` (seconds) ONLY, NEVER set `cookieOptions.maxAge` (iron-session derives it)
22
- - Logout via `auth.logout()` (destroy + redirect) — export `logoutAction` as a function-level `'use server'` wrapper, like `loginAction`; a `FormData` argument from `<form action>` is ignored
23
- - Preserve the return URL through the `state` search param / hidden form field on login redirects; ALWAYS extract it with `auth.getState()` (accepts `await searchParams`, `URLSearchParams`, `FormData`, `NextRequest`, raw string; allows internal paths only, never the login page, falls back to `urls.afterLogin`), NEVER hand-parse `state`
24
- - NEVER store the return URL in the session — concurrent tabs share the cookie and would clash; thread it ONLY via search params, form fields and the `x-pathname` header
25
- - `proxy.ts` is two lines: `export const config = { matcher: [...] };` (a LITERAL — Next.js parses it statically) + `export const proxy = auth.proxyGuard({ matcher: config.matcher });` — the guard verifies the matcher covers all `urls.public`/`urls.protected` globs (it may be broader) and THROWS on uncovered ones
26
- - Login page is ONE Server Component file with `<form action={loginAction}>` (wrapping `auth.loginAction`) — errors return via the `?error=` search param; a Client Component (`useActionState` + `loginFormAction`) ONLY when pending/inline-error UI is actually needed
27
- - Reuse `auth.urls.*` (resolved, defaults applied) instead of repeating route literals, e.g. `redirect(auth.urls.afterLogin)`
28
- - List page routes in `urls.public` — `proxyGuard()` stamps `x-pathname` so `redirectNonAuthenticated()` returns users to the deep page after login (pages are enforced by layouts, not by the proxy)
29
- - Login page MUST live OUTSIDE the guarded layout (the guard would redirect to itself); `urls.afterLogin` pointing at the login page throws at creation
9
+ Patterns, strategies, Neon Auth setup, password login and migration: the `auth` skill of `@kirill.konshin/auth`, it installs with the package.
10
+
11
+ - ALWAYS use [`@kirill.konshin/auth`](https://github.com/kirill-konshin/utils/tree/main/packages/auth) ([npm](https://www.npmjs.com/package/@kirill.konshin/auth)) for authentication in Next.js apps, NEVER hand-roll `iron-session` or Neon Auth session wrappers
12
+ - ONE auth instance per app in `src/auth.ts`, with ONE session strategy: `ironStrategy` (the app writes a sealed cookie; `createPasswordAuth` for password admin) or `neonStrategy` (Neon Auth owns the session); NEVER wrap one session into another
13
+ - Auth module MUST start with `import 'server-only'` and MUST NOT be module-level `'use server'`; `loginAction`/`logoutAction` are function-level `'use server'` wrappers in the SAME module, plain re-exports are NOT registered as actions; ENFORCED BY AGENT: no ESLint rule checks this, add on creation, flag on review (see [nextjs.md](nextjs.md))
14
+ - Client Components MUST NOT import the auth module; Server Components pass `loginAction`/`logoutAction` down as props
15
+ - Code outside Next (agent runtimes, workers) MUST NOT import the auth module: it asks a Next Route Handler for the session, forwarding the request's `cookie` header
16
+ - Iron: cookie name unique per app (`<app>_session`); `SESSION_SECRET` (≥32 chars) and `ADMIN_PASSWORD` are SEPARATE env vars; lifetime via `ttl` ONLY, NEVER `cookieOptions.maxAge`
17
+ - NEVER compare passwords with `===`, use `verifyPassword` / `timingSafeEqualStrings`
18
+ - Guard pages/layouts with `redirectNonAuthenticated()` (inside `<Suspense>`), Server Actions and Route Handlers with `throwNonAuthenticated()` or `authenticatedRouteHandler()`, the `/api` surface with `proxyGuard()` in `proxy.ts`, the login page with `redirectIfAuthenticated()`
19
+ - `proxy.ts`: a LITERAL `config.matcher` + `auth.proxyGuard({ matcher: config.matcher })`; `urls.public` / `urls.protected` globs stay exhaustive
20
+ - ALWAYS extract the return URL with `auth.getState()`, NEVER hand-parse `state`, NEVER store it in the session
21
+ - Login page lives OUTSIDE the guarded layout; logout via `auth.logout()`
package/rules/db.md CHANGED
@@ -28,4 +28,4 @@ Migration and import procedures, Neon: the `lint-db` skill.
28
28
  # Neon
29
29
 
30
30
  - Only if the user asks for Neon, or the project already uses it: follow the `lint-db` skill
31
- - Fold Neon Auth into Iron Session (the `lint-db` skill); this overrides the session wrapper, callback route and middleware of the `neon-auth` skill
31
+ - Neon Auth: `neonStrategy` of `@kirill.konshin/auth` (its `auth` skill); this overrides the session wrapper, callback route and middleware of the `neon-auth` skill
package/rules/nextjs.md CHANGED
@@ -16,7 +16,7 @@ Use the `lint-nextjs` skill when working with a Next.js project.
16
16
  - Prefer Route Handlers for redirects
17
17
  - Never use Pages Router
18
18
  - Always use App Router
19
- - Use `iron-session` for authentication via `@kirill.konshin/auth`, see [auth.md](auth.md)
19
+ - Use `@kirill.konshin/auth` for authentication (iron-session or Neon Auth strategy), see [auth.md](auth.md)
20
20
  - Server-only modules MUST start with `import 'server-only'`: see [typescript.md](typescript.md)
21
21
  - `package.json` MUST ALWAYS have version of Next.js, NEVER `*`, otherwise Vercel will fall into legacy mode instead of serverless
22
22
  - ALWAYS create `next.config.ts` with `defineNextConfig` from `@kirill.konshin/next/config` (the `/config` subpath, NEVER the barrel — Next transpiles `next.config.ts` to CJS and `require`s it outside any bundler); what it sets: the `next` skill of `@kirill.konshin/next`
@@ -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
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: lint-db
3
- description: Database procedures for the db rule - LocalStorage / IndexedDB to server migrations, transactional importers, one-off data transfers, steps after a schema change, Neon Auth folded into Iron Session. Use when migrating or importing data, changing a schema, or adding Neon Auth.
3
+ description: Database procedures for the db rule - LocalStorage / IndexedDB to server migrations, transactional importers, one-off data transfers, steps after a schema change. Use when migrating or importing data, or changing a schema.
4
4
  ---
5
5
 
6
6
  The binding rules are in [rules/db.md](../../rules/db.md). This skill holds the procedures.
@@ -16,8 +16,4 @@ The binding rules are in [rules/db.md](../../rules/db.md). This skill holds the
16
16
 
17
17
  Only when the user asks for Neon, or the project already uses it. Connection strings, branches and migrations: the `neon-postgres` skill and the `neon-postgres-branches` skill. Drivers, URLs and migration runs: `@kirill.konshin/db` and its `db` skill, it installs with the package.
18
18
 
19
- Neon Auth: set it up per the `neon-auth` skill, then fold it into Iron Session ([rules/auth.md](../../rules/auth.md)):
20
-
21
- 1. Link the Neon identity to the app user on the server.
22
- 2. Store the app context in the sealed Iron Session.
23
- 3. Clear the transient Neon session.
19
+ Neon Auth: the `auth` skill of `@kirill.konshin/auth` (`neonStrategy`), it installs with the package.
@@ -25,30 +25,7 @@ export default function Layout({ children, analytics }: LayoutProps<'/dashboard'
25
25
 
26
26
  ## Check auth in layouts pattern
27
27
 
28
- Put the auth guard in the layout of a route group, `app/(auth)/layout.tsx`: the group adds no path segment and protects every route below it.
29
-
30
- Layouts do not protect Route Handlers: check auth in each handler too.
31
-
32
- Use `@kirill.konshin/auth` (see [rules/auth.md](../../rules/auth.md)); the guard runs inside `<Suspense>`:
33
-
34
- ```tsx
35
- import { type ReactNode, Suspense } from 'react';
36
-
37
- import { auth } from '@/auth';
38
-
39
- export default function Layout({ children }: LayoutProps<'/dashboard'>) {
40
- return (
41
- <Suspense>
42
- <Protected>{children}</Protected>
43
- </Suspense>
44
- );
45
- }
46
-
47
- async function Protected({ children }: { children: ReactNode }) {
48
- await auth.redirectNonAuthenticated(); // redirects to urls.login
49
- return <>{children}</>;
50
- }
51
- ```
28
+ Put the auth guard in the layout of a route group, `app/(auth)/layout.tsx`: the group adds no path segment and protects every route below it. Layouts do not protect Route Handlers: check auth in each handler too. The guard and its `<Suspense>` boundary: the `auth` skill of `@kirill.konshin/auth`.
52
29
 
53
30
  # Pages
54
31
 
@@ -0,0 +1,30 @@
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/`. Use when adding Vercel to a project, running `vercel link`, or editing the `.vercel` lines of `.gitignore`.
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/`