projectlens 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.
Files changed (58) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +128 -0
  3. package/dist/chunk-2ESYSVXG.js +48 -0
  4. package/dist/cli.js +5142 -0
  5. package/dist/esm-UD73TBFV.js +5195 -0
  6. package/dist/lib-RYPZ47SK.js +32422 -0
  7. package/dist/promise-RZT5M2G5.js +19290 -0
  8. package/package.json +37 -0
  9. package/public/404.html +1 -0
  10. package/public/__next.__PAGE__.txt +6 -0
  11. package/public/__next._full.txt +19 -0
  12. package/public/__next._head.txt +5 -0
  13. package/public/__next._index.txt +8 -0
  14. package/public/__next._tree.txt +5 -0
  15. package/public/_next/static/Y9zjmXhW-zuG8Rhhw7lhH/_buildManifest.js +11 -0
  16. package/public/_next/static/Y9zjmXhW-zuG8Rhhw7lhH/_clientMiddlewareManifest.js +1 -0
  17. package/public/_next/static/Y9zjmXhW-zuG8Rhhw7lhH/_ssgManifest.js +1 -0
  18. package/public/_next/static/chunks/00g6ktfqbvh0k.js +1 -0
  19. package/public/_next/static/chunks/02jqkfcbj77p5.css +2 -0
  20. package/public/_next/static/chunks/03~yq9q893hmn.js +1 -0
  21. package/public/_next/static/chunks/04..ecqvwwq50.js +409 -0
  22. package/public/_next/static/chunks/060q84nvp94s6.js +5 -0
  23. package/public/_next/static/chunks/0ag9_thdvsufz.js +1 -0
  24. package/public/_next/static/chunks/0fulyomwb7at-.js +1 -0
  25. package/public/_next/static/chunks/0l0vfv7tr4h1n.css +1 -0
  26. package/public/_next/static/chunks/0~hotr4crj3w3.js +1 -0
  27. package/public/_next/static/chunks/17mke5d8u31kx.js +31 -0
  28. package/public/_next/static/chunks/turbopack-0btzs1a7324pk.js +1 -0
  29. package/public/_next/static/media/13bf9871fe164e7f-s.0s19wthhh_6~m.woff2 +0 -0
  30. package/public/_next/static/media/3fe682a82f50d426-s.09q3q1i5159bl.woff2 +0 -0
  31. package/public/_next/static/media/53b9e256198e5412-s.0-wfv7uh4i7h9.woff2 +0 -0
  32. package/public/_next/static/media/70bc3e132a0a741e-s.p.1409xf.ylxg8g.woff2 +0 -0
  33. package/public/_next/static/media/7178b3e590c64307-s.0nx0ww8fni_q3.woff2 +0 -0
  34. package/public/_next/static/media/71b036adf157cdcf-s.03nf~dfjdkf~..woff2 +0 -0
  35. package/public/_next/static/media/89b21bb081cb7469-s.0gfhww.tctz1o.woff2 +0 -0
  36. package/public/_next/static/media/8a480f0b521d4e75-s.0jzbimsg8vl84.woff2 +0 -0
  37. package/public/_next/static/media/caa3a2e1cccd8315-s.p.09~u27dqhyhd6.woff2 +0 -0
  38. package/public/_next/static/media/cc545e633e20c56d-s.0dza.stei.9v7.woff2 +0 -0
  39. package/public/_next/static/media/fef07dbb0973bf53-s.12tyk43_3sh9u.woff2 +0 -0
  40. package/public/_not-found/__next._full.txt +18 -0
  41. package/public/_not-found/__next._head.txt +5 -0
  42. package/public/_not-found/__next._index.txt +8 -0
  43. package/public/_not-found/__next._not-found/__PAGE__.txt +5 -0
  44. package/public/_not-found/__next._not-found.txt +5 -0
  45. package/public/_not-found/__next._tree.txt +3 -0
  46. package/public/_not-found.html +1 -0
  47. package/public/_not-found.txt +18 -0
  48. package/public/apple-icon.png +0 -0
  49. package/public/icon-dark-32x32.png +0 -0
  50. package/public/icon-light-32x32.png +0 -0
  51. package/public/icon.svg +26 -0
  52. package/public/index.html +1 -0
  53. package/public/index.txt +19 -0
  54. package/public/placeholder-logo.png +0 -0
  55. package/public/placeholder-logo.svg +1 -0
  56. package/public/placeholder-user.jpg +0 -0
  57. package/public/placeholder.jpg +0 -0
  58. package/public/placeholder.svg +1 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License Copyright (c) 2026 dagmawibabi
2
+
3
+ Permission is hereby granted, free of
4
+ charge, to any person obtaining a copy of this software and associated
5
+ documentation files (the "Software"), to deal in the Software without
6
+ restriction, including without limitation the rights to use, copy, modify, merge,
7
+ publish, distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to the
9
+ following conditions:
10
+
11
+ The above copyright notice and this permission notice
12
+ (including the next paragraph) shall be included in all copies or substantial
13
+ portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
16
+ ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
17
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO
18
+ EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
19
+ OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
20
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,128 @@
1
+ # CodeLens CLI
2
+
3
+ Local lint, type-check & AI security dashboard for JS/TS projects (Next.js, SvelteKit, Vue, plain Node).
4
+
5
+ Run one command inside any project and CodeLens runs your **real** ESLint and
6
+ TypeScript toolchain, audits your dependencies, runs an AI security review over
7
+ your source, and opens a live dashboard at `localhost:4321`.
8
+
9
+ ```bash
10
+ codelens # run checks + open the dashboard
11
+ codelens --no-ai # skip the AI security pass (lint + types only)
12
+ codelens --ci # run once, print a summary, exit non-zero on issues
13
+ codelens --json # print the full report as JSON and exit
14
+ codelens --min-score 80 # in --ci mode, fail if health score < 80
15
+ ```
16
+
17
+ ## What the dashboard shows
18
+
19
+ The dashboard turns one run into a navigable workspace:
20
+
21
+ - **Overview** — composite health score, severity breakdown, and per-category summaries.
22
+ - **Trends** — an interactive multi-metric chart and per-run history table built from
23
+ the local `.codelens/` run history (deltas, peak/low/avg).
24
+ - **Code quality** — Lint, Types, and Tests findings from your real toolchain.
25
+ - **Security** — AI security review with severity sub-tabs (Critical → Info).
26
+ - **Dependencies** — real CVE advisories with fix-version guidance.
27
+ - **Database** — schema inspection plus a foreign-key relationship graph.
28
+ - **API surface** — a map of detected routes (Next, Express, Hono, Fastify, SvelteKit,
29
+ Nuxt) with method, auth, and validation coverage.
30
+ - **Auth, Environment, Network, Git/CI, Docs** — focused panels for each area.
31
+ - **Task Manager** — a built-in kanban board (see below).
32
+
33
+ ### Task Manager (dashboard-only)
34
+
35
+ Every finding has a **Track task** action — in its detail sheet and inline on each
36
+ list row. Tracking adds it to a kanban board and marks the row so you can see what's
37
+ already on your worklist at a glance.
38
+
39
+ - **Custom columns** — rename/delete the defaults (To do / In progress / Done) and add
40
+ your own; drag cards between columns to change status.
41
+ - **Groups/tags** — file tasks under labels like "This sprint" or "Tech debt" and filter
42
+ by them; create a group inline while tracking.
43
+ - **Detail** — click a tracked finding to reopen its full analysis; click a free-form task
44
+ to edit its column, priority, group, and notes.
45
+
46
+ The board is stored only in your browser (localStorage) — it never leaves your machine or
47
+ reaches the CLI. Manage or reset it from **Settings → Task board**.
48
+
49
+ ## How it works
50
+
51
+ ```
52
+ cli.ts entry point + flag parsing (commander)
53
+ run.ts orchestrates the pipeline, emits streaming events
54
+ detect.ts reads package.json → framework + package manager
55
+ runners/eslint.ts spawns your local eslint, parses --format json
56
+ runners/tsc.ts spawns tsc --pretty false, parses the diagnostic chain
57
+ runners/audit.ts npm/pnpm/yarn audit --json → real CVE advisories
58
+ ai/audit.ts AI SDK security review (code) + dependency prioritization
59
+ report.ts weighted composite health score
60
+ store.ts local run history in .codelens/ (powers trends)
61
+ server.ts local HTTP + WebSocket server that serves the dashboard
62
+ ```
63
+
64
+ The dashboard (the Next.js app one level up) is prebuilt into `cli/public` and
65
+ served statically, so the installed tool has no runtime build step.
66
+
67
+ ## Building
68
+
69
+ ```bash
70
+ # from the cli/ package
71
+ pnpm install
72
+ pnpm build # builds the dashboard into ./public, then bundles the CLI
73
+ ```
74
+
75
+ `pnpm build` runs two steps:
76
+ 1. `build:dashboard` — static-exports the Next.js dashboard (with
77
+ `CODELENS_EXPORT=1`) and copies it into `cli/public`.
78
+ 2. `tsup` — bundles `src/` into `dist/`.
79
+
80
+ ## Installing it into your own projects
81
+
82
+ **Local link (best while iterating on the tool):**
83
+
84
+ ```bash
85
+ cd cli
86
+ pnpm build
87
+ pnpm link --global
88
+
89
+ cd ~/your-project
90
+ codelens
91
+ ```
92
+
93
+ **Run directly by path (no linking):**
94
+
95
+ ```bash
96
+ node ~/path/to/cli/dist/cli.js
97
+ ```
98
+
99
+ **Publish (optional, for `npx codelens`):**
100
+
101
+ ```bash
102
+ cd cli
103
+ npm publish
104
+ ```
105
+
106
+ ## AI security audit
107
+
108
+ The AI pass needs a model key. CodeLens uses the Vercel AI Gateway, so set one of:
109
+
110
+ ```bash
111
+ export AI_GATEWAY_API_KEY=... # recommended
112
+ # or
113
+ export OPENAI_API_KEY=...
114
+ ```
115
+
116
+ By default the audit runs on a **free** OpenRouter text model
117
+ (`meta-llama/llama-3.3-70b-instruct:free`) and automatically **falls back** to
118
+ `google/gemini-2.5-flash` if the primary model errors or is rate-limited, so the
119
+ review keeps working out of the box. Override either via env or `.codelensrc`:
120
+
121
+ ```bash
122
+ export CODELENS_MODEL=openai/gpt-5-mini # primary model
123
+ export CODELENS_FALLBACK_MODEL=anthropic/claude-haiku-4
124
+ ```
125
+
126
+ Without a key, lint + type-check + dependency advisories still run; only the AI
127
+ code review and prioritization are skipped (`--no-ai` silences the warning).
128
+ Only the selected security-relevant source files are sent to the model.
@@ -0,0 +1,48 @@
1
+ var __create = Object.create;
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, {
8
+ get: (a, b) => (typeof require !== "undefined" ? require : a)[b]
9
+ }) : x)(function(x) {
10
+ if (typeof require !== "undefined") return require.apply(this, arguments);
11
+ throw Error('Dynamic require of "' + x + '" is not supported');
12
+ });
13
+ var __esm = (fn, res) => function __init() {
14
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
15
+ };
16
+ var __commonJS = (cb, mod) => function __require2() {
17
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
18
+ };
19
+ var __export = (target, all) => {
20
+ for (var name in all)
21
+ __defProp(target, name, { get: all[name], enumerable: true });
22
+ };
23
+ var __copyProps = (to, from, except, desc) => {
24
+ if (from && typeof from === "object" || typeof from === "function") {
25
+ for (let key of __getOwnPropNames(from))
26
+ if (!__hasOwnProp.call(to, key) && key !== except)
27
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
28
+ }
29
+ return to;
30
+ };
31
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
32
+ // If the importer is in node compatibility mode or this is not an ESM
33
+ // file that has been converted to a CommonJS file using a Babel-
34
+ // compatible transform (i.e. "__esModule" has not been set), then set
35
+ // "default" to the CommonJS "module.exports" for node compatibility.
36
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
37
+ mod
38
+ ));
39
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
40
+
41
+ export {
42
+ __require,
43
+ __esm,
44
+ __commonJS,
45
+ __export,
46
+ __toESM,
47
+ __toCommonJS
48
+ };