agentfile-linter 0.0.1-rc.2 → 0.0.1-rc.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -44,6 +44,7 @@ agentfile-linter -f github # GitHub Actions annotations
44
44
  agentfile-linter --rules # list rules
45
45
  agentfile-linter --init # create .agentfile-linterrc.json
46
46
  agentfile-linter --debug files # print the files that would be linted, then exit
47
+ agentfile-linter --debug timings # lint and print per-rule timings, slowest first
47
48
  ```
48
49
 
49
50
  With no config file and no rule flags, every rule marked as recommended in the table below runs as an `error`.
@@ -58,6 +59,7 @@ With no config file and no rule flags, every rule marked as recommended in the t
58
59
  | [`agentfile/no-agent-files-drift`](#agentfileno-agent-files-drift) | ✓ | suspicious | Agent files in one directory are identical or symlinked |
59
60
  | [`agentfile/no-invalid-skill`](#agentfileno-invalid-skill) | ✓ | correctness | Skill directories have a valid layout and valid `SKILL.md` frontmatter |
60
61
  | [`agentfile/no-misnamed-agent-file`](#agentfileno-misnamed-agent-file) | ✓ | correctness | Agent files are spelled in the exact case agents look for |
62
+ | [`agentfile/no-claude-local-in-git`](#agentfileno-claude-local-in-git) | ✓ | correctness | Personal `CLAUDE.local.md` files stay untracked and git-ignored |
61
63
  | [`agentfile/no-unnecessary-agent-files`](#agentfileno-unnecessary-agent-files) | | pedantic | No `CLAUDE.md` that only mirrors `AGENTS.md` |
62
64
  | [`agentfile/keep-agents-file-up-to-date`](#agentfilekeep-agents-file-up-to-date) | | pedantic | Context files were changed recently |
63
65
  | [`agentfile/limit-file-size`](#agentfilelimit-file-size) | | pedantic | Context files stay below a maximum number of characters |
@@ -68,7 +70,7 @@ Each rule belongs to one category, named as in [Oxlint](https://oxc.rs/docs/guid
68
70
 
69
71
  ### Linted files
70
72
 
71
- By default, agentfile-linter finds these files in every directory: `AGENTS.md`, `AGENT.md`, `CLAUDE.md`, `CLAUDE.local.md` and `GEMINI.md`. `.claude/` and other hidden directories are included. Discovery skips files excluded by `.gitignore`.
73
+ By default, agentfile-linter finds these files in every directory: `AGENTS.md`, `AGENT.md`, `CLAUDE.md`, `CLAUDE.local.md` and `GEMINI.md`. `.claude/` and other hidden directories are included. Context file discovery skips files excluded by `.gitignore`.
72
74
 
73
75
  Files you name on the command line can have any name and bypass `.gitignore`. A file explicitly excluded by `ignorePatterns`, `--ignore-pattern`, or the ignore file is skipped with a warning. Use `--no-ignore` to lint it.
74
76
 
@@ -92,11 +94,13 @@ Besides context files, [`agentfile/no-invalid-skill`](#agentfileno-invalid-skill
92
94
  | `-f, --format <fmt>` | `default`, `stylish`, `json`, `github` or `unix` |
93
95
  | `--silent` | Print no diagnostics |
94
96
  | `--print-config` | Print the effective configuration |
95
- | `--debug=<options>` | Debug output, comma-separated. `files`: print the files that would be linted, then exit |
97
+ | `--debug=<options>` | Debug output, comma-separated. Use `files` to list inputs or `timings` to profile rule calls |
96
98
  | `--rules` | List all rules, including those of `jsPlugins`. Config problems are printed below the list |
97
99
 
98
100
  `-A`/`-W`/`-D` are applied left to right, after the config file. A rule name can be written with or without its `agentfile/` prefix.
99
101
 
102
+ `--debug timings` prints a table to stderr, sorted by total elapsed time per rule. **Calls** counts each invocation of a rule's `create` or `createOnce` hook, `before` and `after` hooks, matching Markdown visitors, and `collectTreeInputs` and `checkTree` hooks. **Relative** is each rule's share of the sum of all measured times. Async callbacks include time spent waiting for completion and can overlap. Use `--silent --debug timings` to print the table alone. If `files` is also requested, the CLI exits after listing files.
103
+
100
104
  **Exit codes:** `0` means no errors. `1` means lint errors were found, or warnings exceeded `--deny-warnings` / `--max-warnings`. `2` means invalid usage or configuration.
101
105
 
102
106
  ## Configuration
@@ -125,7 +129,7 @@ Besides context files, [`agentfile/no-invalid-skill`](#agentfileno-invalid-skill
125
129
  }
126
130
  ```
127
131
 
128
- Settings are applied in this order: built-in defaults (`recommended` rules as errors), then `categories`, then `rules`, then matching `overrides`, then CLI flags. Each layer only changes what it mentions, including individual keys in a rule's options object. The example above keeps `no-broken-reference`, `no-agent-files-drift`, `no-invalid-skill` and `no-misnamed-agent-file` enabled. To opt out entirely, use `"categories": { "recommended": "off" }` or `-A all`.
132
+ Settings are applied in this order: built-in defaults (`recommended` rules as errors), then `categories`, then `rules`, then matching `overrides`, then CLI flags. Each layer only changes what it mentions, including individual keys in a rule's options object. The example above keeps the other recommended rules enabled. To opt out entirely, use `"categories": { "recommended": "off" }` or `-A all`.
129
133
 
130
134
  Glob patterns (`files`, `overrides[].files`, `ignorePatterns`) are resolved relative to the config file. A pattern without a `/` matches a file name in any directory.
131
135
 
@@ -174,12 +178,13 @@ Checks path-like code spans and `@path/to/file.md` imports in context files.
174
178
  <details>
175
179
  <summary>Details and configuration options</summary>
176
180
 
177
- - **What counts as a path:** a span with a known file extension (`src/index.ts`, `package.json`), a `./` or `../` prefix, a trailing slash (`docs/`), a dotfile (`.env.example`), a well-known file name (`Makefile`, `Dockerfile`, …) or a glob (`src/**/*.test.ts`).
181
+ - **What counts as a path:** a span with a known file extension (`src/index.ts`, `package.json`), a `./` or `../` prefix, a trailing slash (`docs/`), a dotfile written with a slash (`./.env.example`, `config/.env.example`), a well-known file name (`Makefile`, `Dockerfile`, …) or a glob (`src/**/*.test.ts`).
178
182
  - **Slash paths without an extension** (`src/components`) are checked only when their first segment exists. Module names like `react-dom/client` or `origin/main` are therefore ignored.
179
- - **Never treated as paths:** commands, URLs, `node:` specifiers, scoped packages, absolute or `~` paths, placeholders (`<name>`, `{id}`, `path/to/…`, `foo.ts`), extension mentions (`.ts`, `.d.ts`, `.tscn`), API members (`Bun.sql`, `res.json`) and library names (`Node.js`, `postgres.js`).
183
+ - **Never treated as paths:** commands, URLs, `node:` specifiers, scoped packages, absolute or `~` paths, placeholders (`<name>`, `{id}`, `path/to/…`, `foo.ts`), dot-prefixed names without a slash (`.prose`, `.d.ts`, `.env.example`), API members (`Bun.sql`, `res.json`) and library names (`Node.js`, `postgres.js`).
180
184
  - **Examples are skipped:** spans introduced by "e.g." / "such as" / "like", spans in a paragraph ending with `:` that is followed by a code block ("With the following `frontend.tsx`:"), and file names declared on code fences (` ```tsx#frontend.tsx `,` ```ts title="src/app.ts" `).
181
185
  - **Build outputs are accepted:** a missing `main.js` or `app.css` passes when its source (`main.ts`, `app.scss`) exists.
182
186
  - **Resolution:** a path is looked up from the file's directory, then from each parent directory up to the project root (the nearest `.git`). With `allowSuffixMatch`, it also passes if any project path ends with it, so `components/Button.tsx` matches `apps/web/src/components/Button.tsx`. `./x` paths and `@imports` resolve only relative to the file.
187
+ - When a glob matches no files, the rule checks it against local and remote-tracking Git branches. Wildcards can span slashes in branch names, so `feature/*` matches `feature/ui/add-search`. This fallback applies to globs written without a relative prefix or trailing slash.
183
188
  - **Not reported:** git-ignored paths (build output, `.env`) and paths under `node_modules`. These legitimately don't exist in a fresh checkout.
184
189
  - Code spans inside links are left to `no-broken-reference`. Fenced code blocks are not checked.
185
190
 
@@ -335,6 +340,14 @@ A file is never reported when the correctly named file exists next to it (possib
335
340
 
336
341
  </details>
337
342
 
343
+ ### `agentfile/no-claude-local-in-git`
344
+
345
+ Reports personal `CLAUDE.local.md` files that Git tracks or that lack a matching `.gitignore` pattern in the repository. Add `CLAUDE.local.md` to the repository's `.gitignore` so the pattern applies at every depth. A global ignore file or `.git/info/exclude` is local to your checkout or machine.
346
+
347
+ A file ignored only by `.git/info/exclude` or a global ignore file is still reported, with its own message: those excludes are not shared, so a teammate or a config change can commit it.
348
+
349
+ Git keeps tracking existing index entries after you add an ignore pattern. The help text shows the `git rm --cached` command that removes the file from the index and keeps your local copy. Index entries without a file in the working tree (deleted without `git rm`, or left out of a sparse checkout) are reported too. The rule runs only inside Git repositories and doesn't follow symlinked directories into other repositories.
350
+
338
351
  ### `agentfile/no-unnecessary-agent-files`
339
352
 
340
353
  Off by default. Reports a `CLAUDE.md` that only mirrors the `AGENTS.md` in its directory.
@@ -1148,6 +1148,118 @@
1148
1148
  }
1149
1149
  ]
1150
1150
  },
1151
+ "agentfile/no-claude-local-in-git": {
1152
+ "description": "Personal CLAUDE.local.md files must be untracked and covered by .gitignore",
1153
+ "oneOf": [
1154
+ {
1155
+ "oneOf": [
1156
+ {
1157
+ "type": "string",
1158
+ "enum": [
1159
+ "off",
1160
+ "warn",
1161
+ "error",
1162
+ "allow",
1163
+ "deny"
1164
+ ]
1165
+ },
1166
+ {
1167
+ "type": "integer",
1168
+ "enum": [
1169
+ 0,
1170
+ 1,
1171
+ 2
1172
+ ]
1173
+ }
1174
+ ]
1175
+ },
1176
+ {
1177
+ "type": "array",
1178
+ "prefixItems": [
1179
+ {
1180
+ "oneOf": [
1181
+ {
1182
+ "type": "string",
1183
+ "enum": [
1184
+ "off",
1185
+ "warn",
1186
+ "error",
1187
+ "allow",
1188
+ "deny"
1189
+ ]
1190
+ },
1191
+ {
1192
+ "type": "integer",
1193
+ "enum": [
1194
+ 0,
1195
+ 1,
1196
+ 2
1197
+ ]
1198
+ }
1199
+ ]
1200
+ }
1201
+ ],
1202
+ "minItems": 1,
1203
+ "maxItems": 1
1204
+ }
1205
+ ]
1206
+ },
1207
+ "no-claude-local-in-git": {
1208
+ "description": "Personal CLAUDE.local.md files must be untracked and covered by .gitignore",
1209
+ "oneOf": [
1210
+ {
1211
+ "oneOf": [
1212
+ {
1213
+ "type": "string",
1214
+ "enum": [
1215
+ "off",
1216
+ "warn",
1217
+ "error",
1218
+ "allow",
1219
+ "deny"
1220
+ ]
1221
+ },
1222
+ {
1223
+ "type": "integer",
1224
+ "enum": [
1225
+ 0,
1226
+ 1,
1227
+ 2
1228
+ ]
1229
+ }
1230
+ ]
1231
+ },
1232
+ {
1233
+ "type": "array",
1234
+ "prefixItems": [
1235
+ {
1236
+ "oneOf": [
1237
+ {
1238
+ "type": "string",
1239
+ "enum": [
1240
+ "off",
1241
+ "warn",
1242
+ "error",
1243
+ "allow",
1244
+ "deny"
1245
+ ]
1246
+ },
1247
+ {
1248
+ "type": "integer",
1249
+ "enum": [
1250
+ 0,
1251
+ 1,
1252
+ 2
1253
+ ]
1254
+ }
1255
+ ]
1256
+ }
1257
+ ],
1258
+ "minItems": 1,
1259
+ "maxItems": 1
1260
+ }
1261
+ ]
1262
+ },
1151
1263
  "agentfile/no-unnecessary-agent-files": {
1152
1264
  "description": "CLAUDE.md must not merely mirror AGENTS.md, which Claude Code reads itself",
1153
1265
  "oneOf": [
@@ -2603,6 +2715,118 @@
2603
2715
  }
2604
2716
  ]
2605
2717
  },
2718
+ "agentfile/no-claude-local-in-git": {
2719
+ "description": "Personal CLAUDE.local.md files must be untracked and covered by .gitignore",
2720
+ "oneOf": [
2721
+ {
2722
+ "oneOf": [
2723
+ {
2724
+ "type": "string",
2725
+ "enum": [
2726
+ "off",
2727
+ "warn",
2728
+ "error",
2729
+ "allow",
2730
+ "deny"
2731
+ ]
2732
+ },
2733
+ {
2734
+ "type": "integer",
2735
+ "enum": [
2736
+ 0,
2737
+ 1,
2738
+ 2
2739
+ ]
2740
+ }
2741
+ ]
2742
+ },
2743
+ {
2744
+ "type": "array",
2745
+ "prefixItems": [
2746
+ {
2747
+ "oneOf": [
2748
+ {
2749
+ "type": "string",
2750
+ "enum": [
2751
+ "off",
2752
+ "warn",
2753
+ "error",
2754
+ "allow",
2755
+ "deny"
2756
+ ]
2757
+ },
2758
+ {
2759
+ "type": "integer",
2760
+ "enum": [
2761
+ 0,
2762
+ 1,
2763
+ 2
2764
+ ]
2765
+ }
2766
+ ]
2767
+ }
2768
+ ],
2769
+ "minItems": 1,
2770
+ "maxItems": 1
2771
+ }
2772
+ ]
2773
+ },
2774
+ "no-claude-local-in-git": {
2775
+ "description": "Personal CLAUDE.local.md files must be untracked and covered by .gitignore",
2776
+ "oneOf": [
2777
+ {
2778
+ "oneOf": [
2779
+ {
2780
+ "type": "string",
2781
+ "enum": [
2782
+ "off",
2783
+ "warn",
2784
+ "error",
2785
+ "allow",
2786
+ "deny"
2787
+ ]
2788
+ },
2789
+ {
2790
+ "type": "integer",
2791
+ "enum": [
2792
+ 0,
2793
+ 1,
2794
+ 2
2795
+ ]
2796
+ }
2797
+ ]
2798
+ },
2799
+ {
2800
+ "type": "array",
2801
+ "prefixItems": [
2802
+ {
2803
+ "oneOf": [
2804
+ {
2805
+ "type": "string",
2806
+ "enum": [
2807
+ "off",
2808
+ "warn",
2809
+ "error",
2810
+ "allow",
2811
+ "deny"
2812
+ ]
2813
+ },
2814
+ {
2815
+ "type": "integer",
2816
+ "enum": [
2817
+ 0,
2818
+ 1,
2819
+ 2
2820
+ ]
2821
+ }
2822
+ ]
2823
+ }
2824
+ ],
2825
+ "minItems": 1,
2826
+ "maxItems": 1
2827
+ }
2828
+ ]
2829
+ },
2606
2830
  "agentfile/no-unnecessary-agent-files": {
2607
2831
  "description": "CLAUDE.md must not merely mirror AGENTS.md, which Claude Code reads itself",
2608
2832
  "oneOf": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agentfile-linter",
3
- "version": "0.0.1-rc.2",
3
+ "version": "0.0.1-rc.3",
4
4
  "description": "Linter for AI agent context files (AGENTS.md, CLAUDE.md, GEMINI.md, ...)",
5
5
  "bin": {
6
6
  "agentfile-linter": "dist/cli.js"