@kirill.konshin/lint 0.5.4 → 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.
- package/README.md +47 -7
- package/commands/spec-author.md +39 -0
- package/dist/configs/base.d.ts +4 -3
- package/dist/configs/base.js +61 -74
- package/dist/configs/imports.d.ts +3 -2
- package/dist/configs/imports.js +95 -146
- package/dist/configs/nx.d.ts +4 -3
- package/dist/configs/nx.js +31 -41
- package/dist/configs/prettier.d.ts +3 -2
- package/dist/configs/prettier.js +19 -16
- package/dist/configs/promise.d.ts +3 -2
- package/dist/configs/promise.js +16 -16
- package/dist/configs/react.d.ts +4 -3
- package/dist/configs/react.js +178 -217
- package/dist/configs/storybook.d.ts +4 -3
- package/dist/configs/storybook.js +22 -22
- package/dist/configs/tailwind.d.ts +4 -3
- package/dist/configs/tailwind.js +67 -91
- package/dist/configs/testing.d.ts +7 -6
- package/dist/configs/testing.js +112 -136
- package/dist/configs/turbo.d.ts +4 -3
- package/dist/configs/turbo.js +19 -27
- package/dist/configs/typescriptTypeAware.d.ts +4 -3
- package/dist/configs/typescriptTypeAware.js +99 -95
- package/dist/configs/unicorn.d.ts +3 -2
- package/dist/configs/unicorn.js +34 -41
- package/dist/exts.d.ts +2 -1
- package/dist/exts.js +10 -11
- package/dist/index.d.ts +44 -41
- package/dist/index.js +53 -84
- package/dist/lib.d.ts +21 -21
- package/dist/lib.js +261 -301
- package/dist/lintPrepare.d.ts +33 -28
- package/dist/lintPrepare.js +347 -376
- package/dist/lintStaged.d.ts +4 -3
- package/dist/lintStaged.js +25 -22
- package/dist/prettier.d.ts +4 -3
- package/dist/prettier.js +16 -17
- package/dist/restrictions.d.ts +24 -0
- package/dist/restrictions.js +20 -0
- package/dist/yarn.cjs +79 -98
- package/dist/yarn.d.cts +3 -2
- package/package.json +24 -8
- package/rules/agent.md +7 -4
- package/rules/openspec.md +1 -1
- package/skills/spec-steward/SKILL.md +4 -12
- package/skills/spec-steward/references/audit.md +18 -43
- package/skills/spec-steward/references/contract.md +7 -7
- package/skills/spec-steward/references/criteria.md +4 -4
- package/skills/spec-steward/references/model.md +1 -1
- package/skills/spec-steward/references/review-format.md +6 -6
- package/skills/spec-steward/references/wiring.md +4 -4
- package/skills/spec-steward/references/worker.md +67 -0
- package/skills/spec-steward/scripts/lib/align.mjs +7 -6
- package/skills/spec-steward/scripts/lib/checks.mjs +6 -1
- package/skills/spec-steward/scripts/lib/corpus.mjs +5 -8
- package/skills/spec-steward/scripts/lib/coverage.mjs +2 -3
- package/skills/spec-steward/scripts/lib/evidence.mjs +2 -148
- package/skills/spec-steward/scripts/lib/wire.mjs +6 -4
- package/skills/spec-steward/scripts/steward.mjs +30 -91
- package/skills/spec-steward/sweeps.json +49 -0
- package/skills/spec-tools/SKILL.md +46 -0
- package/skills/spec-tools/references/contract.md +111 -0
- package/skills/spec-tools/references/gitlab.md +122 -0
- package/skills/spec-verify/SKILL.md +153 -0
- package/spec-tools/dist/audit-DkZZulq6.mjs +130 -0
- package/spec-tools/dist/auditChanged-CNGjlake.mjs +1 -0
- package/spec-tools/dist/auditChanged-CZCvMgyZ.mjs +618 -0
- package/spec-tools/dist/auditReport-xgq4wK2i.mjs +458 -0
- package/spec-tools/dist/auditScope-CBuBtfPG.mjs +104 -0
- package/spec-tools/dist/changeGates-DdeQKfle.mjs +333 -0
- package/spec-tools/dist/changeGates-uy4Ti8rK.mjs +1 -0
- package/spec-tools/dist/ci-BUewHJS3.mjs +143 -0
- package/spec-tools/dist/ci-CFBzn8Of.mjs +1 -0
- package/spec-tools/dist/cli.mjs +93 -0
- package/spec-tools/dist/comment-szasMMg2.mjs +57 -0
- package/spec-tools/dist/files-Bppsb34B.mjs +1 -0
- package/spec-tools/dist/files-QlzY687_.mjs +38 -0
- package/spec-tools/dist/html-BMTkpbUN.mjs +1766 -0
- package/spec-tools/dist/jsonrepair-Dlm5dEen.mjs +742 -0
- package/spec-tools/dist/repo-CjIoUPYl.mjs +16 -0
- package/spec-tools/dist/repo-DUcnJw3c.mjs +1 -0
- package/spec-tools/dist/run-BElA9du3.mjs +67 -0
- package/spec-tools/dist/specDiff-8G56jMYn.mjs +123 -0
- package/spec-tools/dist/steward-DeieyOcj.mjs +34 -0
- package/spec-tools/dist/stewardAudit-BRMM0lrD.mjs +1 -0
- package/spec-tools/dist/stewardAudit-v0vOMfLN.mjs +271 -0
- package/spec-tools/dist/tier-Cn0P7juM.mjs +1 -0
- package/spec-tools/dist/tier-c3s_mA_I.mjs +65 -0
- package/spec-tools/dist/util-wnxhsnWO.mjs +49 -0
- package/spec-tools/dist/verdict-BFfN9PO8.mjs +58 -0
- package/spec-tools/dist/workers-BcIgckeq.mjs +417 -0
- package/spec-tools/dist/workflowEvidence-DyBj8EdG.mjs +1 -0
- package/spec-tools/dist/workflowEvidence-oui6ghPI.mjs +78 -0
- package/dist/configs/base.d.ts.map +0 -1
- package/dist/configs/imports.d.ts.map +0 -1
- package/dist/configs/nx.d.ts.map +0 -1
- package/dist/configs/prettier.d.ts.map +0 -1
- package/dist/configs/promise.d.ts.map +0 -1
- package/dist/configs/react.d.ts.map +0 -1
- package/dist/configs/storybook.d.ts.map +0 -1
- package/dist/configs/tailwind.d.ts.map +0 -1
- package/dist/configs/testing.d.ts.map +0 -1
- package/dist/configs/turbo.d.ts.map +0 -1
- package/dist/configs/typescriptTypeAware.d.ts.map +0 -1
- package/dist/configs/unicorn.d.ts.map +0 -1
- package/dist/exts.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/lib.d.ts.map +0 -1
- package/dist/lintPrepare.d.ts.map +0 -1
- package/dist/lintStaged.d.ts.map +0 -1
- package/dist/prettier.d.ts.map +0 -1
- package/dist/yarn.d.cts.map +0 -1
- package/skills/spec-steward/workflows/audit.js +0 -539
package/dist/lintStaged.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
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:
|
|
22
|
-
//#
|
|
22
|
+
export declare const listStaged: Configuration;
|
|
23
|
+
//#endregion
|
package/dist/lintStaged.js
CHANGED
|
@@ -1,24 +1,27 @@
|
|
|
1
|
-
import { markupExtsRaw, prettierExtsRaw, tsExts } from
|
|
1
|
+
import { markupExtsRaw, prettierExtsRaw, tsExts } from "./exts.js";
|
|
2
|
+
//#region src/lintStaged.ts
|
|
2
3
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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 };
|
package/dist/prettier.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import
|
|
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:
|
|
7
|
-
//#
|
|
7
|
+
export declare const prettier: Config;
|
|
8
|
+
//#endregion
|
package/dist/prettier.js
CHANGED
|
@@ -1,19 +1,18 @@
|
|
|
1
|
-
import { eslintExts } from
|
|
1
|
+
import { eslintExts } from "./exts.js";
|
|
2
|
+
//#region src/prettier.ts
|
|
2
3
|
/**
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
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 };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Linter } from "eslint";
|
|
2
|
+
//#region src/restrictions.d.ts
|
|
3
|
+
/**
|
|
4
|
+
* One structural restriction: a core `no-restricted-*` rule applied under a concern of its own, with the files it
|
|
5
|
+
* governs. Every other field is a flat-config entry field (`files`, `ignores`, ...).
|
|
6
|
+
*/
|
|
7
|
+
export type Restriction = Omit<Linter.Config, 'name' | 'plugins' | 'rules'> & {
|
|
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[];
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* The lint layer: structural rules a syntax or import check decides. Each concern is restricted through its own copy
|
|
19
|
+
* of a core `no-restricted-*` rule, named `restrict/<name>`, because a later flat-config entry replaces an earlier
|
|
20
|
+
* one's options for the same rule — two concerns sharing one core rule would silently drop each other wherever their
|
|
21
|
+
* files overlap. Entries of one concern share its name and differ by `label`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function restrictions(entries: Restriction[]): Linter.Config[];
|
|
24
|
+
//#endregion
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { builtinRules } from "eslint/use-at-your-own-risk";
|
|
2
|
+
//#region src/restrictions.ts
|
|
3
|
+
/**
|
|
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
|
+
}))];
|
|
18
|
+
}
|
|
19
|
+
//#endregion
|
|
20
|
+
export { restrictions };
|
package/dist/yarn.cjs
CHANGED
|
@@ -1,117 +1,98 @@
|
|
|
1
|
-
"
|
|
2
|
-
|
|
3
|
-
exports.defineYarnConfig = defineYarnConfig;
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
//#region src/yarn.cts
|
|
4
3
|
const DEFAULT_CONSISTENT_DEPENDENCIES = [
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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
|
-
|
|
17
|
-
return match?.[1] ?? null;
|
|
20
|
+
return selector.match(/(?:^|\/)((?:@[^/]+\/)?[^/@]+)(?:@.+)?$/)?.[1] ?? null;
|
|
18
21
|
}
|
|
19
22
|
function rootDependencyRange(root, ident) {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
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
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
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
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
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
|
-
|
|
67
|
+
return yarn.dependencies({ ident }).filter((dependency) => dependency.type !== "peerDependencies");
|
|
71
68
|
}
|
|
72
69
|
function fallbackRange(root, dependencies) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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
|
-
|
|
80
|
-
|
|
81
|
-
|
|
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
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
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
|
|
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
|
-
//#
|
|
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.
|
|
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
|
|
37
|
-
"build": "
|
|
38
|
-
"start": "
|
|
37
|
+
"clean": "rm -rf dist spec-tools/dist",
|
|
38
|
+
"build": "tsdown",
|
|
39
|
+
"start": "tsdown --watch",
|
|
39
40
|
"----- TEST -----": "",
|
|
40
|
-
"
|
|
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
|
-
"
|
|
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
|
@@ -68,7 +68,7 @@ Prefer one authoritative location for each concern. Reference it elsewhere inste
|
|
|
68
68
|
|
|
69
69
|
# `.agents/rules`
|
|
70
70
|
|
|
71
|
-
- `.agents/rules` must be accompanied by symlinks in `.claude/rules`
|
|
71
|
+
- `.agents/rules` must be accompanied by symlinks in `.claude/rules`
|
|
72
72
|
- Files should be scoped to certain paths
|
|
73
73
|
- Files should be small,
|
|
74
74
|
- Examples not allowed in general
|
|
@@ -78,10 +78,12 @@ 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
|
|
|
84
|
-
- `.agents/skills` must be accompanied by symlinks in `.claude/skills`
|
|
86
|
+
- `.agents/skills` must be accompanied by symlinks in `.claude/skills`
|
|
85
87
|
- May define either
|
|
86
88
|
- A workflow
|
|
87
89
|
- A process
|
|
@@ -94,7 +96,7 @@ Prefer one authoritative location for each concern. Reference it elsewhere inste
|
|
|
94
96
|
|
|
95
97
|
# `.agents/commands`
|
|
96
98
|
|
|
97
|
-
- `.agents/commands` must be accompanied by symlinks in `.claude/commands`
|
|
99
|
+
- `.agents/commands` must be accompanied by symlinks in `.claude/commands`
|
|
98
100
|
- Smaller and simpler than skills
|
|
99
101
|
- One-off commands, not flows
|
|
100
102
|
|
|
@@ -104,7 +106,7 @@ Prefer one authoritative location for each concern. Reference it elsewhere inste
|
|
|
104
106
|
- User facing or externally observable behavior
|
|
105
107
|
- Durable component/system/API contracts & invariants
|
|
106
108
|
- Not general coding instructions
|
|
107
|
-
- Openspec-specific instructions must assume that flow WAS ENTERED, thus `AGENTS.md` or `[.agents|.claude
|
|
109
|
+
- Openspec-specific instructions must assume that flow WAS ENTERED, thus `AGENTS.md` or `[.agents|.claude]/skills` must be used to define how to enter the flow, and how flow should look like from outside perspective (without details)
|
|
108
110
|
- `openspec/config.yml#context` - should only have very narrow instructions for OpenSpec specifically, when user entered flow
|
|
109
111
|
- Context will already contain root `AGENTS.md`, no duplication needed
|
|
110
112
|
- `openspec/config.yml#rules.[specs|proposal]` - very narrow sets of rules specifically for defined part of the flow when it's entered
|
|
@@ -115,6 +117,7 @@ Prefer one authoritative location for each concern. Reference it elsewhere inste
|
|
|
115
117
|
- Requirements and scenarios should (preferrably) be proven by tests, and may be cited in tests for stronger connection
|
|
116
118
|
- Tests should be validated that they do what spec says (optional, unless project mandates this in root `AGENTS.md`)
|
|
117
119
|
- Code citations must resolve, not checked for validity
|
|
120
|
+
- Comments, descriptions, prompt or documentation text, and citations are not evidence that code complies, and their absence or wording is never a violation
|
|
118
121
|
|
|
119
122
|
# Common for `AGENTS.md` `.agents/rules` `.agents/skills`
|
|
120
123
|
|
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;
|
|
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
|
|
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 `
|
|
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
|
| --- | --- | --- |
|
|
@@ -37,7 +37,7 @@ Where the repository's `AGENTS.md` names a spec gate in its Checks list, such as
|
|
|
37
37
|
| `duplicate-requirement` | error | One requirement name in two capabilities, or one body twice. Keep it in the capability that owns the behaviour and reference it from the other. |
|
|
38
38
|
| `size` | error past 500 words or 8 obligations, info past 300 or 5 | Split the requirement into coherent areas, never into one requirement per sentence ([model](references/model.md#tests-and-scenarios)). |
|
|
39
39
|
| `scenario-unproven` | error, base only | A scenario you added or edited in a REQUIRED requirement has no binding. Cite it where its test, type assertion, lint entry or check proves it ([binding](references/contract.md#binding)); a test you add must catch a regression of that case. If no evidence can, the requirement takes a Known gap naming the scenario, or becomes ⚠️ ADVISORY — the owner's call. |
|
|
40
|
-
| `weakened` | warn, base only | A rule was removed, lowered (MUST → SHOULD), lost an absolute, gained an exception or became advisory. **Stop and ask the owner** — unless they asked for exactly this. |
|
|
40
|
+
| `weakened` | warn, base only | A rule was removed, lowered (MUST → SHOULD), lost an absolute, gained an exception or became advisory. **Stop and ask the owner** — unless they asked for exactly this. In a hand-back, map each finding to the decision that authorised it (a review item, a ticket, the owner's word) and list only the unmatched ones for a decision; a verbatim move is already reported as a rename. |
|
|
41
41
|
| `textual-test` | warn | The test asserts on source, spec or doc text. Prefer a behavioural test, or a deterministic tool for structure. |
|
|
42
42
|
| `marker-hygiene` | warn | `--fix` normalises a misspelt marker. A retired `**⚠️ Unenforced:**`, or a Known gap without a tracker, exempts nothing: replace it with Advisory, a tracked Known gap, or nothing, as the [model](references/model.md#advisory-known-gap-or-neither) says, and ask the owner, because each is a reclassification. |
|
|
43
43
|
| `new-requirement` | info, base only | Say, in your reply, which observable failure it prevents and what cheapest evidence catches it. If there is none, it is advisory or belongs elsewhere. |
|
|
@@ -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.
|
|
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
|
|