@kirill.konshin/lint 0.5.5 → 0.6.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 (111) hide show
  1. package/README.md +38 -3
  2. package/commands/spec-author.md +39 -0
  3. package/dist/configs/base.d.ts +4 -3
  4. package/dist/configs/base.js +61 -74
  5. package/dist/configs/imports.d.ts +3 -2
  6. package/dist/configs/imports.js +95 -146
  7. package/dist/configs/nx.d.ts +4 -3
  8. package/dist/configs/nx.js +31 -41
  9. package/dist/configs/prettier.d.ts +3 -2
  10. package/dist/configs/prettier.js +19 -16
  11. package/dist/configs/promise.d.ts +3 -2
  12. package/dist/configs/promise.js +16 -16
  13. package/dist/configs/react.d.ts +4 -3
  14. package/dist/configs/react.js +178 -217
  15. package/dist/configs/storybook.d.ts +4 -3
  16. package/dist/configs/storybook.js +22 -22
  17. package/dist/configs/tailwind.d.ts +4 -3
  18. package/dist/configs/tailwind.js +67 -91
  19. package/dist/configs/testing.d.ts +7 -6
  20. package/dist/configs/testing.js +112 -146
  21. package/dist/configs/turbo.d.ts +4 -3
  22. package/dist/configs/turbo.js +19 -27
  23. package/dist/configs/typescriptTypeAware.d.ts +4 -3
  24. package/dist/configs/typescriptTypeAware.js +99 -95
  25. package/dist/configs/unicorn.d.ts +3 -2
  26. package/dist/configs/unicorn.js +34 -41
  27. package/dist/exts.d.ts +2 -1
  28. package/dist/exts.js +10 -11
  29. package/dist/index.d.ts +44 -42
  30. package/dist/index.js +53 -85
  31. package/dist/lib.d.ts +21 -21
  32. package/dist/lib.js +261 -301
  33. package/dist/lintPrepare.d.ts +20 -17
  34. package/dist/lintPrepare.js +341 -371
  35. package/dist/lintStaged.d.ts +4 -3
  36. package/dist/lintStaged.js +25 -22
  37. package/dist/prettier.d.ts +4 -3
  38. package/dist/prettier.js +16 -17
  39. package/dist/restrictions.d.ts +11 -10
  40. package/dist/restrictions.js +18 -22
  41. package/dist/yarn.cjs +79 -98
  42. package/dist/yarn.d.cts +3 -2
  43. package/package.json +24 -8
  44. package/rules/agent.md +2 -0
  45. package/rules/openspec.md +1 -1
  46. package/skills/spec-steward/SKILL.md +3 -11
  47. package/skills/spec-steward/references/audit.md +18 -43
  48. package/skills/spec-steward/references/contract.md +4 -4
  49. package/skills/spec-steward/references/criteria.md +4 -4
  50. package/skills/spec-steward/references/review-format.md +6 -6
  51. package/skills/spec-steward/references/wiring.md +2 -2
  52. package/skills/spec-steward/references/worker.md +67 -0
  53. package/skills/spec-steward/scripts/lib/corpus.mjs +1 -1
  54. package/skills/spec-steward/scripts/lib/evidence.mjs +2 -147
  55. package/skills/spec-steward/scripts/lib/wire.mjs +6 -4
  56. package/skills/spec-steward/scripts/steward.mjs +30 -91
  57. package/skills/spec-steward/sweeps.json +49 -0
  58. package/skills/spec-tools/SKILL.md +46 -0
  59. package/skills/spec-tools/references/contract.md +111 -0
  60. package/skills/spec-tools/references/gitlab.md +122 -0
  61. package/skills/spec-verify/SKILL.md +153 -0
  62. package/spec-tools/dist/audit-DkZZulq6.mjs +130 -0
  63. package/spec-tools/dist/auditChanged-CNGjlake.mjs +1 -0
  64. package/spec-tools/dist/auditChanged-CZCvMgyZ.mjs +618 -0
  65. package/spec-tools/dist/auditReport-xgq4wK2i.mjs +458 -0
  66. package/spec-tools/dist/auditScope-CBuBtfPG.mjs +104 -0
  67. package/spec-tools/dist/changeGates-DdeQKfle.mjs +333 -0
  68. package/spec-tools/dist/changeGates-uy4Ti8rK.mjs +1 -0
  69. package/spec-tools/dist/ci-BUewHJS3.mjs +143 -0
  70. package/spec-tools/dist/ci-CFBzn8Of.mjs +1 -0
  71. package/spec-tools/dist/cli.mjs +93 -0
  72. package/spec-tools/dist/comment-szasMMg2.mjs +57 -0
  73. package/spec-tools/dist/files-Bppsb34B.mjs +1 -0
  74. package/spec-tools/dist/files-QlzY687_.mjs +38 -0
  75. package/spec-tools/dist/html-BMTkpbUN.mjs +1766 -0
  76. package/spec-tools/dist/jsonrepair-Dlm5dEen.mjs +742 -0
  77. package/spec-tools/dist/repo-CjIoUPYl.mjs +16 -0
  78. package/spec-tools/dist/repo-DUcnJw3c.mjs +1 -0
  79. package/spec-tools/dist/run-BElA9du3.mjs +67 -0
  80. package/spec-tools/dist/specDiff-8G56jMYn.mjs +123 -0
  81. package/spec-tools/dist/steward-DeieyOcj.mjs +34 -0
  82. package/spec-tools/dist/stewardAudit-BRMM0lrD.mjs +1 -0
  83. package/spec-tools/dist/stewardAudit-v0vOMfLN.mjs +271 -0
  84. package/spec-tools/dist/tier-Cn0P7juM.mjs +1 -0
  85. package/spec-tools/dist/tier-c3s_mA_I.mjs +65 -0
  86. package/spec-tools/dist/util-wnxhsnWO.mjs +49 -0
  87. package/spec-tools/dist/verdict-BFfN9PO8.mjs +58 -0
  88. package/spec-tools/dist/workers-BcIgckeq.mjs +417 -0
  89. package/spec-tools/dist/workflowEvidence-DyBj8EdG.mjs +1 -0
  90. package/spec-tools/dist/workflowEvidence-oui6ghPI.mjs +78 -0
  91. package/dist/configs/base.d.ts.map +0 -1
  92. package/dist/configs/imports.d.ts.map +0 -1
  93. package/dist/configs/nx.d.ts.map +0 -1
  94. package/dist/configs/prettier.d.ts.map +0 -1
  95. package/dist/configs/promise.d.ts.map +0 -1
  96. package/dist/configs/react.d.ts.map +0 -1
  97. package/dist/configs/storybook.d.ts.map +0 -1
  98. package/dist/configs/tailwind.d.ts.map +0 -1
  99. package/dist/configs/testing.d.ts.map +0 -1
  100. package/dist/configs/turbo.d.ts.map +0 -1
  101. package/dist/configs/typescriptTypeAware.d.ts.map +0 -1
  102. package/dist/configs/unicorn.d.ts.map +0 -1
  103. package/dist/exts.d.ts.map +0 -1
  104. package/dist/index.d.ts.map +0 -1
  105. package/dist/lib.d.ts.map +0 -1
  106. package/dist/lintPrepare.d.ts.map +0 -1
  107. package/dist/lintStaged.d.ts.map +0 -1
  108. package/dist/prettier.d.ts.map +0 -1
  109. package/dist/restrictions.d.ts.map +0 -1
  110. package/dist/yarn.d.cts.map +0 -1
  111. package/skills/spec-steward/workflows/audit.js +0 -539
@@ -1,4 +1,5 @@
1
- import type { Configuration as LintStagedConfiguration } from 'lint-staged';
1
+ import { Configuration } from "lint-staged";
2
+ //#region src/lintStaged.d.ts
2
3
  /**
3
4
  * Shared lint-staged config, the `@kirill.konshin/lint/lint-staged` entry. Import it from there, not the package root:
4
5
  * the root loads every ESLint plugin, which would slow down each commit.
@@ -18,5 +19,5 @@ import type { Configuration as LintStagedConfiguration } from 'lint-staged';
18
19
  * https://github.com/lint-staged/lint-staged/issues/775
19
20
  * You don't need git add since lint-staged 10
20
21
  */
21
- export declare const listStaged: LintStagedConfiguration;
22
- //# sourceMappingURL=lintStaged.d.ts.map
22
+ export declare const listStaged: Configuration;
23
+ //#endregion
@@ -1,24 +1,27 @@
1
- import { markupExtsRaw, prettierExtsRaw, tsExts } from './exts.js';
1
+ import { markupExtsRaw, prettierExtsRaw, tsExts } from "./exts.js";
2
+ //#region src/lintStaged.ts
2
3
  /**
3
- * Shared lint-staged config, the `@kirill.konshin/lint/lint-staged` entry. Import it from there, not the package root:
4
- * the root loads every ESLint plugin, which would slow down each commit.
5
- *
6
- * Markup goes to Prettier only: no block of this config lints it, so ESLint would skip it with a warning, after its
7
- * full startup.
8
- *
9
- * Tasks run the `eslint` / `prettier` package.json scripts (README), so their flags live in one place, through
10
- * `node --run` rather than `yarn`: Yarn loads the whole project state before every script, seconds per commit.
11
- *
12
- * https://nextjs.org/docs/app/api-reference/config/eslint#running-lint-on-staged-files
13
- *
14
- * Pay extra attention when the configured globs overlap, and tasks make edits to files. Prettier and eslint might try
15
- * to make changes to the same *.ts file at the same time, causing a race condition.
16
- *
17
- * https://github.com/lint-staged/lint-staged?tab=readme-ov-file#reformatting-the-code
18
- * https://github.com/lint-staged/lint-staged/issues/775
19
- * You don't need git add since lint-staged 10
20
- */
21
- export const listStaged = {
22
- [`*.{${prettierExtsRaw},${markupExtsRaw}}`]: ['node --run prettier --'],
23
- [`*.${tsExts}`]: ['node --run eslint --', 'node --run prettier --'],
4
+ * Shared lint-staged config, the `@kirill.konshin/lint/lint-staged` entry. Import it from there, not the package root:
5
+ * the root loads every ESLint plugin, which would slow down each commit.
6
+ *
7
+ * Markup goes to Prettier only: no block of this config lints it, so ESLint would skip it with a warning, after its
8
+ * full startup.
9
+ *
10
+ * Tasks run the `eslint` / `prettier` package.json scripts (README), so their flags live in one place, through
11
+ * `node --run` rather than `yarn`: Yarn loads the whole project state before every script, seconds per commit.
12
+ *
13
+ * https://nextjs.org/docs/app/api-reference/config/eslint#running-lint-on-staged-files
14
+ *
15
+ * Pay extra attention when the configured globs overlap, and tasks make edits to files. Prettier and eslint might try
16
+ * to make changes to the same *.ts file at the same time, causing a race condition.
17
+ *
18
+ * https://github.com/lint-staged/lint-staged?tab=readme-ov-file#reformatting-the-code
19
+ * https://github.com/lint-staged/lint-staged/issues/775
20
+ * You don't need git add since lint-staged 10
21
+ */
22
+ const listStaged = {
23
+ [`*.{${prettierExtsRaw},${markupExtsRaw}}`]: ["node --run prettier --"],
24
+ [`*.${tsExts}`]: ["node --run eslint --", "node --run prettier --"]
24
25
  };
26
+ //#endregion
27
+ export { listStaged };
@@ -1,7 +1,8 @@
1
- import type { Config as PrettierConfig } from 'prettier';
1
+ import { Config } from "prettier";
2
+ //#region src/prettier.d.ts
2
3
  /**
3
4
  * Shared Prettier config, the `@kirill.konshin/lint/prettier` entry. Import it from there, not the package root: the
4
5
  * root loads every ESLint plugin, which would slow down each Prettier run.
5
6
  */
6
- export declare const prettier: PrettierConfig;
7
- //# sourceMappingURL=prettier.d.ts.map
7
+ export declare const prettier: Config;
8
+ //#endregion
package/dist/prettier.js CHANGED
@@ -1,19 +1,18 @@
1
- import { eslintExts } from './exts.js';
1
+ import { eslintExts } from "./exts.js";
2
+ //#region src/prettier.ts
2
3
  /**
3
- * Shared Prettier config, the `@kirill.konshin/lint/prettier` entry. Import it from there, not the package root: the
4
- * root loads every ESLint plugin, which would slow down each Prettier run.
5
- */
6
- export const prettier = {
7
- printWidth: 120,
8
- tabWidth: 2,
9
- singleQuote: true,
10
- proseWrap: 'never',
11
- overrides: [
12
- {
13
- files: eslintExts,
14
- options: {
15
- tabWidth: 4,
16
- },
17
- },
18
- ],
4
+ * Shared Prettier config, the `@kirill.konshin/lint/prettier` entry. Import it from there, not the package root: the
5
+ * root loads every ESLint plugin, which would slow down each Prettier run.
6
+ */
7
+ const prettier = {
8
+ printWidth: 120,
9
+ tabWidth: 2,
10
+ singleQuote: true,
11
+ proseWrap: "never",
12
+ overrides: [{
13
+ files: eslintExts,
14
+ options: { tabWidth: 4 }
15
+ }]
19
16
  };
17
+ //#endregion
18
+ export { prettier };
@@ -1,17 +1,18 @@
1
- import type { Linter } from 'eslint';
1
+ import { Linter } from "eslint";
2
+ //#region src/restrictions.d.ts
2
3
  /**
3
4
  * One structural restriction: a core `no-restricted-*` rule applied under a concern of its own, with the files it
4
5
  * governs. Every other field is a flat-config entry field (`files`, `ignores`, ...).
5
6
  */
6
7
  export type Restriction = Omit<Linter.Config, 'name' | 'plugins' | 'rules'> & {
7
- /** The concern, registered as `restrict/<name>`; entries of one concern share it. */
8
- name: string;
9
- /** Tells apart the entries of one concern. */
10
- label?: string;
11
- /** The core rule the concern copies, e.g. `no-restricted-imports`. */
12
- rule: string;
13
- /** The rule's options. */
14
- options: unknown[];
8
+ /** The concern, registered as `restrict/<name>`; entries of one concern share it. */
9
+ name: string;
10
+ /** Tells apart the entries of one concern. */
11
+ label?: string;
12
+ /** The core rule the concern copies, e.g. `no-restricted-imports`. */
13
+ rule: string;
14
+ /** The rule's options. */
15
+ options: unknown[];
15
16
  };
16
17
  /**
17
18
  * The lint layer: structural rules a syntax or import check decides. Each concern is restricted through its own copy
@@ -20,4 +21,4 @@ export type Restriction = Omit<Linter.Config, 'name' | 'plugins' | 'rules'> & {
20
21
  * files overlap. Entries of one concern share its name and differ by `label`.
21
22
  */
22
23
  export declare function restrictions(entries: Restriction[]): Linter.Config[];
23
- //# sourceMappingURL=restrictions.d.ts.map
24
+ //#endregion
@@ -1,24 +1,20 @@
1
- import { builtinRules } from 'eslint/use-at-your-own-risk';
1
+ import { builtinRules } from "eslint/use-at-your-own-risk";
2
+ //#region src/restrictions.ts
2
3
  /**
3
- * The lint layer: structural rules a syntax or import check decides. Each concern is restricted through its own copy
4
- * of a core `no-restricted-*` rule, named `restrict/<name>`, because a later flat-config entry replaces an earlier
5
- * one's options for the same rule — two concerns sharing one core rule would silently drop each other wherever their
6
- * files overlap. Entries of one concern share its name and differ by `label`.
7
- */
8
- export function restrictions(entries) {
9
- return [
10
- {
11
- name: 'Lint layer',
12
- plugins: {
13
- restrict: {
14
- rules: Object.fromEntries(entries.map(({ name, rule }) => [name, builtinRules.get(rule)])),
15
- },
16
- },
17
- },
18
- ...entries.map(({ name, label, rule: _rule, options, ...entry }) => ({
19
- name: `Lint layer: ${label ? `${name} (${label})` : name}`,
20
- ...entry,
21
- rules: { [`restrict/${name}`]: ['error', ...options] },
22
- })),
23
- ];
4
+ * The lint layer: structural rules a syntax or import check decides. Each concern is restricted through its own copy
5
+ * of a core `no-restricted-*` rule, named `restrict/<name>`, because a later flat-config entry replaces an earlier
6
+ * one's options for the same rule — two concerns sharing one core rule would silently drop each other wherever their
7
+ * files overlap. Entries of one concern share its name and differ by `label`.
8
+ */
9
+ function restrictions(entries) {
10
+ return [{
11
+ name: "Lint layer",
12
+ plugins: { restrict: { rules: Object.fromEntries(entries.map(({ name, rule }) => [name, builtinRules.get(rule)])) } }
13
+ }, ...entries.map(({ name, label, rule: _rule, options, ...entry }) => ({
14
+ name: `Lint layer: ${label ? `${name} (${label})` : name}`,
15
+ ...entry,
16
+ rules: { [`restrict/${name}`]: ["error", ...options] }
17
+ }))];
24
18
  }
19
+ //#endregion
20
+ export { restrictions };
package/dist/yarn.cjs CHANGED
@@ -1,117 +1,98 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.defineYarnConfig = defineYarnConfig;
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region src/yarn.cts
4
3
  const DEFAULT_CONSISTENT_DEPENDENCIES = [
5
- '@types/node',
6
- '@types/react',
7
- '@types/react-dom',
8
- 'next',
9
- 'eslint',
10
- 'typescript',
11
- 'vite',
4
+ "@types/node",
5
+ "@types/react",
6
+ "@types/react-dom",
7
+ "next",
8
+ "eslint",
9
+ "typescript",
10
+ "vite"
11
+ ];
12
+ const ROOT_CWD = ".";
13
+ const DEPENDENCY_FIELDS = [
14
+ "dependencies",
15
+ "devDependencies",
16
+ "optionalDependencies",
17
+ "peerDependencies"
12
18
  ];
13
- const ROOT_CWD = '.';
14
- const DEPENDENCY_FIELDS = ['dependencies', 'devDependencies', 'optionalDependencies', 'peerDependencies'];
15
19
  function dependencyIdent(selector) {
16
- const match = selector.match(/(?:^|\/)((?:@[^/]+\/)?[^/@]+)(?:@.+)?$/);
17
- return match?.[1] ?? null;
20
+ return selector.match(/(?:^|\/)((?:@[^/]+\/)?[^/@]+)(?:@.+)?$/)?.[1] ?? null;
18
21
  }
19
22
  function rootDependencyRange(root, ident) {
20
- for (const field of DEPENDENCY_FIELDS) {
21
- const range = root.manifest[field]?.[ident];
22
- if (typeof range === 'string')
23
- return range;
24
- }
25
- return null;
23
+ for (const field of DEPENDENCY_FIELDS) {
24
+ const range = root.manifest[field]?.[ident];
25
+ if (typeof range === "string") return range;
26
+ }
27
+ return null;
26
28
  }
27
29
  function overrideRange(root, value) {
28
- if (!value.startsWith('$'))
29
- return value;
30
- const ident = value.slice(1);
31
- const range = rootDependencyRange(root, ident);
32
- if (range === null)
33
- root.error(`Override ${value} must reference a root dependency`);
34
- return range;
30
+ if (!value.startsWith("$")) return value;
31
+ const range = rootDependencyRange(root, value.slice(1));
32
+ if (range === null) root.error(`Override ${value} must reference a root dependency`);
33
+ return range;
35
34
  }
36
35
  function collectOverrides(root, overrides, ranges) {
37
- for (const [selector, value] of Object.entries(overrides)) {
38
- if (typeof value === 'string') {
39
- const ident = dependencyIdent(selector);
40
- const range = overrideRange(root, value);
41
- if (ident !== null && range !== null)
42
- ranges.set(ident, range);
43
- continue;
44
- }
45
- if (value === null || typeof value !== 'object' || Array.isArray(value)) {
46
- root.error(`Override ${selector} must be a string or object`);
47
- continue;
48
- }
49
- const nestedOverrides = value;
50
- if (typeof nestedOverrides['.'] === 'string') {
51
- const ident = dependencyIdent(selector);
52
- const range = overrideRange(root, nestedOverrides['.']);
53
- if (ident !== null && range !== null)
54
- ranges.set(ident, range);
55
- }
56
- collectOverrides(root, Object.fromEntries(Object.entries(nestedOverrides).filter(([nestedSelector]) => nestedSelector !== '.')), ranges);
57
- }
36
+ for (const [selector, value] of Object.entries(overrides)) {
37
+ if (typeof value === "string") {
38
+ const ident = dependencyIdent(selector);
39
+ const range = overrideRange(root, value);
40
+ if (ident !== null && range !== null) ranges.set(ident, range);
41
+ continue;
42
+ }
43
+ if (value === null || typeof value !== "object" || Array.isArray(value)) {
44
+ root.error(`Override ${selector} must be a string or object`);
45
+ continue;
46
+ }
47
+ const nestedOverrides = value;
48
+ if (typeof nestedOverrides["."] === "string") {
49
+ const ident = dependencyIdent(selector);
50
+ const range = overrideRange(root, nestedOverrides["."]);
51
+ if (ident !== null && range !== null) ranges.set(ident, range);
52
+ }
53
+ collectOverrides(root, Object.fromEntries(Object.entries(nestedOverrides).filter(([nestedSelector]) => nestedSelector !== ".")), ranges);
54
+ }
58
55
  }
59
56
  function collectResolutions(root, ranges) {
60
- for (const [selector, range] of Object.entries(root.manifest.resolutions ?? {})) {
61
- const ident = dependencyIdent(selector);
62
- if (ident === null || typeof range !== 'string') {
63
- root.error(`Resolution ${selector} must map to a string range`);
64
- continue;
65
- }
66
- ranges.set(ident, range);
67
- }
57
+ for (const [selector, range] of Object.entries(root.manifest.resolutions ?? {})) {
58
+ const ident = dependencyIdent(selector);
59
+ if (ident === null || typeof range !== "string") {
60
+ root.error(`Resolution ${selector} must map to a string range`);
61
+ continue;
62
+ }
63
+ ranges.set(ident, range);
64
+ }
68
65
  }
69
66
  function comparableDependencies(yarn, ident) {
70
- return yarn.dependencies({ ident }).filter((dependency) => dependency.type !== 'peerDependencies');
67
+ return yarn.dependencies({ ident }).filter((dependency) => dependency.type !== "peerDependencies");
71
68
  }
72
69
  function fallbackRange(root, dependencies) {
73
- const rootRange = dependencies.find((dependency) => dependency.workspace.cwd === ROOT_CWD)?.range;
74
- if (rootRange !== undefined)
75
- return rootRange;
76
- return [...dependencies].sort((a, b) => a.workspace.cwd.localeCompare(b.workspace.cwd) || a.type.localeCompare(b.type))[0]?.range;
70
+ const rootRange = dependencies.find((dependency) => dependency.workspace.cwd === ROOT_CWD)?.range;
71
+ if (rootRange !== void 0) return rootRange;
72
+ return [...dependencies].sort((a, b) => a.workspace.cwd.localeCompare(b.workspace.cwd) || a.type.localeCompare(b.type))[0]?.range;
77
73
  }
78
74
  /**
79
- * Build a Yarn JavaScript constraints config that mirrors root overrides and resolutions in leaf
80
- * dependency declarations. Without an overrides field, the default dependency set is kept on one
81
- * consistent range instead.
82
- */
75
+ * Build a Yarn JavaScript constraints config that mirrors root overrides and resolutions in leaf
76
+ * dependency declarations. Without an overrides field, the default dependency set is kept on one
77
+ * consistent range instead.
78
+ */
83
79
  function defineYarnConfig() {
84
- return {
85
- async constraints({ Yarn }) {
86
- const root = Yarn.workspace({ cwd: ROOT_CWD });
87
- if (root === null)
88
- throw new Error('Yarn constraints could not find the root workspace');
89
- const ranges = new Map();
90
- collectResolutions(root, ranges);
91
- if (Object.hasOwn(root.manifest, 'overrides')) {
92
- const overrides = root.manifest.overrides;
93
- if (overrides === null || typeof overrides !== 'object' || Array.isArray(overrides)) {
94
- root.error('Root overrides must be an object');
95
- }
96
- else {
97
- collectOverrides(root, overrides, ranges);
98
- }
99
- }
100
- else {
101
- for (const ident of DEFAULT_CONSISTENT_DEPENDENCIES) {
102
- if (ranges.has(ident))
103
- continue;
104
- const range = fallbackRange(root, comparableDependencies(Yarn, ident));
105
- if (range !== undefined)
106
- ranges.set(ident, range);
107
- }
108
- }
109
- for (const [ident, range] of ranges) {
110
- for (const dependency of comparableDependencies(Yarn, ident)) {
111
- if (dependency.workspace.cwd !== ROOT_CWD)
112
- dependency.update(range);
113
- }
114
- }
115
- },
116
- };
80
+ return { async constraints({ Yarn }) {
81
+ const root = Yarn.workspace({ cwd: ROOT_CWD });
82
+ if (root === null) throw new Error("Yarn constraints could not find the root workspace");
83
+ const ranges = /* @__PURE__ */ new Map();
84
+ collectResolutions(root, ranges);
85
+ if (Object.hasOwn(root.manifest, "overrides")) {
86
+ const overrides = root.manifest.overrides;
87
+ if (overrides === null || typeof overrides !== "object" || Array.isArray(overrides)) root.error("Root overrides must be an object");
88
+ else collectOverrides(root, overrides, ranges);
89
+ } else for (const ident of DEFAULT_CONSISTENT_DEPENDENCIES) {
90
+ if (ranges.has(ident)) continue;
91
+ const range = fallbackRange(root, comparableDependencies(Yarn, ident));
92
+ if (range !== void 0) ranges.set(ident, range);
93
+ }
94
+ for (const [ident, range] of ranges) for (const dependency of comparableDependencies(Yarn, ident)) if (dependency.workspace.cwd !== ROOT_CWD) dependency.update(range);
95
+ } };
117
96
  }
97
+ //#endregion
98
+ exports.defineYarnConfig = defineYarnConfig;
package/dist/yarn.d.cts CHANGED
@@ -1,8 +1,9 @@
1
- import type { Yarn } from '@yarnpkg/types';
1
+ import { Yarn } from "@yarnpkg/types";
2
+ //#region src/yarn.d.cts
2
3
  /**
3
4
  * Build a Yarn JavaScript constraints config that mirrors root overrides and resolutions in leaf
4
5
  * dependency declarations. Without an overrides field, the default dependency set is kept on one
5
6
  * consistent range instead.
6
7
  */
7
8
  export declare function defineYarnConfig(): Yarn.Config;
8
- //# sourceMappingURL=yarn.d.cts.map
9
+ //#endregion
package/package.json CHANGED
@@ -1,12 +1,13 @@
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.5.5",
4
+ "version": "0.6.0",
5
5
  "type": "module",
6
6
  "skipGenerate": true,
7
7
  "bin": {
8
8
  "lint-prepare": "./dist/lintPrepare.js",
9
- "spec-steward": "./skills/spec-steward/scripts/steward.mjs"
9
+ "spec-steward": "./skills/spec-steward/scripts/steward.mjs",
10
+ "spec-tools": "./spec-tools/dist/cli.mjs"
10
11
  },
11
12
  "main": "./dist/index.js",
12
13
  "module": "./dist/index.js",
@@ -33,17 +34,20 @@
33
34
  },
34
35
  "scripts": {
35
36
  "----- BUILD -----": "",
36
- "clean": "rm -rf dist .tscache tsconfig.tsbuildinfo",
37
- "build": "tsc --build",
38
- "start": "tsc --build --watch",
37
+ "clean": "rm -rf dist spec-tools/dist",
38
+ "build": "tsdown",
39
+ "start": "tsdown --watch",
39
40
  "----- TEST -----": "",
40
- "test": "yarn build && vitest run"
41
+ "typecheck": "tsc --noEmit",
42
+ "test": "yarn build && yarn typecheck && vitest run"
41
43
  },
42
44
  "files": [
43
45
  "dist",
46
+ "commands",
44
47
  "rules",
45
48
  "skills",
46
- "!skills/**/*.test.mjs"
49
+ "spec-tools/dist",
50
+ "!**/*.test.*"
47
51
  ],
48
52
  "dependencies": {
49
53
  "@eslint/config-helpers": "^0.7.0",
@@ -81,6 +85,10 @@
81
85
  "devDependencies": {
82
86
  "@types/eslint-plugin-jsx-a11y": "^6.10.1",
83
87
  "@types/eslint-plugin-promise": "^7.3.0",
88
+ "github-markdown-css": "^5.9.0",
89
+ "jsonrepair": "^3.15.0",
90
+ "marked": "^18.0.5",
91
+ "tsdown": "^0.23.0",
84
92
  "vitest": "^4.1.10"
85
93
  },
86
94
  "peerDependencies": {
@@ -129,6 +137,14 @@
129
137
  "nx": {
130
138
  "tags": [
131
139
  "platform:tooling"
132
- ]
140
+ ],
141
+ "targets": {
142
+ "build": {
143
+ "outputs": [
144
+ "{projectRoot}/dist",
145
+ "{projectRoot}/spec-tools/dist"
146
+ ]
147
+ }
148
+ }
133
149
  }
134
150
  }
package/rules/agent.md CHANGED
@@ -78,6 +78,8 @@ Prefer one authoritative location for each concern. Reference it elsewhere inste
78
78
  - Hard constraints
79
79
  - That must appear in scope by `paths` glob
80
80
  - Should be cited in `AGENTS.md` to ensure they're discoverable by harnesses that don't support `.xxx/rules` natively
81
+ - A `paths`-scoped rule loads only when the harness opens a matching file: before editing a file through a shell command, or in a repository other than the session's, read the rules whose `paths` match it
82
+ - Never judge configuration unused before reading the rule that names it
81
83
 
82
84
  # `.agents/skills`
83
85
 
package/rules/openspec.md CHANGED
@@ -9,4 +9,4 @@ paths:
9
9
  - A scenario adds one concrete case beyond its requirement, or it is not written
10
10
  - A rule shared by several repositories is worded identically in each
11
11
  - Before handing back a spec change run the repository's spec gate (AGENTS.md → Checks) and surface every `weakened` finding to the owner
12
- - Corpus-quality audits, review rounds and cross-repository alignment follow the `spec-steward` skill; a code-conformance audit is the repository's own, named in its AGENTS.md
12
+ - Corpus-quality audits, review rounds and cross-repository alignment follow the `spec-steward` skill; code conformance is the `spec-verify` skill's audit, run by `spec-tools`
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: spec-steward
3
- description: Guard, audit and repair an OpenSpec specification corpus. Use when auditing specs for corpus quality (the whole corpus, a change, or one capability), producing or processing a spec review file (review rounds where the owner answers items with ⬜ / ✅ / ❌), aligning rules shared by several repositories, wiring the spec guard (edit hook, AGENTS.md routing, OPSX config) into a repository, or when the repository's spec gate, `spec-steward check` or the edit hook reports a finding. Deterministic scripts do the mechanical work; the skill supplies the procedure. It does not audit code conformance; the repository's own conformance audit does — the `verify-spec` skill where the repository has one.
3
+ description: Guard, audit and repair an OpenSpec specification corpus — whether these are the right rules, in the right place, with the right evidence; it proposes spec changes and never fails a build. Use when auditing specs for corpus quality (the whole corpus, a change, or one capability), producing or processing a spec review file (review rounds where the owner answers items with ⬜ / ✅ / ❌), aligning rules shared by several repositories, wiring the spec guard (edit hook, AGENTS.md routing, OPSX config) into a repository, or when the repository's spec gate, `spec-steward check` or the edit hook reports a finding. Deterministic scripts do the mechanical work; the skill supplies the procedure. It does not audit code conformance; the `spec-verify` skill does. Writing a rule is the `/spec-author` command.
4
4
  ---
5
5
 
6
6
  # Spec steward
@@ -27,7 +27,7 @@ Procedures for an OpenSpec corpus. Four things live elsewhere and are not repeat
27
27
 
28
28
  ## Check
29
29
 
30
- Where the repository's `AGENTS.md` names a spec gate in its Checks list, such as `yarn spec:gates`, run that gate: it runs `steward check --base auto` with the repository's `--binds`. Elsewhere run `steward check --base auto` yourself. It compares the working tree with the branch point and checks the corpus and the files citing it. Add `--file <path>` to scope it, `--json` for machines, `--strict` to fail on warnings, and `--fix` for the safe mechanical repairs. A kind marked _base only_ runs only when a base is set, and under a base the prompts cover only what the diff added or edited.
30
+ Where the repository's `AGENTS.md` names a spec gate in its Checks list, such as `spec-tools gates`, run that gate: it runs `steward check --base auto` with the repository's binds. Elsewhere run `steward check --base auto` yourself. It compares the working tree with the branch point and checks the corpus and the files citing it. Add `--file <path>` to scope it, `--json` for machines, `--strict` to fail on warnings, and `--fix` for the safe mechanical repairs. A kind marked _base only_ runs only when a base is set, and under a base the prompts cover only what the diff added or edited.
31
31
 
32
32
  | Kind | Severity | What to do |
33
33
  | --- | --- | --- |
@@ -49,15 +49,7 @@ The exact rule behind each kind is in [contract.md](references/contract.md#kinds
49
49
 
50
50
  ## Audit
51
51
 
52
- Corpus-wide or affected-set, for corpus quality: placement, REQUIRED versus ⚠️ ADVISORY, evidence. The procedure, its parts and its verification are in [references/audit.md](references/audit.md). The output is a review file in the format of [references/review-format.md](references/review-format.md), and nothing in the specs or the code changes until the owner answers it.
53
-
54
- Mechanical inputs:
55
-
56
- - `steward check` (heuristic candidates)
57
- - `steward evidence --out <dir>`: per-capability bundles, starting from the tests bound to each scenario
58
- - `steward coverage --out <file>`: bindings, Advisory requirements and Known gaps per capability
59
- - `steward partition --out <dir> --parts N`
60
- - `steward index`: counts, and the citation inventory as bindings and pointers, with how many of them dangle
52
+ Local only, on the owner's request — CI runs this skill's `check` (inside `spec-tools gates`), `coverage` and `evidence`, never the audit. Corpus-wide or affected-set, for corpus quality: placement, REQUIRED versus ⚠️ ADVISORY, evidence. It runs on the engine `spec-verify` runs on — `spec-tools audit --audit spec-steward` — with this skill's [worker contract](references/worker.md) and [sweeps](sweeps.json). Pass the owner's earlier decisions with `--context <file>`. The procedure around it is [references/audit.md](references/audit.md). The output is a review file in the format of [references/review-format.md](references/review-format.md), and nothing in the specs or the code changes until the owner answers it.
61
53
 
62
54
  ## Apply
63
55
 
@@ -1,57 +1,32 @@
1
1
  # Audit procedure
2
2
 
3
- An audit asks whether the corpus holds the **right** rules with the **right** evidence. It judges by [model.md](model.md) and [criteria.md](criteria.md), places guidance by `rules/agent.md`, and produces a review file ([review-format.md](review-format.md)). Nothing in the specifications or the code changes during an audit. Whether the code conforms to the specifications is not its question; that is the repository's own conformance audit.
3
+ An audit asks whether the corpus holds the **right** rules with the **right** evidence. It judges by [model.md](model.md) and [criteria.md](criteria.md), places guidance by `rules/agent.md`, and produces a review file ([review-format.md](review-format.md)). Nothing in the specifications or the code changes during an audit. Whether the code conforms to the specifications is not its question; that is the `spec-verify` audit, and the principles both judge are worded once, in [criteria.md](criteria.md).
4
4
 
5
- ## 1. Mechanical inputs
5
+ ## 1. Run the engine
6
6
 
7
- Run these for every repository in scope. With several repositories, pass `--root NAME=path` for each.
7
+ Both audits run on one engine, `spec-tools` (the `spec-tools` skill), one repository per run; cross-repository wording drift is [align](../SKILL.md#align). The whole sequence, from a detached tree of `HEAD` (`--here` for uncommitted edits):
8
8
 
9
- - `steward check` (add `--base auto` or `--base <ref>` for a change): heuristic candidates. They are leads, not verdicts.
10
- - `steward index`: counts (capabilities, requirements, Advisory requirements, Known gaps, scenarios), and the citation inventory split into bindings and pointers, with how many of them dangle.
11
- - `steward evidence --out <dir>`: one bundle per capability. A bundle holds each requirement verbatim with line numbers, the tests bound to its scenarios ([contract.md](contract.md#binding)), code citations as pointers, where its terms occur, and related requirements across capabilities and repositories.
12
- - `steward coverage --out <file>`: bindings, Advisory requirements and Known gaps per capability.
13
- - The repository's own gates and reports, when it has them.
9
+ ```bash
10
+ spec-tools audit --audit spec-steward --context <decisions file>
11
+ ```
14
12
 
15
- ## 2. Fan out
13
+ It runs locally, on the owner's request; no pipeline runs it. `--context` passes a file of facts already established and the owner's earlier decisions — earlier review answers, the decision log — into every worker's and verifier's brief, so no finding reverses one without saying so.
16
14
 
17
- One reader cannot hold a corpus, so partition it.
15
+ It runs these passes, each also a command of its own:
18
16
 
19
- - **Parts.** Group a handful of related capabilities per part, and keep same-named capabilities from different repositories together so drift is judged in place. `steward partition --parts N` balances by size. Hand-made parts are fine when the architecture suggests better groups.
20
- - **Sweeps.** Each sweep looks across the corpus from one angle:
21
- - tooling and CI
22
- - tests citing the corpus (compliance theatre)
23
- - comments and citations
24
- - a whole-corpus reader for duplicates, contradictions and cross-repository wording
25
- - missing invariants
26
- - the CI run classes
27
- - placement against `rules/agent.md` (duplicated concerns, AGENTS.md hierarchy, scoped rules, skills)
28
- - **Maps first.** An architecture map, an enforcement map and the owner's decision history go to every reader, so no one re-derives them.
17
+ 1. `spec-tools scope --audit spec-steward` — spec-steward's evidence model, cut into parts one reader holds (each capability's requirements verbatim, the tests bound to them, where their terms occur, their related requirements), plus one unit per [sweep](../sweeps.json): tooling and CI, tests citing the corpus, comments and citations, missing invariants, placement.
18
+ 2. `spec-tools workers --audit spec-steward` — one headless worker per unit under [worker.md](worker.md), judging every criterion and writing its findings file, with the requirements it judged and those it found sound.
19
+ 3. `spec-tools report --audit spec-steward` — the merge: every quote looked up at its line (a finding whose quote is not there is dropped, saying so); the requirements no worker judged listed as short.
20
+ 4. `spec-tools workers --complete --audit spec-steward` — what the reading left short, judged once more; then the merge again.
21
+ 5. `spec-tools workers --verify --audit spec-steward` — one skeptic per finding: it keeps, revises or drops for silent intent, a non-spec problem, compliance theatre, a misplaced contract, the wrong layer, an unstated reversal of an owner decision, or a false claim about code. Then the last merge folds duplicates (one rule, one problem), offers findings sharing a theme key as a theme, and renders `spec-review.md`.
29
22
 
30
- With Claude Code's Workflow tool, run [`workflows/audit.js`](../workflows/audit.js). It takes the arguments documented at its top and returns verified, consolidated findings and themes. Without it, start one subagent per part and per sweep in waves, give each this procedure and its files, and run the verification below yourself.
23
+ The run's data, kept for the next step, is `audit-parts/steward/review.json`: the themes and findings, the dropped findings with who dropped them and why, the requirements judged sound, the short list and the workers' notes.
31
24
 
32
- ## 3. Verify every finding twice
25
+ ## 2. Consolidate and hand back
33
26
 
34
- 1. **Facts.** Is the quote verbatim at its line? Are the evidence references real, and does the code or test do what the finding claims?
35
- 2. **Judgement.** The verifier acts as a skeptic and looks for these failures:
36
- - **silent intent**: the finding decides an ambiguous intent without saying so. Revise it to offer options.
37
- - **not a spec problem**: style, an ordinary bug, or speculation. Drop it.
38
- - **compliance theatre**: the proposed verification catches no real failure. Revise or drop.
39
- - **misplaced contract**: an internal contract moved out of the spec only because it is not user-facing. Revise.
40
- - **wrong layer**. Revise.
41
- - **unstated reversal** of a past owner decision. Revise to state it.
42
- - **duplicate**. Drop the weaker one.
43
-
44
- ## 4. Completeness
45
-
46
- A critic looks for capabilities with neither findings nor a sound list, criteria that yielded nothing where the corpus plainly has cases, unread sources, and shared capabilities not compared. Its gaps become targeted follow-up units. Loop until a round finds nothing new; two rounds is usually enough.
47
-
48
- ## 5. Consolidate and render
49
-
50
- - **Merge duplicates per area.** The same rule with the same problem becomes one finding.
51
- - **Form themes.** Several rules with one solution become one item with members.
52
- - **Render** with `steward review render <result.json> --out <review.md> [--sections layout.json]`.
53
- - **Check** with `steward review lint` and `steward review verify --root NAME=path …`.
54
- - **Read every item yourself**: sharpen the wording, fix what the readers got wrong, and order the sections so decisions that others depend on come first.
27
+ - **Read every item yourself**: sharpen the wording, fix what the readers got wrong, and decide each offered theme — keep it as one item when its members share one solution, split it when they do not.
28
+ - **Order the sections** so decisions that others depend on come first.
55
29
  - **Close with an appendix** listing the requirements judged sound, so coverage is visible.
30
+ - **Check** with `steward review lint` and `steward review verify --root NAME=path …`.
56
31
 
57
32
  Hand the file to the owner and stop.