@yawlabs/ctxlint 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 +21 -0
- package/README.md +123 -0
- package/dist/index.js +1147 -0
- package/dist/mcp/server.js +1076 -0
- package/package.json +72 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Yaw Labs
|
|
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,123 @@
|
|
|
1
|
+
# ctxlint
|
|
2
|
+
|
|
3
|
+
Lint your AI agent context files against your actual codebase.
|
|
4
|
+
|
|
5
|
+
Your `CLAUDE.md` is lying to your agent. ctxlint catches it.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @yawlabs/ctxlint
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Or run directly:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npx @yawlabs/ctxlint
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## What It Checks
|
|
20
|
+
|
|
21
|
+
| Check | What it finds |
|
|
22
|
+
|-------|--------------|
|
|
23
|
+
| **Broken paths** | File references in context that don't exist in your project |
|
|
24
|
+
| **Wrong commands** | Build/test commands that don't match your package.json scripts |
|
|
25
|
+
| **Stale context** | Context files not updated after recent code changes |
|
|
26
|
+
| **Token waste** | How much context window your files consume per session |
|
|
27
|
+
| **Redundancy** | Content the agent can already infer (e.g. "We use React" when react is in package.json) |
|
|
28
|
+
|
|
29
|
+
## Supported Context Files
|
|
30
|
+
|
|
31
|
+
| File | Tool |
|
|
32
|
+
|------|------|
|
|
33
|
+
| `CLAUDE.md`, `CLAUDE.local.md` | Claude Code |
|
|
34
|
+
| `AGENTS.md` | Multi-agent |
|
|
35
|
+
| `.cursorrules`, `.cursor/rules/*.md` | Cursor |
|
|
36
|
+
| `copilot-instructions.md` | GitHub Copilot |
|
|
37
|
+
| `.windsurfrules`, `.windsurf/rules/*.md` | Windsurf |
|
|
38
|
+
| `GEMINI.md` | Gemini |
|
|
39
|
+
| `JULES.md` | Jules |
|
|
40
|
+
| `.clinerules` | Cline |
|
|
41
|
+
| `CONVENTIONS.md` | General |
|
|
42
|
+
|
|
43
|
+
## Example Output
|
|
44
|
+
|
|
45
|
+
```
|
|
46
|
+
ctxlint v0.1.0
|
|
47
|
+
|
|
48
|
+
Scanning /Users/you/my-app...
|
|
49
|
+
|
|
50
|
+
Found 2 context files (1,847 tokens total)
|
|
51
|
+
CLAUDE.md (1,203 tokens, 42 lines)
|
|
52
|
+
AGENTS.md -> CLAUDE.md (symlink)
|
|
53
|
+
|
|
54
|
+
CLAUDE.md
|
|
55
|
+
✗ Line 12: src/auth/middleware.ts does not exist
|
|
56
|
+
→ Did you mean src/middleware/auth.ts? (renamed 14 days ago)
|
|
57
|
+
✗ Line 8: "pnpm test" — script "test" not found in package.json
|
|
58
|
+
⚠ Last updated 47 days ago. src/routes/ has 8 commits since.
|
|
59
|
+
ℹ Line 3: "Express" is in package.json dependencies — agent can infer this
|
|
60
|
+
|
|
61
|
+
Summary: 2 errors, 1 warning, 1 info
|
|
62
|
+
Token usage: 1,203 tokens per agent session
|
|
63
|
+
Estimated waste: ~55 tokens (redundant content)
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Options
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
Usage: ctxlint [options] [path]
|
|
70
|
+
|
|
71
|
+
Arguments:
|
|
72
|
+
path Project directory to scan (default: ".")
|
|
73
|
+
|
|
74
|
+
Options:
|
|
75
|
+
--strict Exit code 1 on any warning or error (for CI)
|
|
76
|
+
--checks <list> Comma-separated: paths, commands, staleness, tokens, redundancy
|
|
77
|
+
--ignore <list> Comma-separated checks to skip
|
|
78
|
+
--format json Output as JSON (for programmatic use)
|
|
79
|
+
--tokens Show token breakdown per file
|
|
80
|
+
--verbose Show passing checks too
|
|
81
|
+
-V, --version Output the version number
|
|
82
|
+
-h, --help Display help
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Use in CI
|
|
86
|
+
|
|
87
|
+
```yaml
|
|
88
|
+
- name: Lint context files
|
|
89
|
+
run: npx @yawlabs/ctxlint --strict
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
Exits with code 1 if any errors or warnings are found.
|
|
93
|
+
|
|
94
|
+
## Use as MCP Server
|
|
95
|
+
|
|
96
|
+
ctxlint ships with an MCP server that exposes three tools (`ctxlint_audit`, `ctxlint_validate_path`, `ctxlint_token_report`):
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
# Claude Code
|
|
100
|
+
claude mcp add ctxlint -- node node_modules/ctxlint/dist/mcp/server.js
|
|
101
|
+
|
|
102
|
+
# Or run from source
|
|
103
|
+
claude mcp add ctxlint -- node /path/to/ctxlint/dist/mcp/server.js
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
## JSON Output
|
|
107
|
+
|
|
108
|
+
```bash
|
|
109
|
+
npx @yawlabs/ctxlint --format json
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Returns structured JSON with all file results, issues, and summary — useful for building integrations or dashboards.
|
|
113
|
+
|
|
114
|
+
## Also By Yaw Labs
|
|
115
|
+
|
|
116
|
+
- [Yaw](https://yaw.sh) — The AI-native terminal
|
|
117
|
+
- [mcp.hosting](https://mcp.hosting) — MCP server proxy platform
|
|
118
|
+
- [Token Meter](https://tokenmeter.sh) — LLM spend tracking
|
|
119
|
+
- [Token Limit News](https://tokenlimit.news) — Weekly AI dev tooling newsletter
|
|
120
|
+
|
|
121
|
+
## License
|
|
122
|
+
|
|
123
|
+
MIT
|