Skip to content

Commit e359d93

Browse files
committed
docs: update README, changelog, and architecture for v7 deploy polish
1 parent 6de5ae8 commit e359d93

5 files changed

Lines changed: 62 additions & 2 deletions

File tree

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## v7 — Deploy Polish and Browser Separation
4+
5+
- Improved browser bundle architecture with a separate browser-safe entry point and lazy-loaded analysis engine
6+
- Pinned Node engine to 20.x for stable Vercel deployments
7+
- Strengthened rule-system alignment tests to prevent drift between rule registry, config defaults, and presets
8+
- Polished web app onboarding with clearer browser capability fallback and step-by-step instructions
9+
- Removed vague phrasing from export summary templates and added stricter bullet validation
10+
311
## v6 — Conservative Rule Expansion
412

513
- Added 5 new conservative analysis rules: `no-console`, `no-empty-function`, `duplicate-imports`, `no-unreachable-after-return`, `no-throw-literal`

README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ Manual code review is time-consuming and inconsistent. InspectoRepo provides det
4747
| Analysis | ts-morph (TypeScript AST) |
4848
| Testing | Vitest |
4949
| Monorepo | npm workspaces |
50+
| Node | 20.x |
51+
| Deploy | Vercel (Preview) |
5052

5153
## Project Structure
5254

@@ -99,6 +101,12 @@ npm test
99101

100102
> **Export packs:** `npm run repopack` generates four versioned files under `ai/exports/`. Use `repo-pack-latest-vN.md` for a quick lightweight review — it includes project structure and core source without docs, screenshots, or scripts.
101103
104+
## Deployment
105+
106+
The web UI is deployed on Vercel as a **Preview** build. It runs the same analysis engine as the CLI — ts-morph executes entirely in the browser via an in-memory file system.
107+
108+
> **Browser note:** Folder selection requires the File System Access API (Chrome/Edge). Other browsers can use the Upload Folder fallback. The analysis engine (ts-morph) is lazy-loaded to keep the initial page load fast.
109+
102110
## Demo
103111

104112
Try InspectoRepo locally in three steps:

docs/agent-worklog.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,41 @@ Development log for InspectoRepo. Each entry describes what was implemented, why
44

55
---
66

7+
## 2026-03-11 — V7: Deploy Polish and Browser Separation
8+
9+
### What was implemented
10+
11+
- **Browser-safe entry point** — new `packages/core/src/browser.ts` re-exports only lightweight utilities (file-filter, scanner, scoring, report, config, presets) with zero ts-morph dependency. Web app imports from `@inspectorepo/core/browser` for initial load; heavy analysis is lazy-loaded via dynamic `import('@inspectorepo/core')` only when the user clicks Analyze.
12+
- **Package exports field**`packages/core/package.json` now declares `"exports": { ".": "./dist/index.js", "./browser": "./dist/browser.js" }` so bundlers can tree-shake correctly.
13+
- **Vite build target**`apps/web/vite.config.ts` sets `build.target: 'es2022'` and uses `manualChunks` to isolate ts-morph into a separate `analysis-engine` chunk.
14+
- **Node engine pin** — root `package.json` changed `engines.node` from `>=20.0.0` to `20.x` to match CI and Vercel runtime.
15+
- **Rule-system alignment tests**`config.test.ts` now derives `ALL_RULE_IDS` dynamically from `allRules` instead of a hardcoded list. Added 7 new tests: every rule in DEFAULT_CONFIG, no unknown rules in config, presets reference only known IDs, presets cover every rule, filterRulesByConfig consistency, no duplicate IDs, count match.
16+
- **Web app onboarding polish**`MainPanel.tsx` improved with ordered step list, browser compatibility warning, sample project hint, and checkmark icon in empty state.
17+
- **Export summary hardening**`generate-repomix-exports.ts` replaces vague area bullet templates and adds `VAGUE_BANNED_PHRASES` regex array to `isQualityBullet()`.
18+
- **README and CHANGELOG** — added Node 20.x / Vercel rows to tech stack, new Deployment section, and v7 changelog entry.
19+
20+
### Why
21+
22+
After the first successful Vercel deploy, the web app pulled the entire ts-morph library (~2 MB) into the initial bundle via barrel imports. Separating browser-safe utilities from the heavy analysis engine reduces initial load time significantly. The Node engine pin and rule alignment tests harden the project for CI and prevent future drift.
23+
24+
### How to verify
25+
26+
```bash
27+
npm run lint
28+
npm run typecheck
29+
npm run build
30+
npm test
31+
```
32+
33+
### Design decisions
34+
35+
- **Separate entry point over conditional exports** — a dedicated `browser.ts` file is clearer than `"browser"` condition maps and works with all bundlers.
36+
- **Lazy `import()` over eager import** — the analysis engine (ts-morph) is only needed when the user clicks Analyze. Dynamic import keeps initial page load fast.
37+
- **`20.x` over `>=20`** — pins to Node 20 LTS to match Vercel default and CI matrix, avoiding surprises from Node 22+ changes.
38+
- **Derived rule IDs**`allRules.map(r => r.id)` eliminates the need to update a hardcoded list when adding new rules.
39+
40+
---
41+
742
## 2026-03-11 — Richer Analysis Rules and Export Polish
843

944
### What was implemented

docs/architecture-and-rules.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
```
88
packages/core/src/
99
├── index.ts # Public API: analyzeCodebase, buildMarkdownReport, re-exports
10+
├── browser.ts # Browser-safe API: lightweight re-exports without ts-morph
1011
├── config.ts # Rule configuration loader (.inspectorepo.json)
1112
├── ignore.ts # Ignore file loader (.inspectorepoignore)
1213
├── scanner.ts # isAnalyzableFile, filterAnalyzableFiles
@@ -30,6 +31,10 @@ packages/core/src/
3031

3132
The core analysis engine never touches the filesystem. The public API accepts `VirtualFile[]` (`{ path: string; content: string }`). This keeps core importable from a browser bundle (the web app) without polyfilling Node's `fs`. Any filesystem access (directory picker, file reading) lives in `apps/web` or a future CLI adapter.
3233

34+
**1b. Browser entry point separates heavy dependencies**
35+
36+
`browser.ts` re-exports only lightweight utilities (file-filter, scanner, scoring, report, config, presets) with zero ts-morph dependency. The web app imports from `@inspectorepo/core/browser` for initial load. The heavy analysis engine (ts-morph) is lazy-loaded via `import('@inspectorepo/core')` only when the user triggers analysis. The `package.json` exports field maps `"./browser"` to `dist/browser.js`.
37+
3338
**2. Filesystem adapters live outside core**
3439

3540
`apps/web/src/folder-reader.ts` already handles File System Access API and `<input webkitdirectory>`. A future CLI package would use Node `fs` to produce the same `VirtualFile[]` shape. Core doesn't care where the bytes come from.

docs/code-walkthrough.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,10 @@ The analysis engine. Parses files, runs rules, computes scores, generates report
189189

190190
Public API surface: `analyzeCodebase`, `buildMarkdownReport`, `computeScore`, all rules, file-filter utilities, scanner.
191191

192+
### `src/browser.ts`
193+
194+
Browser-safe entry point with zero ts-morph dependency. Re-exports only lightweight utilities: file-filter (`isExcludedDir`, `buildDirectoryTree`, `filterExcludedPaths`, `pickDefaultDirs`, `filterBySelectedDirs`, `normalizeRelativePath`), types (`DirEntry`, `FileEntry`), scanner (`filterAnalyzableFiles`, `isAnalyzableFile`), scoring (`computeScore`), report (`buildMarkdownReport`, `buildHtmlReport`), report-parser (`parseReportSummary`), presets, and config types. The web app imports from `@inspectorepo/core/browser` for initial load to keep the bundle small. The heavy `analyzeCodebase` function (which depends on ts-morph) is lazy-loaded via `import('@inspectorepo/core')` only when the user clicks Analyze.
195+
192196
### `src/analyzer.ts`
193197

194198
Main analysis pipeline entry point:
@@ -395,9 +399,9 @@ Both methods return `{ name, files: VirtualFile[] }` with actual file content po
395399
### `src/useAppState.ts`
396400

397401
Central state hook managing folder, files, dirs, report, and selected issue. Key functions:
398-
- `handleAnalyze`calls `analyzeCodebase()` from core
402+
- `handleAnalyze`lazy-loads `analyzeCodebase` from `@inspectorepo/core` via dynamic `import()` (keeping ts-morph out of the initial bundle), then runs analysis
399403
- `selectIssue` — sets the currently selected issue for the detail panel
400-
- `exportMarkdown` — calls `buildMarkdownReport()` and triggers browser download
404+
- `exportMarkdown` — calls `buildMarkdownReport()` (from the lightweight `@inspectorepo/core/browser` import) and triggers browser download
401405

402406
### `src/components/TopBar.tsx`
403407

0 commit comments

Comments
 (0)