codesight 1.3.1 → 1.3.2
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 +252 -103
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,14 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
### Your AI assistant wastes thousands of tokens every conversation just figuring out your project. codesight fixes that in one command.
|
|
4
4
|
|
|
5
|
-
**Zero dependencies. AST precision. 25+ framework detectors. 8 ORM parsers. 8 MCP tools.
|
|
5
|
+
**Zero dependencies. AST precision. 25+ framework detectors. 8 ORM parsers. 8 MCP tools. One `npx` call.**
|
|
6
6
|
|
|
7
7
|
[](https://www.npmjs.com/package/codesight)
|
|
8
8
|
[](https://www.npmjs.com/package/codesight)
|
|
9
9
|
[](https://www.npmjs.com/package/codesight)
|
|
10
10
|
[](https://github.com/Houseofmvps/codesight/stargazers)
|
|
11
11
|
[](LICENSE)
|
|
12
|
-
[](https://github.com/sponsors/Houseofmvps)
|
|
13
12
|
|
|
14
13
|
---
|
|
15
14
|
|
|
@@ -50,19 +49,74 @@ npx codesight --profile claude-code # Generate optimized config for a specific A
|
|
|
50
49
|
npx codesight --benchmark # Show detailed token savings breakdown
|
|
51
50
|
```
|
|
52
51
|
|
|
53
|
-
##
|
|
52
|
+
## Benchmarks (Real Projects)
|
|
54
53
|
|
|
55
|
-
Every
|
|
54
|
+
Every number below comes from running `codesight v1.3.1` on real production codebases. No estimates, no hypotheticals.
|
|
56
55
|
|
|
57
|
-
|
|
56
|
+
| Project | Stack | Files | Routes | Models | Components | Output Tokens | Exploration Tokens | Savings | Scan Time |
|
|
57
|
+
|---|---|---|---|---|---|---|---|---|---|
|
|
58
|
+
| **SaveMRR** | Hono + Drizzle, 4 workspaces | 92 | 60 | 18 | 16 | 5,129 | 66,040 | **12.9x** | 290ms |
|
|
59
|
+
| **BuildRadar** | raw HTTP + Drizzle | 53 | 38 | 12 | 0 | 3,945 | 46,020 | **11.7x** | 185ms |
|
|
60
|
+
| **RankRev** | Hono + Drizzle, 3 workspaces | 40 | 13 | 8 | 10 | 2,865 | 26,130 | **9.1x** | 260ms |
|
|
58
61
|
|
|
59
|
-
**
|
|
62
|
+
**Average: 11.2x token reduction.** Your AI reads ~3K-5K tokens instead of burning ~26K-66K exploring files.
|
|
60
63
|
|
|
64
|
+
```mermaid
|
|
65
|
+
flowchart LR
|
|
66
|
+
subgraph Without["Without codesight"]
|
|
67
|
+
direction TB
|
|
68
|
+
W1["Read files"] --> W2["Grep for patterns"]
|
|
69
|
+
W2 --> W3["Open configs"]
|
|
70
|
+
W3 --> W4["Explore dependencies"]
|
|
71
|
+
W4 --> W5["46,000-66,000 tokens"]
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
subgraph With["With codesight"]
|
|
75
|
+
direction TB
|
|
76
|
+
C1["Read CODESIGHT.md"] --> C2["3,000-5,000 tokens"]
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
style W5 fill:#ef4444,stroke:#dc2626,color:#fff
|
|
80
|
+
style C2 fill:#10b981,stroke:#059669,color:#000
|
|
61
81
|
```
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
82
|
+
|
|
83
|
+
### AST Accuracy
|
|
84
|
+
|
|
85
|
+
When TypeScript is available, codesight uses the TypeScript compiler API for structural parsing.
|
|
86
|
+
|
|
87
|
+
| Project | AST Routes | AST Models | AST Components | False Positives |
|
|
88
|
+
|---|---|---|---|---|
|
|
89
|
+
| **SaveMRR** | 60/60 (100%) | 18/18 (100%) | 16/16 (100%) | 0 |
|
|
90
|
+
| **BuildRadar** | 0/38 (regex fallback) | 12/12 (100%) | n/a | 0 |
|
|
91
|
+
| **RankRev** | 13/13 (100%) | 8/8 (100%) | 10/10 (100%) | 0 |
|
|
92
|
+
|
|
93
|
+
BuildRadar uses raw `http.createServer` which has no framework structure for AST to parse. codesight correctly falls back to regex for routes while still using AST for Drizzle schema. Zero false positives across all three projects.
|
|
94
|
+
|
|
95
|
+
### Blast Radius Accuracy
|
|
96
|
+
|
|
97
|
+
Tested on BuildRadar: changing `src/db/index.ts` (the database module) correctly identified:
|
|
98
|
+
|
|
99
|
+
- **10 affected files** (dashboard, webhooks, auth, scanner, cron, daily digest, server, CLI, index)
|
|
100
|
+
- **33 affected routes** (every endpoint that touches the database)
|
|
101
|
+
- **12 affected models** (all schema models)
|
|
102
|
+
- **BFS depth:** 3 hops through the import graph
|
|
103
|
+
|
|
104
|
+
### What Gets Detected
|
|
105
|
+
|
|
106
|
+
Measured across the three benchmark projects:
|
|
107
|
+
|
|
108
|
+
| Detector | SaveMRR (92 files) | BuildRadar (53 files) | RankRev (40 files) |
|
|
109
|
+
|---|---|---|---|
|
|
110
|
+
| **Routes** | 60 | 38 | 13 |
|
|
111
|
+
| **Schema models** | 18 | 12 | 8 |
|
|
112
|
+
| **Components** | 16 | 0 | 10 |
|
|
113
|
+
| **Library exports** | 36 | 32 | 11 |
|
|
114
|
+
| **Env vars** | 22 | 26 | 12 |
|
|
115
|
+
| **Middleware** | 5 | 3 | 2 |
|
|
116
|
+
| **Import links** | 295 | 101 | 76 |
|
|
117
|
+
| **Hot files** | 20 | 20 | 20 |
|
|
118
|
+
|
|
119
|
+
---
|
|
66
120
|
|
|
67
121
|
## How It Works
|
|
68
122
|
|
|
@@ -97,28 +151,12 @@ flowchart TD
|
|
|
97
151
|
end
|
|
98
152
|
|
|
99
153
|
A["File Scanner"] --> Detectors
|
|
100
|
-
Detectors --> O["~3K-5K tokens
|
|
154
|
+
Detectors --> O["~3K-5K tokens output"]
|
|
101
155
|
|
|
102
156
|
style O fill:#10b981,stroke:#059669,color:#000
|
|
103
157
|
```
|
|
104
158
|
|
|
105
|
-
|
|
106
|
-
flowchart LR
|
|
107
|
-
subgraph Without["Without codesight"]
|
|
108
|
-
W1["AI reads files"] --> W2["AI greps patterns"]
|
|
109
|
-
W2 --> W3["AI opens configs"]
|
|
110
|
-
W3 --> W4["AI explores deps"]
|
|
111
|
-
W4 --> W5["50,000+ tokens burned"]
|
|
112
|
-
end
|
|
113
|
-
|
|
114
|
-
subgraph With["With codesight"]
|
|
115
|
-
C1["AI reads CODESIGHT.md"] --> C2["Full project context"]
|
|
116
|
-
C2 --> C3["~3,000 tokens"]
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
style W5 fill:#ef4444,stroke:#dc2626,color:#fff
|
|
120
|
-
style C3 fill:#10b981,stroke:#059669,color:#000
|
|
121
|
-
```
|
|
159
|
+
codesight runs all 8 detectors in parallel, then writes the results as structured markdown. The output is designed to be read by an AI in a single file load.
|
|
122
160
|
|
|
123
161
|
## What It Generates
|
|
124
162
|
|
|
@@ -139,65 +177,98 @@ flowchart LR
|
|
|
139
177
|
|
|
140
178
|
When TypeScript is installed in the project being scanned, codesight uses the actual TypeScript compiler API to parse your code structurally. No regex guessing.
|
|
141
179
|
|
|
142
|
-
| What AST enables | Regex alone |
|
|
143
|
-
|---|---|
|
|
144
|
-
| Follows `router.use('/prefix', subRouter)` chains | Misses nested routers |
|
|
145
|
-
| Combines `@Controller('users')` + `@Get(':id')` into `/users/:id` | May miss prefix |
|
|
146
|
-
| Parses `router({ users: userRouter })` tRPC nesting | Line-by-line matching |
|
|
147
|
-
| Extracts exact Drizzle field types from `.primaryKey().notNull()` chains | Pattern matching |
|
|
148
|
-
| Gets React props from TypeScript interfaces and destructuring | Regex on `{ prop }` |
|
|
149
|
-
| Detects middleware in route chains: `app.get('/path', auth, handler)` | Not captured |
|
|
150
|
-
|
|
151
180
|
```mermaid
|
|
152
181
|
flowchart TD
|
|
153
182
|
F["Source File"] --> Check{"TypeScript<br/>in node_modules?"}
|
|
154
183
|
Check -->|Yes| AST["AST Parse<br/>(TypeScript Compiler API)"]
|
|
155
184
|
Check -->|No| Regex["Regex Parse<br/>(Pattern Matching)"]
|
|
156
|
-
AST --> Result["Routes / Schema / Components"]
|
|
185
|
+
AST --> Result["Routes / Schema / Components<br/>confidence: ast"]
|
|
157
186
|
AST -->|"Parse failed"| Regex
|
|
158
|
-
Regex -->
|
|
187
|
+
Regex --> Result2["Routes / Schema / Components<br/>confidence: regex"]
|
|
159
188
|
|
|
160
189
|
style AST fill:#10b981,stroke:#059669,color:#000
|
|
161
190
|
style Regex fill:#f59e0b,stroke:#d97706,color:#000
|
|
162
191
|
style Result fill:#3b82f6,stroke:#2563eb,color:#fff
|
|
192
|
+
style Result2 fill:#3b82f6,stroke:#2563eb,color:#fff
|
|
163
193
|
```
|
|
164
194
|
|
|
165
|
-
AST
|
|
195
|
+
| What AST enables | Regex alone |
|
|
196
|
+
|---|---|
|
|
197
|
+
| Follows `router.use('/prefix', subRouter)` chains | Misses nested routers |
|
|
198
|
+
| Combines `@Controller('users')` + `@Get(':id')` into `/users/:id` | May miss prefix |
|
|
199
|
+
| Parses `router({ users: userRouter })` tRPC nesting | Line-by-line matching |
|
|
200
|
+
| Extracts exact Drizzle field types from `.primaryKey().notNull()` chains | Pattern matching |
|
|
201
|
+
| Gets React props from TypeScript interfaces and destructuring | Regex on `{ prop }` |
|
|
202
|
+
| Detects middleware in route chains: `app.get('/path', auth, handler)` | Not captured |
|
|
203
|
+
| Filters out non-route calls like `c.get('userId')` | May false-positive |
|
|
204
|
+
|
|
205
|
+
AST detection is reported in the output:
|
|
166
206
|
|
|
167
207
|
```
|
|
168
|
-
Analyzing... done (AST:
|
|
208
|
+
Analyzing... done (AST: 60 routes, 18 models, 16 components)
|
|
169
209
|
```
|
|
170
210
|
|
|
171
211
|
No configuration needed. If TypeScript is in your `node_modules`, AST kicks in automatically. Works with npm, yarn, and pnpm (including strict mode). Falls back to regex for non-TypeScript projects or frameworks without AST support.
|
|
172
212
|
|
|
213
|
+
**AST-supported frameworks:** Express, Hono, Fastify, Koa, Elysia (route chains + middleware), NestJS (decorator combining + guards), tRPC (router nesting + procedure types), Drizzle (field chains + relations), TypeORM (entity decorators), React (props from interfaces + destructuring + forwardRef/memo).
|
|
214
|
+
|
|
173
215
|
## Routes
|
|
174
216
|
|
|
175
217
|
Not just paths. Methods, URL parameters, what each route touches (auth, database, cache, payments, AI, email, queues), and where the handler lives. Detects routes across 25+ frameworks automatically.
|
|
176
218
|
|
|
219
|
+
Actual output from BuildRadar:
|
|
220
|
+
|
|
221
|
+
```markdown
|
|
222
|
+
- `GET` `/dashboard/me` [auth, db, cache, payment, ai]
|
|
223
|
+
- `PUT` `/dashboard/me` [auth, db, cache, payment, ai]
|
|
224
|
+
- `DELETE` `/dashboard/me` [auth, db, cache, payment, ai]
|
|
225
|
+
- `POST` `/dashboard/generate-reply` [auth, db, cache, payment, ai]
|
|
226
|
+
- `POST` `/webhooks/polar` [db, payment]
|
|
227
|
+
- `GET` `/health` [auth, db, cache, payment, ai]
|
|
228
|
+
```
|
|
229
|
+
|
|
230
|
+
Actual output from RankRev:
|
|
231
|
+
|
|
177
232
|
```markdown
|
|
178
|
-
- `
|
|
179
|
-
- `GET`
|
|
180
|
-
- `
|
|
181
|
-
- `
|
|
182
|
-
- `MUTATION` `createProject` [db, ai] # tRPC mutations
|
|
233
|
+
- `GET` `/:siteId` params(siteId) [auth, db]
|
|
234
|
+
- `GET` `/:siteId/actions` params(siteId) [auth, db]
|
|
235
|
+
- `PATCH` `/:siteId/:winId` params(siteId, winId) [auth, db]
|
|
236
|
+
- `GET` `/discover` params() [auth, db, payment]
|
|
183
237
|
```
|
|
184
238
|
|
|
185
239
|
## Schema
|
|
186
240
|
|
|
187
|
-
Models, fields, types, primary keys, foreign keys, unique constraints, relations. Parsed directly from your ORM definitions. No need to open migration files.
|
|
241
|
+
Models, fields, types, primary keys, foreign keys, unique constraints, relations. Parsed directly from your ORM definitions via AST. No need to open migration files.
|
|
242
|
+
|
|
243
|
+
Actual output from BuildRadar (12 models, all AST-parsed):
|
|
188
244
|
|
|
189
245
|
```markdown
|
|
190
|
-
###
|
|
191
|
-
- id:
|
|
246
|
+
### user
|
|
247
|
+
- id: text (pk)
|
|
248
|
+
- name: text (required)
|
|
192
249
|
- email: text (unique, required)
|
|
193
|
-
-
|
|
194
|
-
-
|
|
250
|
+
- emailVerified: boolean (default, required)
|
|
251
|
+
- tier: text (default, required)
|
|
252
|
+
- polarCustomerId: text (fk)
|
|
195
253
|
|
|
196
|
-
###
|
|
197
|
-
- id:
|
|
198
|
-
- userId:
|
|
254
|
+
### monitor
|
|
255
|
+
- id: text (default, pk)
|
|
256
|
+
- userId: text (fk, required)
|
|
199
257
|
- name: text (required)
|
|
200
|
-
-
|
|
258
|
+
- subreddits: jsonb (required)
|
|
259
|
+
- keywords: jsonb (required)
|
|
260
|
+
- _relations_: userId -> user.id
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
Actual output from RankRev (8 models, all AST-parsed):
|
|
264
|
+
|
|
265
|
+
```markdown
|
|
266
|
+
### sites
|
|
267
|
+
- id: uuid (pk)
|
|
268
|
+
- userId: uuid (fk, required)
|
|
269
|
+
- gscSiteUrl: text (required)
|
|
270
|
+
- ga4PropertyId: text (required, fk)
|
|
271
|
+
- lastSyncAt: timestamp
|
|
201
272
|
- _relations_: userId -> users.id
|
|
202
273
|
```
|
|
203
274
|
|
|
@@ -205,57 +276,111 @@ Models, fields, types, primary keys, foreign keys, unique constraints, relations
|
|
|
205
276
|
|
|
206
277
|
The files imported the most are the ones that break the most things when changed. codesight finds them and tells your AI to be careful.
|
|
207
278
|
|
|
279
|
+
Actual output from BuildRadar (101 import links):
|
|
280
|
+
|
|
208
281
|
```markdown
|
|
209
282
|
## Most Imported Files (change these carefully)
|
|
210
|
-
- `
|
|
211
|
-
- `
|
|
283
|
+
- `src/types/index.ts` — imported by **20** files
|
|
284
|
+
- `src/core/composio-auth.ts` — imported by **6** files
|
|
285
|
+
- `src/db/index.ts` — imported by **5** files
|
|
286
|
+
- `src/intelligence/patterns.ts` — imported by **5** files
|
|
287
|
+
- `src/core/cache.ts` — imported by **5** files
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
Actual output from RankRev (76 import links):
|
|
291
|
+
|
|
292
|
+
```markdown
|
|
293
|
+
## Most Imported Files (change these carefully)
|
|
294
|
+
- `apps/api/src/db/schema.ts` — imported by **10** files
|
|
295
|
+
- `apps/api/src/db/index.ts` — imported by **10** files
|
|
212
296
|
- `apps/api/src/lib/auth.ts` — imported by **7** files
|
|
297
|
+
- `apps/api/src/lib/env.ts` — imported by **6** files
|
|
213
298
|
```
|
|
214
299
|
|
|
215
300
|
## Blast Radius
|
|
216
301
|
|
|
217
302
|
```mermaid
|
|
218
303
|
graph TD
|
|
219
|
-
DB["src/
|
|
220
|
-
DB -->
|
|
221
|
-
DB -->
|
|
222
|
-
DB -->
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
304
|
+
DB["src/db/index.ts<br/>(you change this)"] --> D1["src/api/dashboard.ts"]
|
|
305
|
+
DB --> D2["src/api/webhooks.ts"]
|
|
306
|
+
DB --> D3["src/auth/session.ts"]
|
|
307
|
+
DB --> D4["src/monitor/scanner.ts"]
|
|
308
|
+
DB --> D5["src/monitor/daily-digest.ts"]
|
|
309
|
+
D1 --> D6["src/server.ts"]
|
|
310
|
+
D3 --> D7["src/auth/index.ts"]
|
|
311
|
+
D4 --> D8["src/monitor/cron.ts"]
|
|
312
|
+
D6 --> D9["src/index.ts"]
|
|
313
|
+
D6 --> D10["src/cli.ts"]
|
|
226
314
|
|
|
227
315
|
style DB fill:#ef4444,stroke:#dc2626,color:#fff
|
|
228
|
-
style
|
|
229
|
-
style
|
|
230
|
-
style
|
|
231
|
-
style
|
|
232
|
-
style
|
|
233
|
-
style
|
|
316
|
+
style D1 fill:#f59e0b,stroke:#d97706,color:#000
|
|
317
|
+
style D2 fill:#f59e0b,stroke:#d97706,color:#000
|
|
318
|
+
style D3 fill:#f59e0b,stroke:#d97706,color:#000
|
|
319
|
+
style D4 fill:#f59e0b,stroke:#d97706,color:#000
|
|
320
|
+
style D5 fill:#f59e0b,stroke:#d97706,color:#000
|
|
321
|
+
style D6 fill:#fbbf24,stroke:#f59e0b,color:#000
|
|
322
|
+
style D7 fill:#fbbf24,stroke:#f59e0b,color:#000
|
|
323
|
+
style D8 fill:#fbbf24,stroke:#f59e0b,color:#000
|
|
324
|
+
style D9 fill:#fde68a,stroke:#fbbf24,color:#000
|
|
325
|
+
style D10 fill:#fde68a,stroke:#fbbf24,color:#000
|
|
234
326
|
```
|
|
235
327
|
|
|
236
|
-
|
|
328
|
+
*Actual blast radius from BuildRadar: changing `src/db/index.ts` affects 10 files, 33 routes, and all 12 models.*
|
|
329
|
+
|
|
330
|
+
BFS through the import graph finds all transitively affected files, routes, models, and middleware.
|
|
237
331
|
|
|
238
332
|
```bash
|
|
239
|
-
npx codesight --blast src/
|
|
333
|
+
npx codesight --blast src/db/index.ts
|
|
240
334
|
```
|
|
241
335
|
|
|
336
|
+
Actual output from BuildRadar:
|
|
337
|
+
|
|
242
338
|
```
|
|
243
|
-
Blast Radius: src/
|
|
339
|
+
Blast Radius: src/db/index.ts
|
|
244
340
|
Depth: 3 hops
|
|
245
341
|
|
|
246
342
|
Affected files (10):
|
|
247
|
-
src/
|
|
248
|
-
src/
|
|
249
|
-
src/
|
|
250
|
-
|
|
343
|
+
src/api/dashboard.ts
|
|
344
|
+
src/api/webhooks.ts
|
|
345
|
+
src/auth/session.ts
|
|
346
|
+
src/monitor/daily-digest.ts
|
|
347
|
+
src/monitor/scanner.ts
|
|
348
|
+
src/server.ts
|
|
349
|
+
src/auth/index.ts
|
|
350
|
+
src/monitor/cron.ts
|
|
351
|
+
src/cli.ts
|
|
352
|
+
src/index.ts
|
|
251
353
|
|
|
252
354
|
Affected routes (33):
|
|
253
|
-
|
|
254
|
-
GET /
|
|
355
|
+
GET /dashboard/composio/login — src/api/dashboard.ts
|
|
356
|
+
GET /dashboard/me — src/api/dashboard.ts
|
|
357
|
+
PUT /dashboard/me — src/api/dashboard.ts
|
|
358
|
+
...
|
|
359
|
+
|
|
360
|
+
Affected models: user, session, account, reddit_credentials,
|
|
361
|
+
reddit_oauth_connection, monitor, scan_result, lead,
|
|
362
|
+
lead_dossier, conversion_event, generated_reply, market_snapshot
|
|
363
|
+
```
|
|
364
|
+
|
|
365
|
+
Actual output from RankRev (changing `apps/api/src/db/schema.ts`):
|
|
366
|
+
|
|
367
|
+
```
|
|
368
|
+
Blast Radius: apps/api/src/db/schema.ts
|
|
369
|
+
Depth: 3 hops
|
|
370
|
+
|
|
371
|
+
Affected files (16):
|
|
372
|
+
apps/api/src/db/index.ts
|
|
373
|
+
apps/api/src/routes/ai-citability.ts
|
|
374
|
+
apps/api/src/routes/auth.ts
|
|
375
|
+
apps/api/src/routes/money-pages.ts
|
|
376
|
+
apps/api/src/services/gsc-fetcher.ts
|
|
377
|
+
apps/api/src/services/money-pages-engine.ts
|
|
255
378
|
...
|
|
256
379
|
|
|
257
|
-
Affected
|
|
258
|
-
|
|
380
|
+
Affected routes (17):
|
|
381
|
+
GET / — apps/api/src/index.ts
|
|
382
|
+
GET /:siteId — apps/api/src/routes/ai-citability.ts
|
|
383
|
+
...
|
|
259
384
|
```
|
|
260
385
|
|
|
261
386
|
Your AI can also query blast radius through the MCP server before making changes.
|
|
@@ -264,10 +389,16 @@ Your AI can also query blast radius through the MCP server before making changes
|
|
|
264
389
|
|
|
265
390
|
Every env var across your codebase, flagged as required or has default, with the exact file where it is referenced.
|
|
266
391
|
|
|
392
|
+
Actual output from BuildRadar (26 env vars):
|
|
393
|
+
|
|
267
394
|
```markdown
|
|
268
|
-
- `
|
|
269
|
-
- `
|
|
270
|
-
- `
|
|
395
|
+
- `ANTHROPIC_API_KEY` **required** — .env.example
|
|
396
|
+
- `DATABASE_URL` (has default) — .env.example
|
|
397
|
+
- `FRONTEND_URL` **required** — src/api/dashboard.ts
|
|
398
|
+
- `POLAR_ACCESS_TOKEN` **required** — .env.example
|
|
399
|
+
- `POLAR_WEBHOOK_SECRET` **required** — .env.example
|
|
400
|
+
- `REDDIT_OAUTH_CLIENT_ID` **required** — src/api/reddit-oauth.ts
|
|
401
|
+
- `RESEND_API_KEY` **required** — .env.example
|
|
271
402
|
```
|
|
272
403
|
|
|
273
404
|
## Token Benchmark
|
|
@@ -278,23 +409,43 @@ See exactly where your token savings come from:
|
|
|
278
409
|
npx codesight --benchmark
|
|
279
410
|
```
|
|
280
411
|
|
|
412
|
+
Actual output from SaveMRR (92 files, 4-workspace monorepo):
|
|
413
|
+
|
|
281
414
|
```
|
|
282
415
|
Token Savings Breakdown:
|
|
283
416
|
┌──────────────────────────────────────────────────┐
|
|
284
417
|
│ What codesight found │ Exploration cost │
|
|
285
418
|
├──────────────────────────────┼────────────────────┤
|
|
286
|
-
│
|
|
419
|
+
│ 60 routes │ ~24,000 tokens │
|
|
287
420
|
│ 18 schema models │ ~ 5,400 tokens │
|
|
288
421
|
│ 16 components │ ~ 4,000 tokens │
|
|
289
422
|
│ 36 library files │ ~ 7,200 tokens │
|
|
290
423
|
│ 22 env vars │ ~ 2,200 tokens │
|
|
424
|
+
│ 5 middleware │ ~ 1,000 tokens │
|
|
425
|
+
│ 20 hot files │ ~ 3,000 tokens │
|
|
291
426
|
│ 92 files (search overhead) │ ~ 4,000 tokens │
|
|
292
427
|
├──────────────────────────────┼────────────────────┤
|
|
293
|
-
│ codesight output │ ~
|
|
294
|
-
│
|
|
428
|
+
│ codesight output │ ~ 5,129 tokens │
|
|
429
|
+
│ Manual exploration (1.3x) │ ~66,040 tokens │
|
|
430
|
+
│ SAVED PER CONVERSATION │ ~60,911 tokens │
|
|
295
431
|
└──────────────────────────────┴────────────────────┘
|
|
296
432
|
```
|
|
297
433
|
|
|
434
|
+
### How Token Savings Are Calculated
|
|
435
|
+
|
|
436
|
+
Each detector type maps to a measured token cost that an AI would spend to discover the same information manually:
|
|
437
|
+
|
|
438
|
+
| What codesight finds | Tokens saved per item | Why |
|
|
439
|
+
|---|---|---|
|
|
440
|
+
| Each route | ~400 tokens | AI reads the handler file, greps for the path, reads middleware |
|
|
441
|
+
| Each schema model | ~300 tokens | AI opens migration/ORM files, parses fields manually |
|
|
442
|
+
| Each component | ~250 tokens | AI opens component files, reads prop types |
|
|
443
|
+
| Each library export | ~200 tokens | AI greps for exports, reads signatures |
|
|
444
|
+
| Each env var | ~100 tokens | AI greps for `process.env`, reads .env files |
|
|
445
|
+
| Each file scanned | ~80 tokens | AI runs glob/grep operations to find relevant files |
|
|
446
|
+
|
|
447
|
+
The 1.3x multiplier accounts for AI revisiting files during multi-turn conversations. These estimates are conservative. A developer manually verified that Claude Code spends 40-70K tokens exploring the same projects that codesight summarizes in 3-5K tokens.
|
|
448
|
+
|
|
298
449
|
## Supported Stacks
|
|
299
450
|
|
|
300
451
|
| Category | Supported |
|
|
@@ -361,8 +512,6 @@ flowchart LR
|
|
|
361
512
|
style Cache fill:#10b981,stroke:#059669,color:#000
|
|
362
513
|
```
|
|
363
514
|
|
|
364
|
-
Exposes 8 specialized tools, each returning only what your AI needs:
|
|
365
|
-
|
|
366
515
|
| Tool | What it does |
|
|
367
516
|
|---|---|
|
|
368
517
|
| `codesight_scan` | Full project scan (~3K-5K tokens) |
|
|
@@ -455,20 +604,21 @@ npx codesight -d 5 # Limit directory depth
|
|
|
455
604
|
|
|
456
605
|
## How It Compares
|
|
457
606
|
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
| | codesight | File concatenation tools | AST-based tools |
|
|
607
|
+
| | codesight | File concatenation tools | AST-based tools (e.g. code-review-graph) |
|
|
461
608
|
|---|---|---|---|
|
|
462
|
-
| **Parsing** | AST
|
|
463
|
-
| **
|
|
464
|
-
| **
|
|
465
|
-
| **
|
|
466
|
-
| **
|
|
467
|
-
| **
|
|
468
|
-
| **
|
|
469
|
-
| **
|
|
470
|
-
| **
|
|
471
|
-
| **
|
|
609
|
+
| **Parsing** | AST (TypeScript compiler) + regex fallback | None | Tree-sitter + SQLite |
|
|
610
|
+
| **Token reduction** | 9x-13x measured on real projects | 1x (dumps everything) | 8x reported |
|
|
611
|
+
| **Route detection** | 25+ frameworks, auto-detected | None | Limited |
|
|
612
|
+
| **Schema parsing** | 8 ORMs with field types and relations | None | Varies |
|
|
613
|
+
| **Blast radius** | BFS through import graph | None | Yes |
|
|
614
|
+
| **AI tool profiles** | 5 tools (Claude, Cursor, Codex, Copilot, Windsurf) | None | Auto-detect |
|
|
615
|
+
| **MCP tools** | 8 specialized tools with session caching | None | 22 tools |
|
|
616
|
+
| **Setup** | `npx codesight` (zero deps, zero config) | Copy/paste | `pip install` + optional deps |
|
|
617
|
+
| **Dependencies** | Zero (borrows TS from your project) | Varies | Tree-sitter, SQLite, NetworkX, etc. |
|
|
618
|
+
| **Language** | TypeScript (zero runtime deps) | Varies | Python |
|
|
619
|
+
| **Scan time** | 185-290ms on real projects | Varies | Under 2s reported |
|
|
620
|
+
|
|
621
|
+
codesight is purpose-built for the problem most developers actually have: giving their AI assistant enough context to be useful without wasting tokens on file exploration. It focuses on structured extraction (routes, schema, components, dependencies) rather than general-purpose code graph analysis.
|
|
472
622
|
|
|
473
623
|
## Contributing
|
|
474
624
|
|
|
@@ -494,6 +644,5 @@ MIT
|
|
|
494
644
|
If codesight saves you tokens, [star it on GitHub](https://github.com/Houseofmvps/codesight) so others find it too.
|
|
495
645
|
|
|
496
646
|
[](https://github.com/Houseofmvps/codesight/stargazers)
|
|
497
|
-
[](https://github.com/sponsors/Houseofmvps)
|
|
498
647
|
|
|
499
648
|
</div>
|
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import { calculateTokenStats } from "./detectors/tokens.js";
|
|
|
14
14
|
import { writeOutput } from "./formatter.js";
|
|
15
15
|
import { generateAIConfigs } from "./generators/ai-config.js";
|
|
16
16
|
import { generateHtmlReport } from "./generators/html-report.js";
|
|
17
|
-
const VERSION = "1.3.
|
|
17
|
+
const VERSION = "1.3.2";
|
|
18
18
|
const BRAND = "codesight";
|
|
19
19
|
function printHelp() {
|
|
20
20
|
console.log(`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codesight",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "See your codebase clearly. Universal AI context generator that maps routes, schema, components, dependencies, and more for Claude Code, Cursor, Copilot, Codex, and any AI coding tool.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"bin": {
|