repolens-ai 2.0.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 Harry-Kien
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,285 @@
1
+ <div align="center">
2
+
3
+ # ๐Ÿ” RepoLens AI
4
+
5
+ ### The AI Context Intelligence Platform
6
+
7
+ **Your AI agents are only as good as the context you give them.**
8
+
9
+ [![npm version](https://img.shields.io/npm/v/repolens-ai.svg?style=flat-square)](https://www.npmjs.com/package/repolens-ai)
10
+ [![license](https://img.shields.io/badge/license-MIT-blue.svg?style=flat-square)](LICENSE)
11
+ [![node](https://img.shields.io/badge/node-%3E%3D18-brightgreen.svg?style=flat-square)](https://nodejs.org)
12
+ [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](CONTRIBUTING.md)
13
+
14
+ *Stop auto-generating garbage AGENTS.md. Start curating context that actually works.*
15
+
16
+ </div>
17
+
18
+ ---
19
+
20
+ ## The Problem
21
+
22
+ Auto-generated `AGENTS.md` files **reduce** AI agent performance by 2-3% (ETH Zurich, 2025). They waste tokens, add noise, and contain only information AI agents can already infer on their own.
23
+
24
+ Meanwhile, **hand-curated context files** with tribal knowledge improve performance by ~4%.
25
+
26
+ The problem isn't missing context files โ€” it's **bad** context files.
27
+
28
+ ## What RepoLens AI Does
29
+
30
+ RepoLens AI is a **context quality platform** that helps you:
31
+
32
+ - โญ **Setup** AI context for 6 tools with ONE command
33
+ - ๐Ÿ“Š **Score** your context files quality (0-100, 5 dimensions)
34
+ - ๐Ÿ”„ **Sync** AGENTS.md โ†’ Cursor (.mdc) โ†’ Claude โ†’ Copilot โ†’ Windsurf โ†’ Codex
35
+ - ๐Ÿ“š **Templates** โ€” 12 curated framework templates with real gotchas
36
+ - ๐Ÿ”ง **Fix** โ€” auto-remove generic rules that hurt AI performance
37
+
38
+ ### Supported AI Tools
39
+
40
+ | Tool | File Generated | Format |
41
+ |---|---|---|
42
+ | **Cursor IDE** | `.cursor/rules/project.mdc` | MDC (modern, YAML frontmatter) |
43
+ | **Cursor IDE** | `.cursorrules` | Legacy format |
44
+ | **Claude Code** | `CLAUDE.md` | Markdown |
45
+ | **GitHub Copilot** | `.github/copilot-instructions.md` | Markdown |
46
+ | **OpenAI Codex** | `CODEX.md` | Markdown |
47
+ | **Windsurf** | `.windsurfrules` | Rules format |
48
+ | **Antigravity / All** | `AGENTS.md` | Universal (source of truth) |
49
+
50
+ ## Install
51
+
52
+ ```bash
53
+ npm install -g repolens-ai
54
+ repolens --version
55
+ ```
56
+
57
+ > **Requires:** Node.js โ‰ฅ 18. Download at [nodejs.org](https://nodejs.org).
58
+
59
+ ## Quick Start
60
+
61
+ ```bash
62
+ cd my-project
63
+
64
+ # ONE COMMAND โ€” sets up everything
65
+ repolens setup
66
+ ```
67
+
68
+ That's it. `repolens setup` will:
69
+ 1. โœ… Analyze your project (framework, architecture, code)
70
+ 2. โœ… Create AGENTS.md (with framework-specific template if available)
71
+ 3. โœ… Sync to 6 AI tools (Cursor .mdc, Claude, Copilot, Windsurf, Codex)
72
+ 4. โœ… Generate skill files for Cursor
73
+ 5. โœ… Score your context quality
74
+
75
+ **Want more control?** Use individual commands:
76
+
77
+ ```bash
78
+ repolens init # Interactive AGENTS.md creation (10 questions)
79
+ repolens lint # Score your context quality (0-100)
80
+ repolens fix # Auto-fix generic rules
81
+ repolens sync # Sync to all AI tools
82
+ repolens templates # Browse 12 framework templates
83
+ repolens dashboard # Visual web dashboard
84
+ ```
85
+
86
+ ## Commands
87
+
88
+ ### ๐Ÿ†• Context Intelligence (New in v2.0)
89
+
90
+ #### `repolens init`
91
+
92
+ Interactive AGENTS.md creation through developer interview. Extracts **tribal knowledge** โ€” gotchas, architecture decisions, specific commands โ€” the stuff AI agents can't figure out on their own.
93
+
94
+ ```bash
95
+ repolens init # Interactive mode (recommended)
96
+ repolens init -y # Auto-detect only, no questions
97
+ ```
98
+
99
+ **Asks smart questions like:**
100
+ - "Any gotchas or pitfalls a developer should know?"
101
+ - "Key architecture decisions?"
102
+ - "Files that should NEVER be modified?"
103
+
104
+ #### `repolens lint`
105
+
106
+ Score and analyze your AI context files. Measures 5 dimensions:
107
+
108
+ ```bash
109
+ repolens lint
110
+ ```
111
+
112
+ **Scores:**
113
+ | Metric | What It Measures |
114
+ |---|---|
115
+ | **Specificity** | Project-specific vs generic rules |
116
+ | **Coverage** | Important areas covered |
117
+ | **Conciseness** | Not too long (agents struggle with >200 lines) |
118
+ | **Freshness** | References actual project files |
119
+ | **Tribal Knowledge** | Non-inferable information (gotchas, decisions) |
120
+
121
+ **Detects anti-patterns like:**
122
+ - `"Never commit secrets"` โ†’ Generic, AI already knows this
123
+ - `"Follow TypeScript conventions"` โ†’ Generic, wastes tokens
124
+ - `"Validate all input"` โ†’ Generic, provides zero value
125
+
126
+ #### `repolens sync`
127
+
128
+ Keep all your AI context files in sync from a single source of truth.
129
+
130
+ ```bash
131
+ repolens sync # Sync AGENTS.md โ†’ all targets
132
+ repolens sync --dry-run # Preview without writing
133
+ repolens sync --force # Overwrite files with manual edits
134
+ ```
135
+
136
+ **Syncs to:**
137
+ - `CLAUDE.md` (Claude Code)
138
+ - `.cursorrules` (Cursor IDE)
139
+ - `.github/copilot-instructions.md` (GitHub Copilot)
140
+
141
+ #### `repolens doctor`
142
+
143
+ Health check for your AI development setup.
144
+
145
+ ```bash
146
+ repolens doctor
147
+ ```
148
+
149
+ **Checks:** Context files ยท Git ยท .gitignore ยท Environment security ยท Scripts ยท Sync status
150
+
151
+ #### `repolens dashboard`
152
+
153
+ Launch a beautiful local web dashboard for visual context management.
154
+
155
+ ```bash
156
+ repolens dashboard # Open at http://localhost:3141
157
+ repolens dashboard -p 8080 # Custom port
158
+ ```
159
+
160
+ **Dashboard shows:**
161
+ - Context quality scores with ring charts
162
+ - Risk analysis with severity breakdown
163
+ - Code intelligence (functions, classes, LOC)
164
+ - Context files sync status
165
+ - Largest files analysis
166
+
167
+ #### `repolens templates`
168
+
169
+ Browse and apply curated AGENTS.md templates for 12+ popular frameworks โ€” each containing **real tribal knowledge** (gotchas, pitfalls, conventions) written by experienced developers.
170
+
171
+ ```bash
172
+ repolens templates # Browse all templates
173
+ repolens templates --search react # Search by keyword
174
+ repolens templates --apply nextjs # Apply a template to your project
175
+ ```
176
+
177
+ **Available templates:** Next.js, React+Vite, Vue/Nuxt, Express, NestJS, Django, FastAPI, Laravel, React Native, HTML/CSS/JS, T3 Stack, Supabase, and more.
178
+
179
+ #### `repolens fix`
180
+
181
+ Auto-fix detected issues โ€” removes generic rules that hurt AI performance, cleans up boilerplate, and improves quality scores automatically.
182
+
183
+ ```bash
184
+ repolens fix # Fix and save (creates backups)
185
+ repolens fix --dry-run # Preview fixes without writing
186
+ ```
187
+
188
+ #### `repolens skills`
189
+
190
+ Generate `.cursor/skills/` files โ€” task-specific instructions that help AI agents perform complex tasks correctly (authentication, database, deployment, debugging, responsive UI).
191
+
192
+ ```bash
193
+ repolens skills --list # See available skills
194
+ repolens skills --all # Generate all relevant skill files
195
+ ```
196
+
197
+ ### Analysis & Review (Upgraded)
198
+
199
+ ```bash
200
+ repolens analyze # Full repo analysis (now reads code content)
201
+ repolens arch # Architecture deep-dive
202
+ repolens explain auth # Explain a module (now searches code, not just filenames)
203
+ repolens review # Review recent changes
204
+ repolens risks # Security & architecture risks
205
+ repolens onboard # Generate onboarding guide
206
+ ```
207
+
208
+ ## Why Not Just Write AGENTS.md Manually?
209
+
210
+ You should! But RepoLens AI helps you write **better** ones:
211
+
212
+ | Without RepoLens | With RepoLens |
213
+ |---|---|
214
+ | You forget to add gotchas | Interactive interview extracts tribal knowledge |
215
+ | You don't know if your rules are generic | Lint scores specificity and detects anti-patterns |
216
+ | You maintain 4 separate context files | Sync keeps everything in sync automatically |
217
+ | You don't know if context is outdated | Freshness scoring detects stale references |
218
+ | You can't visualize context quality | Dashboard shows scores and issues visually |
219
+
220
+ ## Privacy First
221
+
222
+ - โœ… **Never uploads code** โ€” everything runs locally
223
+ - โœ… **Never reads .env values** โ€” detects existence only
224
+ - โœ… **Masks all secrets** in output
225
+ - โœ… **Works fully offline** โ€” AI is optional
226
+ - โœ… **No telemetry** โ€” zero tracking
227
+
228
+ ## Supported Frameworks
229
+
230
+ Auto-detects 15+ frameworks: Next.js, React, Vue, Angular, SvelteKit, NestJS, Express, Fastify, Hono, Laravel, Django, FastAPI, Flask, Rails, Go, Rust, Odoo, and more.
231
+
232
+ ## AI Enhancement (Optional)
233
+
234
+ Works **perfectly without any API key**. For AI-enhanced explanations:
235
+
236
+ ```bash
237
+ export OPENAI_API_KEY=your-key-here
238
+ repolens analyze
239
+ ```
240
+
241
+ ## Roadmap
242
+
243
+ - [x] 12 CLI commands
244
+ - [x] Interactive knowledge extraction
245
+ - [x] Context quality scoring (5 dimensions)
246
+ - [x] Cross-tool sync (AGENTS.md โ†’ CLAUDE.md โ†’ .cursorrules โ†’ Copilot)
247
+ - [x] Local web dashboard
248
+ - [x] Code-content-aware analysis
249
+ - [x] Privacy-first design
250
+ - [ ] VSCode extension
251
+ - [ ] GitHub PR review bot
252
+ - [ ] Team collaboration dashboard
253
+ - [ ] Custom scoring rules
254
+ - [ ] Multi-repo analysis
255
+ - [ ] CI/CD integration (fail PR if context is stale)
256
+
257
+ ## Contributing
258
+
259
+ ```bash
260
+ git clone https://github.com/repolens/repolens-ai.git
261
+ cd repolens-ai
262
+ npm install
263
+ npm run build
264
+ npm link
265
+
266
+ # Test locally
267
+ repolens doctor
268
+ repolens lint
269
+ ```
270
+
271
+ ## License
272
+
273
+ MIT ยฉ RepoLens AI Contributors
274
+
275
+ ---
276
+
277
+ <div align="center">
278
+
279
+ **Built for the AI coding era.**
280
+
281
+ *Stop guessing. Start curating.*
282
+
283
+ [Get Started](#install) ยท [Report Bug](https://github.com/repolens/repolens-ai/issues) ยท [Request Feature](https://github.com/repolens/repolens-ai/issues)
284
+
285
+ </div>