codebase-onboarder 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 +275 -0
- package/bin/onboarder.js +14 -0
- package/bin/postinstall.js +6 -0
- package/cli/commands.js +436 -0
- package/cli/main.js +129 -0
- package/cli/prompt.js +101 -0
- package/cli/ui.js +55 -0
- package/cli/wizard.js +325 -0
- package/package.json +48 -0
- package/public/app.js +1339 -0
- package/public/index.html +455 -0
- package/public/js/about.js +284 -0
- package/public/js/aiDraft.js +163 -0
- package/public/js/analysisPanel.js +270 -0
- package/public/js/analysisReport.js +154 -0
- package/public/js/api.js +264 -0
- package/public/js/atlas.js +98 -0
- package/public/js/blameView.js +41 -0
- package/public/js/codeTab.js +256 -0
- package/public/js/codeViewer.js +184 -0
- package/public/js/components/FileChip.js +102 -0
- package/public/js/components/MetricSparkline.js +89 -0
- package/public/js/components/RiskBadge.js +105 -0
- package/public/js/deepAnalysisView.js +496 -0
- package/public/js/diagramPane.js +154 -0
- package/public/js/diffView.js +352 -0
- package/public/js/docsView.js +566 -0
- package/public/js/fileSourceBrowser.js +47 -0
- package/public/js/flameGraph.js +75 -0
- package/public/js/forceGraph.js +592 -0
- package/public/js/heatmap.js +185 -0
- package/public/js/highlight.js +122 -0
- package/public/js/html.js +50 -0
- package/public/js/insightsView.js +236 -0
- package/public/js/inspector.js +535 -0
- package/public/js/llm.js +345 -0
- package/public/js/mapView.js +159 -0
- package/public/js/markdown.js +119 -0
- package/public/js/mindmap.js +289 -0
- package/public/js/repoFiles.js +44 -0
- package/public/js/sbomView.js +142 -0
- package/public/js/scanCache.js +76 -0
- package/public/js/search.js +874 -0
- package/public/js/serverSettings.js +169 -0
- package/public/js/state.js +192 -0
- package/public/js/tour.js +17 -0
- package/public/js/transitions.js +15 -0
- package/public/js/tree.js +200 -0
- package/public/js/workflowsView.js +95 -0
- package/public/styles.css +2767 -0
- package/public/vendor/mermaid.min.js +3587 -0
- package/public/vendor/monaco/vs/base/browser/ui/codicons/codicon/codicon.ttf +0 -0
- package/public/vendor/monaco/vs/base/worker/workerMain.js +31 -0
- package/public/vendor/monaco/vs/basic-languages/abap/abap.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/apex/apex.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/azcli/azcli.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/bat/bat.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/bicep/bicep.js +11 -0
- package/public/vendor/monaco/vs/basic-languages/cameligo/cameligo.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/clojure/clojure.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/coffee/coffee.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/cpp/cpp.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/csharp/csharp.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/csp/csp.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/css/css.js +12 -0
- package/public/vendor/monaco/vs/basic-languages/cypher/cypher.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/dart/dart.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/dockerfile/dockerfile.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/ecl/ecl.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/elixir/elixir.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/flow9/flow9.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/freemarker2/freemarker2.js +12 -0
- package/public/vendor/monaco/vs/basic-languages/fsharp/fsharp.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/go/go.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/graphql/graphql.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/handlebars/handlebars.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/hcl/hcl.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/html/html.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/ini/ini.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/java/java.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/javascript/javascript.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/julia/julia.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/kotlin/kotlin.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/less/less.js +11 -0
- package/public/vendor/monaco/vs/basic-languages/lexon/lexon.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/liquid/liquid.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/lua/lua.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/m3/m3.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/markdown/markdown.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/mdx/mdx.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/mips/mips.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/msdax/msdax.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/mysql/mysql.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/objective-c/objective-c.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/pascal/pascal.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/pascaligo/pascaligo.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/perl/perl.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/pgsql/pgsql.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/php/php.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/pla/pla.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/postiats/postiats.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/powerquery/powerquery.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/powershell/powershell.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/protobuf/protobuf.js +11 -0
- package/public/vendor/monaco/vs/basic-languages/pug/pug.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/python/python.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/qsharp/qsharp.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/r/r.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/razor/razor.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/redis/redis.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/redshift/redshift.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/restructuredtext/restructuredtext.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/ruby/ruby.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/rust/rust.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/sb/sb.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/scala/scala.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/scheme/scheme.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/scss/scss.js +12 -0
- package/public/vendor/monaco/vs/basic-languages/shell/shell.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/solidity/solidity.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/sophia/sophia.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/sparql/sparql.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/sql/sql.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/st/st.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/swift/swift.js +13 -0
- package/public/vendor/monaco/vs/basic-languages/systemverilog/systemverilog.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/tcl/tcl.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/twig/twig.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/typescript/typescript.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/typespec/typespec.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/vb/vb.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/wgsl/wgsl.js +307 -0
- package/public/vendor/monaco/vs/basic-languages/xml/xml.js +10 -0
- package/public/vendor/monaco/vs/basic-languages/yaml/yaml.js +10 -0
- package/public/vendor/monaco/vs/editor/editor.main.css +8 -0
- package/public/vendor/monaco/vs/editor/editor.main.js +798 -0
- package/public/vendor/monaco/vs/language/css/cssMode.js +13 -0
- package/public/vendor/monaco/vs/language/css/cssWorker.js +77 -0
- package/public/vendor/monaco/vs/language/html/htmlMode.js +13 -0
- package/public/vendor/monaco/vs/language/html/htmlWorker.js +454 -0
- package/public/vendor/monaco/vs/language/json/jsonMode.js +19 -0
- package/public/vendor/monaco/vs/language/json/jsonWorker.js +42 -0
- package/public/vendor/monaco/vs/language/typescript/tsMode.js +20 -0
- package/public/vendor/monaco/vs/language/typescript/tsWorker.js +51328 -0
- package/public/vendor/monaco/vs/loader.js +11 -0
- package/public/vendor/monaco/worker-boot.js +9 -0
- package/server/.fuse_hidden0000000800000001 +36 -0
- package/server/apiDiff.js +25 -0
- package/server/apiDocs.js +67 -0
- package/server/apiFile.js +36 -0
- package/server/apiGitBlame.js +63 -0
- package/server/apiMcp.js +110 -0
- package/server/apiScan.js +119 -0
- package/server/apiSearch.js +253 -0
- package/server/apiSettings.js +118 -0
- package/server/apiTools.js +90 -0
- package/server/config.js +227 -0
- package/server/fileSourceNode.js +44 -0
- package/server/gitClone.js +95 -0
- package/server/gitDiff.js +184 -0
- package/server/gitHistory.js +110 -0
- package/server/htmlText.js +44 -0
- package/server/http.js +55 -0
- package/server/httpGuards.js +87 -0
- package/server/index.js +156 -0
- package/server/llmProxy.js +162 -0
- package/server/logger.js +29 -0
- package/server/mcp/analysis.js +209 -0
- package/server/mcp/http.js +213 -0
- package/server/mcp/runner.js +278 -0
- package/server/mcp/server.js +241 -0
- package/server/mcp/standalone.js +42 -0
- package/server/mcp/tools.js +683 -0
- package/server/paths.js +39 -0
- package/server/router.js +218 -0
- package/server/searchIndex.js +118 -0
- package/server/sessions.js +163 -0
- package/server/static.js +59 -0
- package/server/tools/install.js +246 -0
- package/server/tools/parse.js +170 -0
- package/server/tools/platform.js +91 -0
- package/server/tools/registry.js +212 -0
- package/server/tools/scan.js +136 -0
- package/server/tools.js +212 -0
- package/server/tunnel.js +92 -0
- package/shared/analyzer/docs.js +135 -0
- package/shared/analyzer/explainLocal.js +163 -0
- package/shared/analyzer/graph.js +461 -0
- package/shared/analyzer/health.js +215 -0
- package/shared/analyzer/history.js +146 -0
- package/shared/analyzer/languages/csharp.js +39 -0
- package/shared/analyzer/languages/generic.js +131 -0
- package/shared/analyzer/languages/go.js +70 -0
- package/shared/analyzer/languages/index.js +43 -0
- package/shared/analyzer/languages/java.js +39 -0
- package/shared/analyzer/languages/javascript.js +240 -0
- package/shared/analyzer/languages/python.js +120 -0
- package/shared/analyzer/languages/rust.js +42 -0
- package/shared/analyzer/languages/typescript.js +138 -0
- package/shared/analyzer/licenses.js +151 -0
- package/shared/analyzer/metrics.js +120 -0
- package/shared/analyzer/pathUtil.js +69 -0
- package/shared/analyzer/patterns.js +272 -0
- package/shared/analyzer/scan.js +473 -0
- package/shared/analyzer/security.js +187 -0
- package/shared/analyzer/services.js +157 -0
- package/shared/analyzer/stack.js +173 -0
- package/shared/analyzer/tour.js +69 -0
- package/shared/analyzer/util.js +123 -0
- package/shared/analyzer/workflows.js +143 -0
- package/shared/diagram/aiFacts.js +145 -0
- package/shared/diagram/aiMermaid.js +59 -0
- package/shared/diagram/atlas.js +93 -0
- package/shared/diagram/mermaid.js +459 -0
- package/shared/search/query.js +518 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Amit K. Pandey
|
|
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,275 @@
|
|
|
1
|
+
# Onboarder 🧭
|
|
2
|
+
|
|
3
|
+
[](LICENSE)
|
|
4
|
+
[](https://nodejs.org/)
|
|
5
|
+
[](package.json)
|
|
6
|
+
[](tests/)
|
|
7
|
+
|
|
8
|
+
> **Drop a path. Get a map.**
|
|
9
|
+
> A lightweight, zero-dependency codebase visualizer and architectural map generator that runs entirely on your local machine.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
Onboarder reads a software repository the way a senior engineer would: starting at the front door, tracing import graphs, mapping architectural layers, computing risk/health metrics, discovering dead exports and dependency drift, and charting Git hotspots — rendering everything as interactive, zoomable diagrams.
|
|
14
|
+
|
|
15
|
+
**100% Local & Private**: Your code never leaves your computer. No external services or accounts are required.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
## ⚡ Quickstart
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
# Install from npm (Node 20+, zero runtime dependencies)
|
|
23
|
+
npm install -g codebase-onboarder
|
|
24
|
+
|
|
25
|
+
# First run: a short setup wizard, then the server
|
|
26
|
+
onboarder
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
Or from source:
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
git clone https://github.com/Amitpandey88/onboarder.git
|
|
33
|
+
cd onboarder
|
|
34
|
+
npm start
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Open **http://localhost:4310** in your browser (the CLI opens it for you).
|
|
38
|
+
|
|
39
|
+
- **Zero build steps**: Native ES modules.
|
|
40
|
+
- **Zero runtime dependencies**: Powered by Node.js built-ins (`node:http`, `node:fs`, `node:crypto`).
|
|
41
|
+
- **Offline ready**: Vendored Mermaid.js and Monaco Editor builds are included in `public/vendor/`.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 🚀 Ways to Load a Repository
|
|
46
|
+
|
|
47
|
+
1. **Local Directory** — Enter any absolute path (`/Users/you/projects/repo` or `~/work/repo`). Analyzed in-place without copying files.
|
|
48
|
+
2. **Git URL** — Paste any public Git URL (`https://github.com/org/repo`). Cloned shallowly (`--depth 1`) into temp storage and automatically deleted on session close.
|
|
49
|
+
3. **In-Browser Folder Picker** — Open any local folder using the File System Access API (Chrome/Edge). The entire analyzer runs directly inside the browser tab.
|
|
50
|
+
4. **Self-Scan** — Click *"Scan this app's own source"* on the landing page for an instant interactive demo.
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## 🔍 Features & Views
|
|
55
|
+
|
|
56
|
+
### 1. Explorer (One Canvas, 6 Modes)
|
|
57
|
+
- **Tree**: Hierarchical expandable cell map of directories, files, hubs, and entry points with ghost connection cells.
|
|
58
|
+
- **Files**: Intra-folder dependency graphs with deep-dive call inspections.
|
|
59
|
+
- **Layers**: Stratified architecture layout from entry points down to foundation leaf files, highlighting circular dependency loops and unreachable code.
|
|
60
|
+
- **Health**: Risk heat-map scoring every file (0–100) using PageRank centrality, blast radius (SCC condensation), cyclomatic complexity, and cycle participation.
|
|
61
|
+
- **Security**: Built-in vulnerability scanner detecting hardcoded secrets, injection sinks (SQL, command, eval), XSS, insecure crypto, and quality smells across JS/TS, Python, Go, Java, and C/C++.
|
|
62
|
+
- **Services**: Automatic detection for `docker-compose.yml`, `Procfile`, and monorepo workspaces.
|
|
63
|
+
- **Tour**: Curated step-by-step walkthrough of key architectural waypoints.
|
|
64
|
+
- **Atlas**: Grid gallery of every pre-generated diagram across folders and components.
|
|
65
|
+
|
|
66
|
+
### 1b. Deep Analysis — plug in the best engines (Optional, self-hosted)
|
|
67
|
+
|
|
68
|
+
Onboarder is the **frontend**; the sharpest open-source analyzers are the
|
|
69
|
+
**backend**. The built-in scanner above is a fast, zero-dependency first pass —
|
|
70
|
+
extend it with real engines, and their findings merge straight into the security
|
|
71
|
+
grade and finding list.
|
|
72
|
+
|
|
73
|
+
| Engine | Finds | Install |
|
|
74
|
+
|---|---|---|
|
|
75
|
+
| [**Semgrep**](https://github.com/semgrep/semgrep) (or [Opengrep](https://github.com/opengrep/opengrep)) | SAST: injection, auth, crypto across 30+ languages | `pip install semgrep` |
|
|
76
|
+
| [**Gitleaks**](https://github.com/gitleaks/gitleaks) | Committed secrets, keys, tokens | `brew install gitleaks` |
|
|
77
|
+
| [**Knip**](https://github.com/webpro-nl/knip) | Dead JS/TS files, exports, dependencies | `npm i -g knip` |
|
|
78
|
+
| [**Vulture**](https://github.com/jendrikseipp/vulture) | Dead Python code | `pip install vulture` |
|
|
79
|
+
| [**Depcheck**](https://github.com/depcheck/depcheck) | Unused npm dependencies | `npm i -g depcheck` |
|
|
80
|
+
|
|
81
|
+
**Nothing is required.** With no engines installed, the panel lists each one,
|
|
82
|
+
says it is missing, and offers an **Install** button — the built-in scanner is
|
|
83
|
+
the floor that never goes away. If you have `uvx` (from [uv](https://docs.astral.sh/uv/))
|
|
84
|
+
or `npx`, Semgrep, Vulture, Knip and Depcheck run without a separate install.
|
|
85
|
+
In the Security view, click **Run deep analysis**.
|
|
86
|
+
|
|
87
|
+
### 1c. The Deep Analysis tab — the full report, with AI
|
|
88
|
+
|
|
89
|
+
Next to **Explorer** in the top nav. One page with everything:
|
|
90
|
+
|
|
91
|
+
- **Engines** — what is installed, how it was found, what each one cost, and a
|
|
92
|
+
**Run** button per engine (plus *Run all* / *Security only* / *Dead code only*).
|
|
93
|
+
Missing engines get a one-click **Install**: a console streams the package
|
|
94
|
+
manager's output live and ends in a plain verdict. Each engine also has a
|
|
95
|
+
**Configure** disclosure — per-engine options (Semgrep config, Gitleaks
|
|
96
|
+
redaction, Knip production mode, Vulture confidence, Depcheck skips) edited
|
|
97
|
+
in a form and sent with the next run. Install plans are per-platform, so the
|
|
98
|
+
same flow works on **Windows, macOS and Linux**.
|
|
99
|
+
- **Findings** — every finding from every engine, merged and worst-first, with
|
|
100
|
+
**severity, engine and text filters**. Each row's file is a link: clicking it
|
|
101
|
+
opens the **Code** tab at that exact line.
|
|
102
|
+
- **What this means** — the AI reads the report: *"Explain this analysis"* for a
|
|
103
|
+
prioritised read, or ask about a specific finding (*"is the eval finding
|
|
104
|
+
reachable?"*). It is told which engines did **not** run, so it will not claim
|
|
105
|
+
coverage it does not have. Needs an OpenAI-compatible endpoint; without one the
|
|
106
|
+
report is still fully readable and the button offers the API key drawer.
|
|
107
|
+
|
|
108
|
+
Rules that keep this safe to self-host:
|
|
109
|
+
|
|
110
|
+
- **Detect by default, install only on click.** Onboarder probes `PATH` and
|
|
111
|
+
never installs anything behind a scan. When you do click **Install**, the
|
|
112
|
+
server runs a validated, per-platform plan from the tool registry — the
|
|
113
|
+
request body picks a plan, it never reaches a command line — and streams the
|
|
114
|
+
output back over SSE. You decide what is on the box, and you watch it happen.
|
|
115
|
+
- **Run, never eval.** Every engine is spawned with an argument array, never a
|
|
116
|
+
shell, with a hard timeout and a capped buffer. A crafted filename is an
|
|
117
|
+
argument; a hung analyzer is one failed pass.
|
|
118
|
+
- **Nothing leaves the machine.** Engines run locally against the scanned root.
|
|
119
|
+
Gitleaks' report is read for existence only — the credential is never relayed
|
|
120
|
+
to the UI.
|
|
121
|
+
|
|
122
|
+
### 2. Code Preview with Monaco Editor
|
|
123
|
+
- Full read-only VS Code editor experience with native syntax highlighting for 70+ languages.
|
|
124
|
+
- Breadcrumbs, line counts, byte sizes, and bidirectional dependency navigation chips ("Pulls in" & "Leaning on").
|
|
125
|
+
- Instant jump from code view to graph deep-dives.
|
|
126
|
+
|
|
127
|
+
### 3. Git History & Hotspots
|
|
128
|
+
- Git log analysis cross-referencing commit churn with file complexity ($churn \times complexity$).
|
|
129
|
+
- Identifies sole-author bottlenecks, top co-change file pairs, and recent repository activity without external tools.
|
|
130
|
+
|
|
131
|
+
### 4. Advanced Graph Analysis
|
|
132
|
+
- **TypeScript Path Aliases**: Automatically resolves `tsconfig.json` / `jsconfig.json` paths (`@/*` $\rightarrow$ `src/*`).
|
|
133
|
+
- **Symbol-Level Dead Exports**: Identifies functions, classes, and variables exported by modules that are never imported anywhere in the codebase.
|
|
134
|
+
- **Dependency Drift**: Compares `package.json`, `requirements.txt`, `go.mod`, and `Cargo.toml` against source imports to uncover unused dependencies and undeclared imports.
|
|
135
|
+
- **Test-to-Source Mapping**: Traces test reachability and highlights untested load-bearing hubs (`fanIn >= 3`).
|
|
136
|
+
- **Weight & Documentation Ratios**: LOC, comment-to-code ratios, blank lines, and folder-level README coverage.
|
|
137
|
+
|
|
138
|
+
### 5. AI Notes & Explainers (Optional)
|
|
139
|
+
- Works 100% offline out-of-the-box.
|
|
140
|
+
- Connect any OpenAI-compatible LLM endpoint (OpenAI, Azure OpenAI, Groq, OpenRouter, Ollama, LM Studio) to generate streaming explanations and repository documentation.
|
|
141
|
+
- API keys are stored solely in your browser's `localStorage` and never logged or written to disk.
|
|
142
|
+
|
|
143
|
+
### 6. MCP Server — let any AI agent onboard itself
|
|
144
|
+
|
|
145
|
+
Press **MCP** in the top bar and the whole analysis becomes callable by any agent
|
|
146
|
+
or harness that speaks the [Model Context Protocol](https://modelcontextprotocol.io)
|
|
147
|
+
— Claude Code, Cursor, Cline, Windsurf, or your own.
|
|
148
|
+
|
|
149
|
+
The server speaks **stdio** (the transport every major harness supports) and
|
|
150
|
+
exposes **16 tools** over the same analyzers the UI uses, so a number an agent
|
|
151
|
+
reports is the same number you see on screen.
|
|
152
|
+
|
|
153
|
+
| | |
|
|
154
|
+
|---|---|
|
|
155
|
+
| **Find your way in** | `onboarder_scan` · `onboarder_overview` · `onboarder_tour` |
|
|
156
|
+
| **Understand the shape** | `onboarder_architecture` · `onboarder_explain_file` · `onboarder_explain_folder` |
|
|
157
|
+
| **Get the source** | `onboarder_read_file` · `onboarder_search` · `onboarder_list_files` |
|
|
158
|
+
| **Judge the code** | `onboarder_health` · `onboarder_security` · `onboarder_history` · `onboarder_dependencies` |
|
|
159
|
+
| **Go deeper** | `onboarder_deep_analysis` · `onboarder_analyzer_status` |
|
|
160
|
+
|
|
161
|
+
Start it from the panel, then paste the JSON or TOML config it shows into your
|
|
162
|
+
harness. Or run it directly — it works without the web UI:
|
|
163
|
+
|
|
164
|
+
```bash
|
|
165
|
+
npm run mcp
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
<details>
|
|
169
|
+
<summary>Configuration for the common harnesses</summary>
|
|
170
|
+
|
|
171
|
+
**Claude Code** / **Cursor** / most MCP clients:
|
|
172
|
+
|
|
173
|
+
```json
|
|
174
|
+
{
|
|
175
|
+
"mcpServers": {
|
|
176
|
+
"onboarder": {
|
|
177
|
+
"command": "node",
|
|
178
|
+
"args": ["/absolute/path/to/onboarder/server/mcp/standalone.js"]
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
**Claude Desktop** (`claude_desktop_config.json`) uses the same shape under
|
|
185
|
+
`mcpServers`. **Cline** uses `"mcpServers"` in its settings file. **Windsurf**
|
|
186
|
+
uses `"mcpServers"` in `~/.codeium/windsurf/mcp_config.json`.
|
|
187
|
+
|
|
188
|
+
</details>
|
|
189
|
+
|
|
190
|
+
**The repository is read-only.** No tool writes, moves, or deletes anything, and
|
|
191
|
+
file paths are resolved against the repository root — `../` and absolute paths
|
|
192
|
+
outside it are refused.
|
|
193
|
+
|
|
194
|
+
**Start and stop are real.** Stopping closes the child's stdin and lets it drain
|
|
195
|
+
rather than killing it mid-answer, and a Ctrl-C in the terminal takes the child
|
|
196
|
+
with it instead of orphaning a process holding the scan cache.
|
|
197
|
+
|
|
198
|
+
---
|
|
199
|
+
|
|
200
|
+
## ⚙️ Setup, Modes & Self-Hosting
|
|
201
|
+
|
|
202
|
+
Onboarder has two modes, one config file, and three ways to edit it — the CLI wizard, CLI flags, and the web UI's Server drawer all write the same validated `config.json` (`~/.config/onboarder/config.json`, mode `0600`).
|
|
203
|
+
|
|
204
|
+
- **Local (default)** — binds to loopback only, asks for no credentials. The safe default.
|
|
205
|
+
- **Self-hosted** — reachable on your network or domain; every API call requires a Bearer access key. Rotate it from the drawer or with `onboarder config key rotate`; the old key dies on the next request, no restart needed.
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
onboarder setup # interactive wizard (OpenClaw-style)
|
|
209
|
+
onboarder setup --mode self-hosted \
|
|
210
|
+
--domain map.example.com --non-interactive
|
|
211
|
+
onboarder config show # current settings (key masked)
|
|
212
|
+
onboarder config set domain map.example.com
|
|
213
|
+
onboarder config key rotate # mint a new access key
|
|
214
|
+
onboarder tunnel cloudflare # expose via a Cloudflare quick tunnel
|
|
215
|
+
onboarder doctor # config, port, and tunnel checks
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
Cloudflare quick tunnels and Tailscale are supported as reachability layers — the server keeps its loopback bind and the tunnel dials `127.0.0.1`. `ONBOARDER_CONFIG=/path/config.json` overrides the config location (handy for tests and containers).
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## 🛠️ Architecture
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
codebase-onboarder/
|
|
226
|
+
├── bin/ # npm entry point (shebang trampoline) & postinstall note
|
|
227
|
+
├── cli/ # Onboarding wizard, config commands, doctor, tunnels
|
|
228
|
+
├── server/ # Zero-dependency Node.js HTTP server
|
|
229
|
+
│ ├── index.js # createServer / startServer / startup banner
|
|
230
|
+
│ ├── config.js # Settings schema, normalization, atomic 0600 writes
|
|
231
|
+
│ ├── router.js # Route table, live per-request settings, Bearer gate
|
|
232
|
+
│ ├── apiSettings.js# GET/PUT /api/settings, key rotation
|
|
233
|
+
│ ├── tunnel.js # Cloudflare & Tailscale status/commands
|
|
234
|
+
│ ├── httpGuards.js# Host verification & CSRF/rebinding guards
|
|
235
|
+
│ ├── apiScan.js # Local & remote scan coordination
|
|
236
|
+
│ ├── apiFile.js # Path-traversal safe file serving
|
|
237
|
+
│ ├── gitHistory.js# Local Git log parser & hotspot metrics
|
|
238
|
+
│ └── sessions.js # Temporary clone lifecycle manager
|
|
239
|
+
├── shared/ # Isomorphic analyzer engine (Runs in Node & Browser)
|
|
240
|
+
│ ├── analyzer/ # Language parsers, graph analytics, metrics, security
|
|
241
|
+
│ └── diagram/ # Mermaid diagram generation
|
|
242
|
+
├── public/ # Frontend client application
|
|
243
|
+
│ ├── js/ # Vanilla ES modules (State, Inspector, Views, Settings)
|
|
244
|
+
│ ├── vendor/ # Vendored Mermaid & Monaco Editor (Offline)
|
|
245
|
+
│ └── index.html # Main application interface
|
|
246
|
+
└── tests/ # Comprehensive node:test suite (546 unit tests)
|
|
247
|
+
```
|
|
248
|
+
|
|
249
|
+
---
|
|
250
|
+
|
|
251
|
+
## 🧪 Testing
|
|
252
|
+
|
|
253
|
+
Onboarder includes a comprehensive automated test suite built with Node's native test runner:
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
# Run all 546 tests
|
|
257
|
+
npm test
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
Test suites cover:
|
|
261
|
+
- Parser edge cases across all supported languages (JavaScript, TypeScript, Python, Go, C/C++, Java, Rust, Ruby, PHP).
|
|
262
|
+
- Graph algorithms (Tarjan SCC, PageRank, topological layering, transitive test reach).
|
|
263
|
+
- Security rules, health scoring, and sanitization boundaries.
|
|
264
|
+
- HTTP security guards, path-traversal prevention, and session lifecycle.
|
|
265
|
+
- The settings layer end to end: schema validation, atomic config writes, the
|
|
266
|
+
Bearer auth gate, key rotation, DNS-rebinding protection, and the wizard's
|
|
267
|
+
branching/flag logic.
|
|
268
|
+
- Deep Analysis tooling: engine detection across Windows/macOS/Linux, install-plan
|
|
269
|
+
validation, output parsing, and report shaping.
|
|
270
|
+
|
|
271
|
+
---
|
|
272
|
+
|
|
273
|
+
## 📄 License
|
|
274
|
+
|
|
275
|
+
This project is licensed under the [MIT License](LICENSE) — see the [LICENSE](LICENSE) file for details.
|
package/bin/onboarder.js
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// The installed entry point: a trampoline into cli/main.js. Keeping this file
|
|
3
|
+
// tiny matters — it is the only file with a shebang, and the only one npm
|
|
4
|
+
// links onto PATH.
|
|
5
|
+
|
|
6
|
+
import { main } from '../cli/main.js';
|
|
7
|
+
|
|
8
|
+
main().then(
|
|
9
|
+
(code) => { if (code) process.exitCode = code; },
|
|
10
|
+
(err) => {
|
|
11
|
+
console.error(' ' + (err?.message || err));
|
|
12
|
+
process.exitCode = 1;
|
|
13
|
+
},
|
|
14
|
+
);
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// One quiet line after install: what to run first. No telemetry, no funding
|
|
2
|
+
// banner, no network — just the next command. Skipped in CI where nobody reads.
|
|
3
|
+
|
|
4
|
+
if (!process.env.CI) {
|
|
5
|
+
console.log(' 🧭 codebase-onboarder installed. Run `onboarder setup` (or just `onboarder`) to begin.');
|
|
6
|
+
}
|