@aurelienbbn/agentlint 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Aurelien Bobenrieth
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,158 @@
1
+ # agentlint
2
+
3
+ [![CI](https://github.com/aurelienbobenrieth/agentlint/actions/workflows/ci.yml/badge.svg)](https://github.com/aurelienbobenrieth/agentlint/actions/workflows/ci.yml)
4
+ [![npm version](https://img.shields.io/npm/v/@aurelienbbn/agentlint.svg)](https://www.npmjs.com/package/@aurelienbbn/agentlint)
5
+ [![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
6
+
7
+ Stateless, deterministic CLI that bridges traditional linters and AI-assisted code review.
8
+
9
+ agentlint uses tree-sitter to parse code, runs visitor-based rules that flag suspicious patterns, and outputs structured reports with natural language instructions. The output is designed to be consumed by an AI coding agent (Claude Code, Cursor, etc.) that evaluates each finding in context.
10
+
11
+ ## How it works
12
+
13
+ ```
14
+ Phase 1 - Deterministic (agentlint)
15
+ tree-sitter AST parsing -> visitor dispatch -> pattern match -> collect flags
16
+
17
+ Phase 2 - AI-evaluated (the calling agent)
18
+ reads agentlint stdout -> evaluates each match per instructions -> acts
19
+ ```
20
+
21
+ agentlint owns Phase 1 only. It does not call any AI model. It does not require an API key.
22
+
23
+ ## Quick start
24
+
25
+ ```bash
26
+ pnpm add @aurelienbbn/agentlint
27
+ ```
28
+
29
+ Create `agentlint.config.ts`:
30
+
31
+ ```typescript
32
+ import { defineConfig, defineRule } from "@aurelienbbn/agentlint";
33
+
34
+ const noNoiseComments = defineRule({
35
+ meta: {
36
+ name: "no-noise-comments",
37
+ description: "Flags comments for AI evaluation",
38
+ languages: ["ts", "tsx"],
39
+ instruction: `Evaluate each comment. Is it noise or valuable?
40
+ Remove noise comments. Keep valuable ones.`,
41
+ },
42
+ createOnce(context) {
43
+ return {
44
+ comment(node) {
45
+ const text = node.text.replace(/^\/\/\s*/, "").trim();
46
+ if (text === "") return;
47
+ context.flag({ node, message: `Comment: "${text.slice(0, 60)}"` });
48
+ },
49
+ };
50
+ },
51
+ });
52
+
53
+ export default defineConfig({
54
+ rules: { "no-noise-comments": noNoiseComments },
55
+ });
56
+ ```
57
+
58
+ Run:
59
+
60
+ ```bash
61
+ # Scan files changed in current branch
62
+ pnpm agentlint check
63
+
64
+ # Scan all files
65
+ pnpm agentlint check --all
66
+
67
+ # Scan specific files or globs
68
+ pnpm agentlint check src/utils.ts "src/**/*.tsx"
69
+
70
+ # List registered rules
71
+ pnpm agentlint list
72
+
73
+ # Mark flags as reviewed
74
+ pnpm agentlint review <hash...>
75
+ ```
76
+
77
+ ## Output format
78
+
79
+ ```
80
+ agentlint v0.1.0 - 1 rule(s) triggered, 3 match(es)
81
+
82
+ ━━━ no-noise-comments: Flags comments for AI evaluation (3 match(es)) ━━━
83
+
84
+ [abc1234] src/utils.ts:5:1 // Increment the counter
85
+ [def5678] src/utils.ts:12:1 // Helper function
86
+ [ghi9012] src/utils.ts:18:3 // TODO: implement later
87
+
88
+ ┌─ Instruction ─────────────────────────────────────────
89
+ │ Evaluate each comment. Is it noise or valuable?
90
+ │ Remove noise comments. Keep valuable ones.
91
+ └───────────────────────────────────────────────────────
92
+
93
+ 3 match(es) across 1 rule(s)
94
+ ```
95
+
96
+ ## CLI reference
97
+
98
+ ### `agentlint check [files...] [options]`
99
+
100
+ | Flag | Description |
101
+ | --------------------- | --------------------------------------- |
102
+ | `--all`, `-a` | Scan all files (not just git diff) |
103
+ | `--rule`, `-r <name>` | Run only this rule |
104
+ | `--dry-run`, `-d` | Show counts only, no instruction blocks |
105
+ | `--base <ref>` | Git ref to diff against |
106
+
107
+ ### `agentlint list`
108
+
109
+ Lists all registered rules with their metadata.
110
+
111
+ ### `agentlint init`
112
+
113
+ Scaffolds a starter `agentlint.config.ts` file in the current directory.
114
+
115
+ ### `agentlint review [hashes...] [options]`
116
+
117
+ Manages per-developer reviewed-flag state. When you run `agentlint check`, flags that have been marked as reviewed are automatically filtered out of the output.
118
+
119
+ | Flag | Description |
120
+ | ------------- | ---------------------------------------- |
121
+ | `--all`, `-a` | Mark all current flags as reviewed |
122
+ | `--reset` | Wipe the state file (`.agentlint-state`) |
123
+
124
+ **Review workflow:**
125
+
126
+ 1. Run `agentlint check` to see current flags.
127
+ 2. After evaluating a flag, mark it as reviewed by passing its hash:
128
+ ```bash
129
+ pnpm agentlint review abc1234 def5678
130
+ ```
131
+ 3. To mark every current flag as reviewed at once:
132
+ ```bash
133
+ pnpm agentlint review --all
134
+ ```
135
+ 4. Reviewed flags are stored in `.agentlint-state` (a local file, not committed to git). Future `check` runs hide them automatically.
136
+ 5. To start fresh and see all flags again:
137
+ ```bash
138
+ pnpm agentlint review --reset
139
+ ```
140
+
141
+ ## Inline suppression
142
+
143
+ ```typescript
144
+ // agentlint-ignore no-noise-comments -- explains the retry formula
145
+ const delay = baseDelay * Math.pow(2, attempt);
146
+ ```
147
+
148
+ ## Contributing
149
+
150
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for local development setup and how to write rules.
151
+
152
+ ## Security
153
+
154
+ Please report vulnerabilities privately as described in [SECURITY.md](SECURITY.md).
155
+
156
+ ## License
157
+
158
+ [MIT](LICENSE)
package/dist/bin.d.mts ADDED
@@ -0,0 +1 @@
1
+ export { };