@kirill.konshin/lint 0.5.3 → 0.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -5
- package/dist/configs/testing.d.ts.map +1 -1
- package/dist/configs/testing.js +10 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/lintPrepare.d.ts +20 -21
- package/dist/lintPrepare.d.ts.map +1 -1
- package/dist/lintPrepare.js +53 -62
- package/dist/restrictions.d.ts +23 -0
- package/dist/restrictions.d.ts.map +1 -0
- package/dist/restrictions.js +24 -0
- package/package.json +1 -1
- package/rules/agent.md +5 -4
- package/rules/github.md +0 -76
- package/rules/gitlab.md +0 -72
- package/rules/nextjs.md +2 -55
- package/rules/storybook.md +2 -0
- package/rules/tailwind.md +1 -1
- package/rules/webstorm.md +6 -214
- package/skills/lint-github/SKILL.md +78 -0
- package/skills/lint-gitlab/SKILL.md +76 -0
- package/skills/lint-nextjs/SKILL.md +59 -0
- package/skills/{lint-repo.md → lint-repo/SKILL.md} +1 -1
- package/skills/lint-webstorm/SKILL.md +201 -0
- package/skills/lint-worktree/SKILL.md +28 -0
- package/skills/spec-steward/SKILL.md +1 -1
- package/skills/spec-steward/references/contract.md +4 -4
- package/skills/spec-steward/references/model.md +1 -1
- package/skills/spec-steward/references/wiring.md +2 -2
- 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 +4 -7
- package/skills/spec-steward/scripts/lib/coverage.mjs +2 -3
- package/skills/spec-steward/scripts/lib/evidence.mjs +0 -1
package/README.md
CHANGED
|
@@ -77,6 +77,11 @@ Create `.prettierignore` file:
|
|
|
77
77
|
.idea
|
|
78
78
|
.husky
|
|
79
79
|
.yarn
|
|
80
|
+
|
|
81
|
+
# OpenSpec writes these; they stay exactly as `openspec update` leaves them
|
|
82
|
+
.agents/skills/openspec-*
|
|
83
|
+
.claude/skills/openspec-*
|
|
84
|
+
.claude/commands/opsx
|
|
80
85
|
```
|
|
81
86
|
|
|
82
87
|
https://prettier.io/docs/ignore:
|
|
@@ -329,15 +334,15 @@ The generated `AGENTS.md` has a `# Custom Rules` section at the bottom — add p
|
|
|
329
334
|
|
|
330
335
|
In the project root, `lint-prepare`:
|
|
331
336
|
|
|
332
|
-
- Creates real `rules/`, `commands/` and `skills/` directories in `.agents/` (canonical, cross-tool)
|
|
333
|
-
- Links every `rules/*.md` and skill (`skills/<name
|
|
334
|
-
- Mirrors your own files from `.agents/{rules,commands,skills}/` into `.claude
|
|
337
|
+
- Creates real `rules/`, `commands/` and `skills/` directories in `.agents/` (canonical, cross-tool) and `.claude/` (Claude Code), and only ever symlinks files into them.
|
|
338
|
+
- Links every `rules/*.md` and every skill folder (`skills/<name>/` with all its files, plus this `README.md` next to `SKILL.md` unless the skill ships one, so a skill can reference `@README.md`) into all three — e.g. `lint-repo`, which sets up the tooling above and audits the repo against the rules. Links point straight at the installed package's real location (`node_modules/@kirill.konshin/lint`, or the workspace package).
|
|
339
|
+
- Mirrors your own files from `.agents/{rules,commands,skills}/` into `.claude/`; a file of yours wins over the package file at the same path.
|
|
335
340
|
- Removes dead links (e.g. after renaming a file) and the links it placed before but no longer needs. Each directory gets a generated `.gitignore` listing its links, so your own files stay tracked.
|
|
336
|
-
- Generates `AGENTS.md` for other assistants (Codex, Cursor, Copilot, …) with a `# Rules` section — per rule (the package's and yours)
|
|
341
|
+
- Generates `AGENTS.md` for other assistants (Codex, Cursor, Copilot, …) with a `# Rules` section — one entry per rule (the package's and yours): its title, frontmatter `description`, the `paths` it is scoped to and a plain link to its `.agents/rules/<file>` entry — and symlinks `CLAUDE.md` to it. The links are never `@` imports: Claude Code loads `.claude/rules` itself and honours each rule's `paths`, while an import would load every rule into every session.
|
|
337
342
|
|
|
338
343
|
### Safety checks
|
|
339
344
|
|
|
340
|
-
Only the files `lint-prepare` knows (package files and mirrors of yours) and dead links are touched: real files are never overwritten (e.g. your own `.claude/rules/*.md
|
|
345
|
+
Only the files `lint-prepare` knows (package files and mirrors of yours) and dead links are touched: real files are never overwritten (e.g. your own `.claude/rules/*.md`) and nothing is written through a symlinked directory. `.codex/` is not touched: Codex reads `.agents/skills` and `AGENTS.md`, and the links earlier versions placed in `.codex/` stay until you delete them. `init`/`update` refuse to run if `CLAUDE.md` isn't a symlink. If `AGENTS.md` exists and wasn't generated by this tool, `init` skips it; use `update` to force regeneration.
|
|
341
346
|
|
|
342
347
|
## Migration
|
|
343
348
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../src/configs/testing.ts"],"names":[],"mappings":"AAYA,OAAO,YAAY,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,EAAE,MAAM,EAAQ,MAAM,QAAQ,CAAC;AAC3C,OAAO,UAAU,MAAM,oBAAoB,CAAC;AAG5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC;AA6DpC;;;GAGG;AACH,wBAAgB,UAAU,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,aAAa,EAAE,MAAM,UAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,CAgB5F;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,aAAa,EAAE,MAAM,UAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"testing.d.ts","sourceRoot":"","sources":["../../src/configs/testing.ts"],"names":[],"mappings":"AAYA,OAAO,YAAY,MAAM,uBAAuB,CAAC;AACjD,OAAO,KAAK,EAAE,MAAM,EAAQ,MAAM,QAAQ,CAAC;AAC3C,OAAO,UAAU,MAAM,oBAAoB,CAAC;AAG5C,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGjD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,CAAC;AA6DpC;;;GAGG;AACH,wBAAgB,UAAU,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,aAAa,EAAE,MAAM,UAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,CAgB5F;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,aAAa,EAAE,MAAM,UAAQ,GAAG,MAAM,CAAC,MAAM,EAAE,CAgC9F;AAED;;;;GAIG;AACH,wBAAgB,UAAU,IAAI,MAAM,CAAC,MAAM,EAAE,CAmB5C"}
|
package/dist/configs/testing.js
CHANGED
|
@@ -110,6 +110,16 @@ export function vitestConfig(option, strict = false) {
|
|
|
110
110
|
...vitestPlugin.configs.recommended,
|
|
111
111
|
name: 'Vitest Rules',
|
|
112
112
|
files: [`**/*.{test,spec}.${tsExts}`],
|
|
113
|
+
rules: {
|
|
114
|
+
...vitestPlugin.configs.recommended.rules,
|
|
115
|
+
// `expectTypeOf` and `assertType` are assertions too: a type test proves its contract without a runtime
|
|
116
|
+
// expect. Listed here rather than through the plugin's `typecheck` setting, which makes other rules demand
|
|
117
|
+
// type information.
|
|
118
|
+
'vitest/expect-expect': [
|
|
119
|
+
'error',
|
|
120
|
+
{ assertFunctionNames: ['expect', 'assert', 'expectTypeOf', 'assertType'] },
|
|
121
|
+
],
|
|
122
|
+
},
|
|
113
123
|
},
|
|
114
124
|
{
|
|
115
125
|
...vitestPlugin.configs.env,
|
package/dist/index.d.ts
CHANGED
|
@@ -15,6 +15,7 @@ export * from './configs/typescriptTypeAware.js';
|
|
|
15
15
|
export * from './configs/unicorn.js';
|
|
16
16
|
export * from './exts.js';
|
|
17
17
|
export * from './lib.js';
|
|
18
|
+
export * from './restrictions.js';
|
|
18
19
|
export * from './lintStaged.js';
|
|
19
20
|
export * from './prettier.js';
|
|
20
21
|
type ProjectServiceOptions = Exclude<NonNullable<TsParserOptions['projectService']>, boolean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ACA,qBAAqB,EACrB,qBAAqB,GAAG,iEAAiE,CAC5F,GAAG;IACA,eAAe,CAAC,EAAE,eAAe,CAAC,iBAAiB,CAAC,CAAC;CACxD,CAAC;AAEN,MAAM,MAAM,oBAAoB,GAC5B;IAAE,OAAO,EAAE,KAAK,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG;IAAE,OAAO,CAAC,EAAE,IAAI,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,CAAC;AAE3F,MAAM,MAAM,WAAW,GAAG;IACtB,SAAS,CAAC,EAAE,OAAO,GAAG,gBAAgB,CAAC;IACvC,IAAI,CAAC,EAAE,OAAO,GAAG,WAAW,CAAC;IAC7B,SAAS,CAAC,EAAE,OAAO,GAAG,aAAa,CAAC;IACpC,KAAK,CAAC,EAAE,OAAO,GAAG,aAAa,CAAC;IAChC,EAAE,CAAC,EAAE,OAAO,GAAG,aAAa,CAAC;IAC7B,IAAI,CAAC,EAAE,OAAO,GAAG,aAAa,CAAC;IAC/B,MAAM,CAAC,EAAE,OAAO,GAAG,aAAa,CAAC;IACjC,QAAQ,CAAC,EAAE,OAAO,GAAG,eAAe,CAAC;IACrC,SAAS,CAAC,EAAE,OAAO,GAAG,gBAAgB,CAAC;IACvC,aAAa,CAAC,EAAE,OAAO,GAAG,oBAAoB,CAAC;CAClD,CAAC;AAEF;;;;;;;;;GASG;AACH,wBAAsB,gBAAgB,CAClC,OAAO,GAAE,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC,CAAM,GAC9F,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAgD1B"}
|
package/dist/index.js
CHANGED
|
@@ -25,6 +25,7 @@ export * from './configs/typescriptTypeAware.js';
|
|
|
25
25
|
export * from './configs/unicorn.js';
|
|
26
26
|
export * from './exts.js';
|
|
27
27
|
export * from './lib.js';
|
|
28
|
+
export * from './restrictions.js';
|
|
28
29
|
export * from './lintStaged.js';
|
|
29
30
|
export * from './prettier.js';
|
|
30
31
|
/**
|
package/dist/lintPrepare.d.ts
CHANGED
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
* @kirill.konshin/lint
|
|
4
4
|
*
|
|
5
5
|
* This script makes `rules`, `commands` and `skills` real directories in the consuming project's
|
|
6
|
-
* `.agents` (canonical, cross-tool)
|
|
7
|
-
* file symlinks only: package rules and skills (
|
|
8
|
-
* so a skill can reference `@README.md
|
|
9
|
-
* at the installed
|
|
10
|
-
* package; the user's own files in `.agents` are mirrored into `.claude` and `.codex`. It also
|
|
6
|
+
* `.agents` (canonical, cross-tool) and `.claude` (Claude Code), and fills them with
|
|
7
|
+
* file symlinks only: package rules and skills (every file a skill folder ships, plus the package
|
|
8
|
+
* README.md next to its SKILL.md, so a skill can reference `@README.md`) go into both, pointing
|
|
9
|
+
* straight at the installed package; the user's own files in `.agents` are mirrored into `.claude`. It also
|
|
11
10
|
* generates an `AGENTS.md` file for other tools, with `CLAUDE.md` symlinked to `AGENTS.md`.
|
|
12
11
|
*
|
|
13
12
|
* Usage:
|
|
@@ -18,16 +17,18 @@
|
|
|
18
17
|
* The module also exports its functions and only runs `main()` when executed directly,
|
|
19
18
|
* so it can be imported (for testing/reuse) without side effects.
|
|
20
19
|
*/
|
|
20
|
+
/**
|
|
21
|
+
* A rule file. `paths` scopes it: Claude Code loads it only for matching files.
|
|
22
|
+
*/
|
|
21
23
|
type Rule = {
|
|
22
24
|
file: string;
|
|
23
25
|
name: string;
|
|
24
26
|
description?: string;
|
|
27
|
+
paths?: string[];
|
|
25
28
|
content: string;
|
|
26
29
|
};
|
|
27
30
|
type Skill = {
|
|
28
|
-
file: string;
|
|
29
31
|
name: string;
|
|
30
|
-
folder?: boolean;
|
|
31
32
|
};
|
|
32
33
|
type ExistingFile = {
|
|
33
34
|
exists: boolean;
|
|
@@ -39,15 +40,14 @@ type ExistingFile = {
|
|
|
39
40
|
*/
|
|
40
41
|
export declare function readRules(): Rule[];
|
|
41
42
|
/**
|
|
42
|
-
* Read the package skills directory
|
|
43
|
-
*
|
|
44
|
-
* the directory, shipped with its scripts and references.
|
|
43
|
+
* Read the package skills directory: every directory holding a `SKILL.md` is a skill named after the directory,
|
|
44
|
+
* shipped with all its files (scripts, references, ...).
|
|
45
45
|
*/
|
|
46
46
|
export declare function readSkills(): Skill[];
|
|
47
47
|
/**
|
|
48
|
-
* Package files to link, keyed by their path inside an agent dir: `rules/<file>`,
|
|
49
|
-
* package README.md next to
|
|
50
|
-
*
|
|
48
|
+
* Package files to link, keyed by their path inside an agent dir: `rules/<file>`, and every file of a skill at its
|
|
49
|
+
* own relative path, plus the package README.md next to its `SKILL.md` (unless the skill ships one), so a skill can
|
|
50
|
+
* reference `@README.md`.
|
|
51
51
|
*/
|
|
52
52
|
export declare function packageFiles(rules: Rule[], skills: Skill[]): Map<string, string>;
|
|
53
53
|
/**
|
|
@@ -57,8 +57,8 @@ export declare function packageFiles(rules: Rule[], skills: Skill[]): Map<string
|
|
|
57
57
|
export declare function readUserFiles(cwd: string): Map<string, string>;
|
|
58
58
|
/**
|
|
59
59
|
* Make `rules`, `commands` and `skills` real directories in every agent dir and link the files we know into them:
|
|
60
|
-
* package files into
|
|
61
|
-
*
|
|
60
|
+
* package files into both, pointing straight at the package, and the user's own `.agents` files into `.claude`.
|
|
61
|
+
* Real files and linked directories are the user's - never written over or through. Dead links are
|
|
62
62
|
* removed, and so are links from the previous run that are no longer placed: each directory's generated `.gitignore`
|
|
63
63
|
* records them (and keeps them out of git, so the user's own files there stay tracked).
|
|
64
64
|
*
|
|
@@ -85,13 +85,12 @@ export declare function checkClaudeMdSafety(claudeMdPath: string): void;
|
|
|
85
85
|
*/
|
|
86
86
|
export declare function symlinkClaudeMd(cwd: string): void;
|
|
87
87
|
/**
|
|
88
|
-
* Generate AGENTS.md with a `# Rules` section:
|
|
89
|
-
*
|
|
88
|
+
* Generate AGENTS.md with a `# Rules` section: one entry per rule (the package's and the user's own) with
|
|
89
|
+
* its frontmatter `description`, the `paths` it is scoped to and a plain link to its `.agents/rules` entry.
|
|
90
90
|
*
|
|
91
|
-
* `.claude/rules
|
|
92
|
-
*
|
|
93
|
-
*
|
|
94
|
-
* The sections below are for other tools that only read AGENTS.md.
|
|
91
|
+
* The links are plain, never `@path` imports: Claude Code loads `.claude/rules` itself (syncAgentDirs() links them
|
|
92
|
+
* there) and honours each rule's `paths`, while an `@` import would load every rule into every session, scoped or not.
|
|
93
|
+
* Codex, which expands no `@`, reads this index.
|
|
95
94
|
*/
|
|
96
95
|
export declare function generateAgentsFile(rules: Rule[], customSection: string | null): string;
|
|
97
96
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"lintPrepare.d.ts","sourceRoot":"","sources":["../src/lintPrepare.ts"],"names":[],"mappings":";AAEA
|
|
1
|
+
{"version":3,"file":"lintPrepare.d.ts","sourceRoot":"","sources":["../src/lintPrepare.ts"],"names":[],"mappings":";AAEA;;;;;;;;;;;;;;;;;GAiBG;AAUH;;GAEG;AACH,KAAK,IAAI,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AACpG,KAAK,KAAK,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC;AAC9B,KAAK,YAAY,GAAG;IAAE,MAAM,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,OAAO,CAAC;IAAC,aAAa,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC;AA4N1F;;GAEG;AACH,wBAAgB,SAAS,IAAI,IAAI,EAAE,CAmBlC;AAED;;;GAGG;AACH,wBAAgB,UAAU,IAAI,KAAK,EAAE,CAQpC;AAED;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAoBhF;AAED;;;GAGG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAc9D;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,CAkClH;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,IAAI,EAAE,CAYpF;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,GAAG,IAAI,CAc9D;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAKjD;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,IAAI,EAAE,EAAE,aAAa,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAatF;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,UAAU,EAAE,MAAM,GAAG,YAAY,CAW9D;AAED;;GAEG;AACH,wBAAgB,IAAI,IAAI,IAAI,CAmD3B"}
|
package/dist/lintPrepare.js
CHANGED
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
* @kirill.konshin/lint
|
|
4
4
|
*
|
|
5
5
|
* This script makes `rules`, `commands` and `skills` real directories in the consuming project's
|
|
6
|
-
* `.agents` (canonical, cross-tool)
|
|
7
|
-
* file symlinks only: package rules and skills (
|
|
8
|
-
* so a skill can reference `@README.md
|
|
9
|
-
* at the installed
|
|
10
|
-
* package; the user's own files in `.agents` are mirrored into `.claude` and `.codex`. It also
|
|
6
|
+
* `.agents` (canonical, cross-tool) and `.claude` (Claude Code), and fills them with
|
|
7
|
+
* file symlinks only: package rules and skills (every file a skill folder ships, plus the package
|
|
8
|
+
* README.md next to its SKILL.md, so a skill can reference `@README.md`) go into both, pointing
|
|
9
|
+
* straight at the installed package; the user's own files in `.agents` are mirrored into `.claude`. It also
|
|
11
10
|
* generates an `AGENTS.md` file for other tools, with `CLAUDE.md` symlinked to `AGENTS.md`.
|
|
12
11
|
*
|
|
13
12
|
* Usage:
|
|
@@ -30,9 +29,9 @@ const RULES_DIR = path.join(__dirname, '../rules');
|
|
|
30
29
|
const SKILLS_DIR = path.join(__dirname, '../skills');
|
|
31
30
|
const README_FILE = path.join(__dirname, '../README.md');
|
|
32
31
|
// `.agents` is the cross-tool location (Codex, Cursor, Antigravity) holding the package links and the user's own
|
|
33
|
-
// files, the latter are mirrored into `.claude` (Claude Code reads nothing else)
|
|
32
|
+
// files, the latter are mirrored into `.claude` (Claude Code reads nothing else)
|
|
34
33
|
const CANONICAL_AGENT_DIR = '.agents';
|
|
35
|
-
const MIRROR_AGENT_DIRS = ['.claude'
|
|
34
|
+
const MIRROR_AGENT_DIRS = ['.claude'];
|
|
36
35
|
const AGENT_DIRS = [CANONICAL_AGENT_DIR, ...MIRROR_AGENT_DIRS];
|
|
37
36
|
const AGENT_KINDS = ['rules', 'commands', 'skills'];
|
|
38
37
|
const GITIGNORE = '.gitignore';
|
|
@@ -58,22 +57,34 @@ const toTitle = (name) => {
|
|
|
58
57
|
return title.charAt(0).toUpperCase() + title.slice(1);
|
|
59
58
|
};
|
|
60
59
|
/**
|
|
61
|
-
*
|
|
60
|
+
* A rule's YAML frontmatter, empty when it has none.
|
|
62
61
|
*/
|
|
63
|
-
const
|
|
62
|
+
const readFrontmatter = (content) => {
|
|
64
63
|
const frontmatter = FRONTMATTER.exec(content)?.[1];
|
|
65
|
-
const
|
|
66
|
-
return typeof
|
|
64
|
+
const parsed = frontmatter ? parse(frontmatter) : undefined;
|
|
65
|
+
return parsed && typeof parsed === 'object' ? parsed : {};
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* A frontmatter field read as a list of strings: one string, or a list of them.
|
|
69
|
+
*/
|
|
70
|
+
const stringList = (value) => {
|
|
71
|
+
const items = typeof value === 'string' ? [value] : Array.isArray(value) ? value : [];
|
|
72
|
+
const strings = items.filter((item) => typeof item === 'string' && item.trim() !== '');
|
|
73
|
+
return strings.length ? strings : undefined;
|
|
67
74
|
};
|
|
68
75
|
/**
|
|
69
76
|
* `file` is the path inside a rules dir, e.g. `auth.md` or `frontend/react.md`.
|
|
70
77
|
*/
|
|
71
|
-
const toRule = (file, content) =>
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
78
|
+
const toRule = (file, content) => {
|
|
79
|
+
const { description, paths } = readFrontmatter(content);
|
|
80
|
+
return {
|
|
81
|
+
file,
|
|
82
|
+
name: path.posix.basename(file, '.md'),
|
|
83
|
+
description: typeof description === 'string' ? description.trim() : undefined,
|
|
84
|
+
paths: stringList(paths),
|
|
85
|
+
content,
|
|
86
|
+
};
|
|
87
|
+
};
|
|
77
88
|
/**
|
|
78
89
|
* Real files under `dir`, as paths relative to `root` - symlinks (incl. the package links next to them), linked
|
|
79
90
|
* directories and dotfiles (`.gitignore`, `.DS_Store`) are skipped.
|
|
@@ -219,29 +230,22 @@ export function readRules() {
|
|
|
219
230
|
return rules;
|
|
220
231
|
}
|
|
221
232
|
/**
|
|
222
|
-
* Read the package skills directory
|
|
223
|
-
*
|
|
224
|
-
* the directory, shipped with its scripts and references.
|
|
233
|
+
* Read the package skills directory: every directory holding a `SKILL.md` is a skill named after the directory,
|
|
234
|
+
* shipped with all its files (scripts, references, ...).
|
|
225
235
|
*/
|
|
226
236
|
export function readSkills() {
|
|
227
237
|
if (!fs.existsSync(SKILLS_DIR))
|
|
228
238
|
return [];
|
|
229
239
|
return fs
|
|
230
240
|
.readdirSync(SKILLS_DIR, { withFileTypes: true })
|
|
231
|
-
.
|
|
232
|
-
|
|
233
|
-
return [{ file: entry.name, name: entry.name, folder: true }];
|
|
234
|
-
}
|
|
235
|
-
return entry.isFile() && entry.name.endsWith('.md')
|
|
236
|
-
? [{ file: entry.name, name: entry.name.replace('.md', '') }]
|
|
237
|
-
: [];
|
|
238
|
-
})
|
|
241
|
+
.filter((entry) => entry.isDirectory() && fs.existsSync(path.join(SKILLS_DIR, entry.name, 'SKILL.md')))
|
|
242
|
+
.map((entry) => ({ name: entry.name }))
|
|
239
243
|
.sort((a, b) => a.name.localeCompare(b.name));
|
|
240
244
|
}
|
|
241
245
|
/**
|
|
242
|
-
* Package files to link, keyed by their path inside an agent dir: `rules/<file>`,
|
|
243
|
-
* package README.md next to
|
|
244
|
-
*
|
|
246
|
+
* Package files to link, keyed by their path inside an agent dir: `rules/<file>`, and every file of a skill at its
|
|
247
|
+
* own relative path, plus the package README.md next to its `SKILL.md` (unless the skill ships one), so a skill can
|
|
248
|
+
* reference `@README.md`.
|
|
245
249
|
*/
|
|
246
250
|
export function packageFiles(rules, skills) {
|
|
247
251
|
const files = new Map();
|
|
@@ -250,16 +254,13 @@ export function packageFiles(rules, skills) {
|
|
|
250
254
|
files.set(path.join('rules', rule.file), path.join(RULES_DIR, rule.file));
|
|
251
255
|
}
|
|
252
256
|
for (const skill of skills) {
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
}
|
|
258
|
-
continue;
|
|
257
|
+
const root = path.join(SKILLS_DIR, skill.name);
|
|
258
|
+
const readme = path.join('skills', skill.name, 'README.md');
|
|
259
|
+
for (const file of listRealFiles(root)) {
|
|
260
|
+
files.set(path.join('skills', skill.name, file), path.join(root, file));
|
|
259
261
|
}
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
files.set(path.join('skills', skill.name, 'README.md'), README_FILE);
|
|
262
|
+
if (hasReadme && !files.has(readme))
|
|
263
|
+
files.set(readme, README_FILE);
|
|
263
264
|
}
|
|
264
265
|
return files;
|
|
265
266
|
}
|
|
@@ -281,8 +282,8 @@ export function readUserFiles(cwd) {
|
|
|
281
282
|
}
|
|
282
283
|
/**
|
|
283
284
|
* Make `rules`, `commands` and `skills` real directories in every agent dir and link the files we know into them:
|
|
284
|
-
* package files into
|
|
285
|
-
*
|
|
285
|
+
* package files into both, pointing straight at the package, and the user's own `.agents` files into `.claude`.
|
|
286
|
+
* Real files and linked directories are the user's - never written over or through. Dead links are
|
|
286
287
|
* removed, and so are links from the previous run that are no longer placed: each directory's generated `.gitignore`
|
|
287
288
|
* records them (and keeps them out of git, so the user's own files there stay tracked).
|
|
288
289
|
*
|
|
@@ -364,32 +365,22 @@ export function symlinkClaudeMd(cwd) {
|
|
|
364
365
|
fs.symlinkSync(AGENTS_FILE, claudeMdPath);
|
|
365
366
|
}
|
|
366
367
|
/**
|
|
367
|
-
* Generate AGENTS.md with a `# Rules` section:
|
|
368
|
-
*
|
|
368
|
+
* Generate AGENTS.md with a `# Rules` section: one entry per rule (the package's and the user's own) with
|
|
369
|
+
* its frontmatter `description`, the `paths` it is scoped to and a plain link to its `.agents/rules` entry.
|
|
369
370
|
*
|
|
370
|
-
* `.claude/rules
|
|
371
|
-
*
|
|
372
|
-
*
|
|
373
|
-
* The sections below are for other tools that only read AGENTS.md.
|
|
371
|
+
* The links are plain, never `@path` imports: Claude Code loads `.claude/rules` itself (syncAgentDirs() links them
|
|
372
|
+
* there) and honours each rule's `paths`, while an `@` import would load every rule into every session, scoped or not.
|
|
373
|
+
* Codex, which expands no `@`, reads this index.
|
|
374
374
|
*/
|
|
375
375
|
export function generateAgentsFile(rules, customSection) {
|
|
376
|
-
|
|
377
|
-
* @see https://code.claude.com/docs/en/memory#import-additional-files
|
|
378
|
-
* @see https://github.com/anthropics/claude-code/issues/13614 @import -> @path/file.md in Claude
|
|
379
|
-
* @see https://github.com/openai/codex/issues/17401 - no @path/file.md in Codex yet
|
|
380
|
-
*/
|
|
381
|
-
const sections = rules.map((rule) => {
|
|
376
|
+
const entries = rules.map((rule) => {
|
|
382
377
|
// the canonical entry (a package link or the user's own file), not the package install path
|
|
383
378
|
const rulePath = `${CANONICAL_AGENT_DIR}/rules/${rule.file}`;
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
`See instructions in @${rulePath} [${rulePath}](${rulePath}).`,
|
|
388
|
-
]
|
|
389
|
-
.filter(Boolean)
|
|
390
|
-
.join('\n\n');
|
|
379
|
+
const description = rule.description ? ` — ${rule.description}` : '';
|
|
380
|
+
const scope = rule.paths ? `; when touching ${rule.paths.map((glob) => `\`${glob}\``).join(', ')}` : '';
|
|
381
|
+
return `- **${toTitle(rule.name)}**${description}${scope}: [${rulePath}](${rulePath})`;
|
|
391
382
|
});
|
|
392
|
-
const generated = `${HEADER}\n\n# Rules\n\n${
|
|
383
|
+
const generated = `${HEADER}\n\n# Rules\n\n${entries.join('\n')}\n\n${FOOTER}\n\n${GENERATED_MARKER}`;
|
|
393
384
|
return customSection ? `${generated}\n\n${customSection}\n` : `${generated}\n`;
|
|
394
385
|
}
|
|
395
386
|
/**
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { Linter } from 'eslint';
|
|
2
|
+
/**
|
|
3
|
+
* One structural restriction: a core `no-restricted-*` rule applied under a concern of its own, with the files it
|
|
4
|
+
* governs. Every other field is a flat-config entry field (`files`, `ignores`, ...).
|
|
5
|
+
*/
|
|
6
|
+
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[];
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* The lint layer: structural rules a syntax or import check decides. Each concern is restricted through its own copy
|
|
18
|
+
* of a core `no-restricted-*` rule, named `restrict/<name>`, because a later flat-config entry replaces an earlier
|
|
19
|
+
* one's options for the same rule — two concerns sharing one core rule would silently drop each other wherever their
|
|
20
|
+
* files overlap. Entries of one concern share its name and differ by `label`.
|
|
21
|
+
*/
|
|
22
|
+
export declare function restrictions(entries: Restriction[]): Linter.Config[];
|
|
23
|
+
//# sourceMappingURL=restrictions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"restrictions.d.ts","sourceRoot":"","sources":["../src/restrictions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAGrC;;;GAGG;AACH,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,OAAO,CAAC,GAAG;IAC1E,qFAAqF;IACrF,IAAI,EAAE,MAAM,CAAC;IACb,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,IAAI,EAAE,MAAM,CAAC;IACb,0BAA0B;IAC1B,OAAO,EAAE,OAAO,EAAE,CAAC;CACtB,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC,MAAM,EAAE,CAgBpE"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { builtinRules } from 'eslint/use-at-your-own-risk';
|
|
2
|
+
/**
|
|
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
|
+
];
|
|
24
|
+
}
|
package/package.json
CHANGED
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
|
|
@@ -81,7 +81,7 @@ Prefer one authoritative location for each concern. Reference it elsewhere inste
|
|
|
81
81
|
|
|
82
82
|
# `.agents/skills`
|
|
83
83
|
|
|
84
|
-
- `.agents/skills` must be accompanied by symlinks in `.claude/skills`
|
|
84
|
+
- `.agents/skills` must be accompanied by symlinks in `.claude/skills`
|
|
85
85
|
- May define either
|
|
86
86
|
- A workflow
|
|
87
87
|
- A process
|
|
@@ -94,7 +94,7 @@ Prefer one authoritative location for each concern. Reference it elsewhere inste
|
|
|
94
94
|
|
|
95
95
|
# `.agents/commands`
|
|
96
96
|
|
|
97
|
-
- `.agents/commands` must be accompanied by symlinks in `.claude/commands`
|
|
97
|
+
- `.agents/commands` must be accompanied by symlinks in `.claude/commands`
|
|
98
98
|
- Smaller and simpler than skills
|
|
99
99
|
- One-off commands, not flows
|
|
100
100
|
|
|
@@ -104,7 +104,7 @@ Prefer one authoritative location for each concern. Reference it elsewhere inste
|
|
|
104
104
|
- User facing or externally observable behavior
|
|
105
105
|
- Durable component/system/API contracts & invariants
|
|
106
106
|
- Not general coding instructions
|
|
107
|
-
- Openspec-specific instructions must assume that flow WAS ENTERED, thus `AGENTS.md` or `[.agents|.claude
|
|
107
|
+
- 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
108
|
- `openspec/config.yml#context` - should only have very narrow instructions for OpenSpec specifically, when user entered flow
|
|
109
109
|
- Context will already contain root `AGENTS.md`, no duplication needed
|
|
110
110
|
- `openspec/config.yml#rules.[specs|proposal]` - very narrow sets of rules specifically for defined part of the flow when it's entered
|
|
@@ -115,6 +115,7 @@ Prefer one authoritative location for each concern. Reference it elsewhere inste
|
|
|
115
115
|
- Requirements and scenarios should (preferrably) be proven by tests, and may be cited in tests for stronger connection
|
|
116
116
|
- Tests should be validated that they do what spec says (optional, unless project mandates this in root `AGENTS.md`)
|
|
117
117
|
- Code citations must resolve, not checked for validity
|
|
118
|
+
- Comments, descriptions, prompt or documentation text, and citations are not evidence that code complies, and their absence or wording is never a violation
|
|
118
119
|
|
|
119
120
|
# Common for `AGENTS.md` `.agents/rules` `.agents/skills`
|
|
120
121
|
|
package/rules/github.md
CHANGED
|
@@ -9,79 +9,3 @@ paths:
|
|
|
9
9
|
|
|
10
10
|
- Agentic review MUST verify this effective CI order: checkout -> enable Corepack -> setup Node with Yarn cache -> restore build caches -> immutable install -> prepare -> verification (lint/test/build) -> publish; publishing MUST depend on successful verification.
|
|
11
11
|
- In multi-job workflows, use job-specific build-cache keys with a same-run fallback so downstream jobs reuse upstream results without immutable-key collisions.
|
|
12
|
-
|
|
13
|
-
# Example Workflow
|
|
14
|
-
|
|
15
|
-
```yml
|
|
16
|
-
name: Release
|
|
17
|
-
|
|
18
|
-
on:
|
|
19
|
-
push:
|
|
20
|
-
branches:
|
|
21
|
-
- main
|
|
22
|
-
|
|
23
|
-
# If project publishes to NPM
|
|
24
|
-
permissions:
|
|
25
|
-
id-token: write # Required for OIDC
|
|
26
|
-
contents: read
|
|
27
|
-
|
|
28
|
-
concurrency: ${{ github.workflow }}-${{ github.ref }}
|
|
29
|
-
|
|
30
|
-
jobs:
|
|
31
|
-
release:
|
|
32
|
-
name: Release
|
|
33
|
-
runs-on: ubuntu-latest
|
|
34
|
-
env:
|
|
35
|
-
TURBO_CACHE_DIR: .turbo # if project uses Turbo
|
|
36
|
-
YARN_ENABLE_GLOBAL_CACHE: false # so that .yarn/cache is written
|
|
37
|
-
|
|
38
|
-
# If project publishes to NPM
|
|
39
|
-
# https://davistobias.com/articles/adding-changeset/#2.1.b-adding-changeset-to-github-workflows
|
|
40
|
-
if: github.repository == 'kirill-konshin/utils'
|
|
41
|
-
permissions:
|
|
42
|
-
id-token: write # Required for OIDC trusted publishing
|
|
43
|
-
contents: write
|
|
44
|
-
pull-requests: write
|
|
45
|
-
|
|
46
|
-
steps:
|
|
47
|
-
- name: Checkout Repo
|
|
48
|
-
uses: actions/checkout@v4
|
|
49
|
-
|
|
50
|
-
- name: Enable Corepack
|
|
51
|
-
run: corepack enable
|
|
52
|
-
|
|
53
|
-
- name: Setup Node.js
|
|
54
|
-
uses: actions/setup-node@v6
|
|
55
|
-
with:
|
|
56
|
-
node-version: 24
|
|
57
|
-
registry-url: 'https://registry.npmjs.org'
|
|
58
|
-
cache: yarn
|
|
59
|
-
cache-dependency-path: yarn.lock
|
|
60
|
-
|
|
61
|
-
#TODO https://turbo.build/repo/docs/guides/ci-vendors/github-actions#remote-caching
|
|
62
|
-
#TODO https://turborepo.dev/docs/guides/ci-vendors/github-actions#remote-caching-with-github-actionscache
|
|
63
|
-
- name: Cache Turbo
|
|
64
|
-
uses: actions/cache@v6
|
|
65
|
-
with:
|
|
66
|
-
path: .turbo
|
|
67
|
-
key: ${{ runner.os }}-turbo-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}
|
|
68
|
-
restore-keys: |
|
|
69
|
-
${{ runner.os }}-turbo-${{ github.run_id }}-${{ github.run_attempt }}-
|
|
70
|
-
${{ runner.os }}-turbo-
|
|
71
|
-
|
|
72
|
-
- name: Cache Nx
|
|
73
|
-
uses: actions/cache@v6
|
|
74
|
-
with:
|
|
75
|
-
path: .nx/cache
|
|
76
|
-
key: ${{ runner.os }}-nx-${{ github.run_id }}-${{ github.run_attempt }}-${{ github.job }}
|
|
77
|
-
restore-keys: |
|
|
78
|
-
${{ runner.os }}-nx-${{ github.run_id }}-${{ github.run_attempt }}-
|
|
79
|
-
${{ runner.os }}-nx-
|
|
80
|
-
|
|
81
|
-
- name: Install dependencies
|
|
82
|
-
run: yarn install --immutable
|
|
83
|
-
|
|
84
|
-
# Add this if Yarn 2+ is used and package is NOT private, otherwise postinstall should be configured, and this block skipped
|
|
85
|
-
- name: Prepare
|
|
86
|
-
run: yarn prepare
|
|
87
|
-
```
|