codesynapt 0.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.
Files changed (61) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/LICENSE +686 -0
  3. package/LICENSES.md +141 -0
  4. package/README.md +331 -0
  5. package/electron/main.cjs +2849 -0
  6. package/electron/plugin-loader.cjs +184 -0
  7. package/electron/preload.cjs +108 -0
  8. package/package.json +216 -0
  9. package/packages/core/bin/codesynapt-mcp.cjs +611 -0
  10. package/packages/core/bin/codesynapt.cjs +1933 -0
  11. package/packages/core/legacy.js +300 -0
  12. package/packages/core/lib/control-server.cjs +1539 -0
  13. package/packages/core/lib/embedding.cjs +89 -0
  14. package/packages/core/lib/logger.cjs +63 -0
  15. package/packages/core/lib/search-cache.cjs +140 -0
  16. package/packages/core/lib/search-worker.cjs +255 -0
  17. package/packages/core/lib/search.cjs +211 -0
  18. package/packages/core/lib/symbol-graph.cjs +402 -0
  19. package/packages/core/lib/symbol-parser-js.cjs +542 -0
  20. package/packages/core/lib/symbol-parser-misc.cjs +394 -0
  21. package/packages/core/lib/symbol-parser-py.cjs +215 -0
  22. package/packages/core/lib/symbol-parser-treesitter.cjs +658 -0
  23. package/packages/core/lib/symbol-parser-tsc.cjs +332 -0
  24. package/packages/core/monorepo.js +310 -0
  25. package/packages/core/parser.js +2234 -0
  26. package/packages/core/scanner.js +623 -0
  27. package/plugin-api/LICENSE +21 -0
  28. package/plugin-api/README.md +114 -0
  29. package/plugin-api/docs/01-getting-started.md +197 -0
  30. package/plugin-api/docs/02-concepts.md +269 -0
  31. package/plugin-api/docs/api-reference.md +463 -0
  32. package/plugin-api/docs/troubleshooting.md +332 -0
  33. package/plugin-api/docs/types/exporter.md +377 -0
  34. package/plugin-api/docs/types/theme.md +312 -0
  35. package/plugin-api/examples/hello-world-plugin/README.md +70 -0
  36. package/plugin-api/examples/hello-world-plugin/main.js +36 -0
  37. package/plugin-api/examples/hello-world-plugin/manifest.json +12 -0
  38. package/plugin-api/examples/mermaid-exporter/README.md +125 -0
  39. package/plugin-api/examples/mermaid-exporter/main.js +58 -0
  40. package/plugin-api/examples/mermaid-exporter/manifest.json +12 -0
  41. package/plugin-api/examples/rust-parser/README.md +71 -0
  42. package/plugin-api/examples/rust-parser/main.js +123 -0
  43. package/plugin-api/examples/rust-parser/manifest.json +12 -0
  44. package/plugin-api/examples/sunset-theme/README.md +95 -0
  45. package/plugin-api/examples/sunset-theme/manifest.json +12 -0
  46. package/plugin-api/examples/sunset-theme/theme.css +31 -0
  47. package/plugin-api/package.json +20 -0
  48. package/plugin-api/types.d.ts +395 -0
  49. package/public/app.js +6837 -0
  50. package/public/backend.js +285 -0
  51. package/public/index.html +647 -0
  52. package/public/plugin-host.js +321 -0
  53. package/public/style.css +4359 -0
  54. package/public/vendor/three.module.js +53044 -0
  55. package/scripts/competitor-watch.mjs +144 -0
  56. package/scripts/copy-vendor.js +21 -0
  57. package/scripts/download-bundled-node.cjs +53 -0
  58. package/scripts/fuses-after-pack.cjs +34 -0
  59. package/scripts/license-check.js +119 -0
  60. package/scripts/perf-test.js +200 -0
  61. package/server.js +132 -0
package/LICENSES.md ADDED
@@ -0,0 +1,141 @@
1
+ # Licensing overview
2
+
3
+ CodeSynapt uses **dual licensing**. This document explains what that
4
+ means in plain language. For the actual legal text, see:
5
+
6
+ - **[LICENSE](./LICENSE)** — GNU Affero General Public License v3.0 (main app)
7
+ - **[plugin-api/LICENSE](./plugin-api/LICENSE)** — MIT (plugin API)
8
+
9
+ ## The short version
10
+
11
+ | Part of the project | License | What you can do |
12
+ |---|---|---|
13
+ | **Main app** — everything outside `plugin-api/` | **AGPL-3.0** | Free for any use; if you modify it and offer it as a network service, you must share your source under AGPL too |
14
+ | **Plugin API** — everything inside `plugin-api/` | **MIT** | Use, modify, distribute, sell — under any license you choose |
15
+
16
+ ## What you can do without asking (AGPL-3.0)
17
+
18
+ - **Personal use** — run it on your own computer for any reason
19
+ - **Internal use within a business or organization** — use CodeSynapt
20
+ to analyze your own or your employer's codebases. Running it internally
21
+ for your team does NOT trigger AGPL's network-share clause.
22
+ - **Academic, educational, research use**
23
+ - **Inspection and learning** — read the code, copy snippets
24
+ - **Forks for personal modification** — make your own private variant
25
+ - **Build plugins under any license** — including proprietary, including selling them (plugin API is MIT)
26
+
27
+ ## When does AGPL apply?
28
+
29
+ AGPL-3.0's copyleft kicks in when **you offer a modified version to others
30
+ over a network**:
31
+
32
+ - Modified CodeSynapt running as a **hosted SaaS** that other people sign up for? → You must publish your modified source under AGPL.
33
+ - Modified CodeSynapt **bundled into a closed-source product** you distribute? → Same — derived work must be AGPL.
34
+ - Modified CodeSynapt running **only inside your company**, used by your own employees? → AGPL does NOT require disclosure. Internal use is free.
35
+ - **Unmodified** CodeSynapt as part of your workflow? → No obligations beyond keeping the LICENSE file with it.
36
+
37
+ This is the same model used by Plausible Analytics, Cal.com, MongoDB
38
+ Compass, and many other modern OSS projects.
39
+
40
+ ## What a commercial license unlocks
41
+
42
+ If AGPL's copyleft is incompatible with your use case (e.g. you want
43
+ to ship a modified version in a closed-source SaaS, or embed CodeSynapt
44
+ inside a proprietary product), a **commercial license** lifts those
45
+ obligations.
46
+
47
+ Pricing scales with deployment size and revenue:
48
+
49
+ | Tier | Who | Typical pricing |
50
+ |---|---|---|
51
+ | **Open Source** | Anyone OK with AGPL | Free |
52
+ | **Starter** | Individuals / sub-$100k annual revenue | Contact for quote |
53
+ | **Growth** | $100k–$1M annual revenue | Per-developer or revenue-based |
54
+ | **Enterprise** | $1M+ annual revenue | Negotiated (revenue %, support SLA, etc.) |
55
+
56
+ For commercial licensing inquiries, open a GitHub Discussion or contact:
57
+ **wing1008** on GitHub (DM via issues or use the contact form linked
58
+ from the project README).
59
+
60
+ ## What is NOT commercial use
61
+
62
+ These are commonly mistaken but are actually fine under AGPL-3.0
63
+ without a commercial license:
64
+
65
+ - Your company uses CodeSynapt internally to analyze its codebase ✅
66
+ - You're a freelancer running CodeSynapt while working on a client project ✅
67
+ - You ship CodeSynapt **unmodified** as part of a developer workflow ✅
68
+ - You publish a tutorial / book / video using CodeSynapt ✅
69
+ - You contribute back upstream improvements ✅ (this is what AGPL encourages)
70
+
71
+ ## Plugin API (MIT)
72
+
73
+ Everything inside `plugin-api/` is **MIT-licensed**. This means:
74
+
75
+ - Build plugins under any license (including proprietary, including selling them)
76
+ - Fork the plugin API
77
+ - Embed plugin API types in your own tools
78
+ - The MIT boundary is intentional — we want a thriving plugin ecosystem
79
+ without AGPL "viral" concerns
80
+
81
+ ## Why dual-licensed?
82
+
83
+ CodeSynapt is built and maintained by **one person in their spare time**
84
+ (wing1008). The dual model balances three goals:
85
+
86
+ 1. **Freedom to use** — anyone can use CodeSynapt for any purpose
87
+ 2. **Sustainability** — companies building businesses on top of CodeSynapt
88
+ contribute back, either as code (AGPL) or as a commercial license fee
89
+ 3. **Plugin ecosystem** — plugin authors aren't constrained by AGPL
90
+
91
+ This is the same approach used by:
92
+
93
+ - **MariaDB** (GPL + Commercial)
94
+ - **MySQL** (GPL + Commercial)
95
+ - **Plausible Analytics** (AGPL + Enterprise)
96
+ - **Cal.com** (AGPL + Enterprise)
97
+ - **Sourcegraph** (AGPL + Enterprise)
98
+
99
+ ## Third-party dependencies
100
+
101
+ CodeSynapt bundles several open-source dependencies, all under
102
+ permissive licenses (MIT, Apache-2.0, BSD, ISC). The complete list
103
+ is verifiable via:
104
+
105
+ ```sh
106
+ npm run license-check
107
+ ```
108
+
109
+ Key dependencies:
110
+
111
+ | Package | License |
112
+ |---|---|
113
+ | `@babel/parser`, `@babel/traverse` | MIT |
114
+ | `chokidar` | MIT |
115
+ | `three` | MIT |
116
+ | `ws` | MIT |
117
+ | `electron` | MIT |
118
+ | `electron-builder` | MIT |
119
+ | `electron-updater` | MIT |
120
+ | `@electron/fuses` | MIT |
121
+
122
+ ### Bundled runtime (Windows installer only)
123
+
124
+ The Windows `.exe` installer bundles a copy of Node.js 22 LTS (the
125
+ `node.exe` binary, ~76 MB) as an optional install component. If your
126
+ system already has Node.js installed, the installer auto-detects it
127
+ and skips the bundle to save disk space.
128
+
129
+ | Bundled binary | Version | License | Source |
130
+ |---|---|---|---|
131
+ | Node.js | 22.11.0 LTS (Jod) | MIT | <https://nodejs.org/dist/v22.11.0/> |
132
+
133
+ Node.js is itself a project bundling many components (V8, libuv,
134
+ OpenSSL, etc.) — each with their own permissive license. Full
135
+ attribution: <https://github.com/nodejs/node/blob/main/LICENSE>.
136
+
137
+ ## Questions
138
+
139
+ If you're unsure whether your use case requires a commercial license,
140
+ open a GitHub Discussion and we'll help clarify. **There are no
141
+ gotchas — internal company use is always free under AGPL-3.0.**
package/README.md ADDED
@@ -0,0 +1,331 @@
1
+ # CodeSynapt
2
+
3
+ [![CI](https://img.shields.io/github/actions/workflow/status/wing1008/codesynapt/ci.yml?branch=main&label=ci)](https://github.com/wing1008/codesynapt/actions/workflows/ci.yml)
4
+ [![License: AGPL-3.0](https://img.shields.io/badge/License-AGPL%203.0-blue.svg)](./LICENSE)
5
+ [![Commercial license available](https://img.shields.io/badge/Commercial-Available-orange.svg)](./LICENSES.md)
6
+ [![Plugin API: MIT](https://img.shields.io/badge/Plugin%20API-MIT-green.svg)](./plugin-api/LICENSE)
7
+ [![Version](https://img.shields.io/github/package-json/v/wing1008/codesynapt?label=version&color=informational)](./CHANGELOG.md)
8
+ [![Node 20|22](https://img.shields.io/badge/Node-20%20%7C%2022-339933?logo=node.js&logoColor=white)](./package.json)
9
+ [![Platform](https://img.shields.io/badge/platform-macOS%20%7C%20Windows%20%7C%20Linux-lightgrey)](./docs/installation.md)
10
+ [![Tests](https://img.shields.io/badge/tests-100%20passing-brightgreen)](./tests/)
11
+ [![GitHub Sponsors](https://img.shields.io/github/sponsors/wing1008?label=Sponsor&logo=GitHub&style=social)](https://github.com/sponsors/wing1008)
12
+ [![Buy me a coffee](https://img.shields.io/badge/Buy%20me%20a%20coffee-FFDD00?logo=buymeacoffee&logoColor=black)](https://buymeacoffee.com/wing1008)
13
+
14
+ > **MCP-native code graph for AI agents — see blast radius live.**
15
+ > The dependency map Claude Code / Cursor / any MCP agent should be
16
+ > reading before it edits your code. Live-updating (~300 ms after a
17
+ > save), no re-indexing, no cloud. Same scanner ships as MCP server
18
+ > (8 intent-shaped tools), CLI (`cs`), and a 3D desktop window that
19
+ > pulses every node the AI touches.
20
+
21
+ ## Why this exists
22
+
23
+ Coding agents (Claude Code, Cursor, Aider…) read files one at a time.
24
+ They have no project-wide map: which files matter, what imports what,
25
+ which routes match which fetch calls, what external services the code
26
+ talks to, which "v2" file is the real one vs. abandoned drafts.
27
+
28
+ `codesynapt` builds that map and exposes it three ways:
29
+
30
+ | Surface | For | Example |
31
+ |---|---|---|
32
+ | **MCP server** | AI coding agents | "Which files import `auth.js`?" → agent calls `cs_query({action:'users', id:'auth.js'})` |
33
+ | **CLI** (`cs`) | terminal users, scripts, CI | `cs external` — list every API/website your code talks to; `cs ci-diff main..HEAD` — PR blast radius as Markdown |
34
+ | **Desktop app** | visual exploration | drop folder → 3D graph with live updates; watch the AI navigate live |
35
+
36
+ All three share the same scanner: imports across JS/TS, Python, Go, Rust, Java/Kotlin, C/C++, C#, Swift, Dart, Ruby, PHP (plus Vue/Svelte components), route↔fetch matching for full-stack monorepos, external URL inventory, and dynamic-pattern detection.
37
+
38
+ ## What it does well
39
+
40
+ - **8 intent-shaped MCP tools** (not 37 narrow ones) — `cs_summary`, `cs_query`, `cs_blast`, `cs_intent`, `cs_health`, `cs_change`, `cs_trace`, `cs_ui`. Each takes an `action` enum. Designed so the agent picks the right one with a glance, not by scanning a wall of tool names.
41
+ - **AI-aware response envelope** — every response includes `meta: { scannedAt, tokenEstimate, totalAvailable, truncated }`. The agent budgets tokens before drilling deeper.
42
+ - **Blast radius before edit** — `cs_blast({action:'safety', id})` returns 🟢/🟡/🔴 verdict + reasons in one call; `action:'bundle'` packs the closest neighbours into a token budget so the agent reads the right context first.
43
+ - **Verified dependency accuracy** — import resolution is checked against independent ground truth (TypeScript Compiler API, Python `ast`, language-native rules) at precision/recall ≈ 1.0 across 11 languages on real codebases (VS Code ~6.8k files; Django), measured on library/app source (tests/generated code excluded). For Go, C# and Swift the edge is module/namespace-level (one import links the importing file to the imported unit). Honest limit: it follows *static imports*, so it does **not** see autoload / DI / reflection-implicit dependencies (Rails/Zeitwerk, Spring) — those carry no import statement to resolve, and are surfaced as `caveat` markers rather than silently dropped.
44
+ - **Live updates ~300 ms** — chokidar file-watcher + 60 ms snapshot debounce. No re-indexing, no manual refresh, no cloud round-trip. (Most code-intelligence tools require an explicit re-index step — this one doesn't.)
45
+ - **Live agent visualization** — when the desktop window is open, every MCP call pulses the touched node in 3D. You see the AI navigate.
46
+ - **Full-stack route↔fetch matching** — JS/TS, Python, Next.js file-system API routes auto-detected. Frontend `fetch('/api/billing')` linked to `app/api/billing/route.ts` automatically.
47
+ - **Headless + CI** — `cs scan`, `cs serve`, `cs ci-diff main..HEAD`, `cs ci-gate --max-blast 50`. No Electron required for CI / SSH / Docker.
48
+ - **Auto-history per file** (opt-in) — every save snapshots previous content (cap 3). Roll back via `cs_change({action:'restore'})`.
49
+ - **External URL inventory** — `cs_intent({action:'external'})` lists every API host the project calls (Stripe, OpenAI, your own backend…), grouped by domain.
50
+ - **Env / secret leak detection** — `cs_health({action:'secrets'})` flags server-only env vars accidentally used in client bundles.
51
+ - **Offline by design** — no network calls, no telemetry, no cloud sync. The whole graph lives in memory + your local `.codesynapt/` directory.
52
+ - **i18n** — Korean ↔ English toggle, persists.
53
+
54
+ ## Quick start
55
+
56
+ Three install paths, pick the one that matches you.
57
+
58
+ ### Path 1 — Windows `.exe` (easiest, no Node required up-front)
59
+
60
+ Download `CodeSynapt-Setup-<version>.exe` from the [Releases](https://github.com/wing1008/codesynapt/releases) page. Run the installer:
61
+
62
+ - **Auto-detects** existing Node.js. If found, uses your system Node (saves 76 MB). If not, ships Node 22 LTS bundled.
63
+ - Adds `cs` / `codesynapt` / `codesynapt-mcp` to your user `PATH` automatically (toggle "Add cs command to PATH" — checked by default).
64
+ - Installs to `%LOCALAPPDATA%\Programs\CodeSynapt\`. **Updates are clean**: installing a newer `.exe` auto-removes the old one and preserves your data under `%APPDATA%\codesynapt\`.
65
+
66
+ After install, open **a new** PowerShell:
67
+
68
+ ```sh
69
+ cs --help
70
+ ```
71
+
72
+ If `cs` shows usage, you're done. (Unsigned installer — Windows SmartScreen will warn "unverified publisher"; click "More info → Run anyway".)
73
+
74
+ ### Path 2 — Developer / source (any OS)
75
+
76
+ ```sh
77
+ git clone https://github.com/wing1008/codesynapt.git
78
+ cd codesynapt
79
+ npm install # full install — desktop + CLI + MCP (~700 MB w/ Electron)
80
+ npm link # adds cs / codesynapt / codesynapt-mcp to your PATH
81
+ npm start # desktop app + HTTP control API on :7707
82
+ ```
83
+
84
+ ### Path 3 — CLI / MCP only (no desktop, no 3D — for CI / SSH / Docker, ~30 MB)
85
+
86
+ ```sh
87
+ git clone https://github.com/wing1008/codesynapt.git
88
+ cd codesynapt
89
+ npm install --omit=optional --omit=dev
90
+ npm link
91
+ cs scan . # one-shot
92
+ cs serve . # long-running HTTP daemon (no Electron)
93
+ ```
94
+
95
+ `three` (3D renderer) and `ws` are `optionalDependencies`; `electron` is a devDependency. CI runners can skip the 700 MB Electron download entirely.
96
+
97
+ ### CLI — `cs` command
98
+
99
+ After `.exe` install (Path 1) or `npm link` (Paths 2/3), the `cs` command is on your PATH. The Node `codesynapt` and `codesynapt-mcp` aliases also work.
100
+
101
+ #### Headless — no desktop window needed (CI / SSH / Docker)
102
+
103
+ ```sh
104
+ cs scan [path] --summary # one-shot project overview
105
+ cs scan [path] --json # full graph as JSON
106
+ cs serve [path] --port 7707 # long-running HTTP API daemon
107
+ cs ci-diff main..HEAD # PR impact report (Markdown by default)
108
+ cs ci-gate main..HEAD --max-blast 50 # CI gate, exits 1 on breach
109
+ ```
110
+
111
+ #### Connected — talks to a running desktop or `cs serve` daemon at :7707
112
+
113
+ ```sh
114
+ # Setup
115
+ cs ensure # ensure desktop is running with cwd loaded
116
+ # (auto-launches if dead, swaps folder if needed, no-op otherwise)
117
+ cs init # one-time setup: CLAUDE.md + /codesynapt slash + mcp add hint
118
+
119
+ # Most useful first:
120
+ cs summary # cheap project overview (Layer 1)
121
+ cs safety src/x.ts # 🟢/🟡/🔴 + one-line advice
122
+ cs bundle src/x.ts --budget 8000 # pack neighbours into token budget
123
+ cs blast src/x.ts 3 # transitive dependents + token estimate
124
+ cs suggest # "what to ask the AI next" recommendations
125
+ cs preflight # deploy-readiness check
126
+ cs env [VAR] # .env declared vs used
127
+ cs secrets # server-only env leaked to client?
128
+ cs feature payment # keyword → FE/BE/shared cluster
129
+ cs url /billing # URL → file (Next.js/Astro/SvelteKit)
130
+ cs schema [Model] # DB models (Prisma/Drizzle/SQLAlchemy)
131
+ cs external # external APIs/websites by domain
132
+ cs deps src/x.ts # what does x.ts import?
133
+ cs users src/x.ts # who imports x.ts?
134
+ cs find auth # substring search across **file ids only** (path match)
135
+ cs search "RUNPOD_API_KEY" # full-text **content** search (mtime LRU cache, sub-50ms when warm) — best-effort
136
+ cs ls --limit 10 # top 10 most-imported files
137
+ cs focus src/x.ts # move desktop camera (desktop only)
138
+ ```
139
+
140
+ > **`cs search` caveat**: full-text search is *best-effort*. If invoked while the initial scan is still running, the endpoint returns `503 scan in progress` — retry after a couple of seconds. Under heavy event-loop pressure (large repo + fresh scan), a single search can occasionally hang; this is a known limitation tracked for future `worker_threads` refactor. `cs_query({action:'search'})` MCP returns the same payload; AI agents automatically fall back to Read+Grep on failure.
141
+
142
+ The desktop app exposes ~30 endpoints. Run `cs --help` for the full
143
+ list including history, restore, refresh, tour, timeline, trace.
144
+
145
+ > Used `git clone` (Paths 2/3) and the `cs` command isn't found? Run `npm link` inside the cloned repo — it registers `cs` / `codesynapt` / `codesynapt-mcp` / `codesynapt-server` globally.
146
+
147
+ ## Hook up your AI agent
148
+
149
+ ### Claude Code — recommended setup (2 commands)
150
+
151
+ ```sh
152
+ cd <your-project>
153
+ cs init # generates CLAUDE.md + installs /codesynapt slash commands
154
+ claude mcp add codesynapt codesynapt-mcp # registers 8 cs_* tools (one-time, per OS user)
155
+ ```
156
+
157
+ That's it. Inside any Claude Code session in that project:
158
+
159
+ ```
160
+ /codesynapt ← FORCE mode: cs_* preferred for every non-trivial query/edit
161
+ /codesynapt-auto ← AUTO mode: cs_* only for non-trivial work (skips typos/docs)
162
+ ```
163
+
164
+ **Default is OFF** — `cs_*` tools are not called until you enter a mode. `/clear` or new session resets to OFF.
165
+
166
+ The slash command's first step is `cs ensure` — it guarantees the desktop is running and the **current working directory is loaded**. Auto-launches the desktop if dead, swaps folder if a different one was loaded, no-op otherwise. One command, zero clicks.
167
+
168
+ ### Manual MCP registration (any client)
169
+
170
+ If you skipped `cs init` or use Cursor/Continue/Cline:
171
+
172
+ ```sh
173
+ claude mcp add codesynapt node /absolute/path/to/codesynapt/packages/core/bin/codesynapt-mcp.cjs
174
+ ```
175
+
176
+ That registers 8 intent-shaped MCP tools (all `cs_*`). In any
177
+ session, just ask project-shape questions and Claude picks the right
178
+ action automatically:
179
+
180
+ > *"이 프로젝트가 호출하는 외부 API 다 알려줘"*
181
+ > → `cs_intent({action:'external'})` → domains grouped by file caller
182
+
183
+ > *"`src/auth/session.ts` 수정하면 어떤 파일들이 영향받아?"*
184
+ > → `cs_blast({action:'safety', id:'src/auth/session.ts'})` → 🟡 CAUTION, 23 dependents, advice
185
+
186
+ > *"수정 전에 같이 봐야 할 파일 묶음 만들어줘"*
187
+ > → `cs_blast({action:'bundle', id, budget:8000})` → packed files within token budget
188
+
189
+ > *"import 안 되는 잔재 파일 찾아줘"*
190
+ > → `cs_health({action:'legacy'})` → orphan/path/filename/duplicate candidates with confidence
191
+
192
+ > *"`/billing` 화면이 어느 파일이야?"*
193
+ > → `cs_intent({action:'url', path:'/billing'})` → matched file (Next.js / Astro / SvelteKit aware)
194
+
195
+ > *"src/api/payment.ts 한 시간 전 버전으로 되돌려"*
196
+ > → `cs_change({action:'history', id})` → `cs_change({action:'restore', id, ts})`
197
+
198
+ > *"배포해도 안전한가?"*
199
+ > → `cs_health({action:'preflight'})` → undeclared env / http URLs / hub tests / leaks — overall ok|warn|fail
200
+
201
+ If the desktop app is open you'll **see** every tool call pulse the
202
+ relevant node in 3D — a live X-ray of what the agent is doing.
203
+
204
+ ### Cursor / Continue / Cline / others
205
+
206
+ Same MCP server. Standard config — see [**docs/mcp-setup.md**](./docs/mcp-setup.md) for examples.
207
+
208
+ ## Use cases
209
+
210
+ **1. AI-assisted refactoring without breakage.** Before changing
211
+ `src/lib/payment.ts`, ask Claude "is it safe to refactor?". Agent runs
212
+ `cs_blast({action:'safety'})` → 🟢/🟡/🔴 with reasons in one call.
213
+ Follow up with `action:'bundle'` to get the closest neighbours packed
214
+ into a token budget — the right context for the edit.
215
+
216
+ **2. CI gate for impact-risky PRs.** Add one line to your CI:
217
+ `cs ci-gate main..HEAD --max-blast 50` fails the build if a single
218
+ file changes touches >50 dependents. Or `cs ci-diff main..HEAD
219
+ --format=github-comment` to post a Markdown impact report on the PR.
220
+
221
+ **3. External API + secret audit.** `cs_intent({action:'external'})`
222
+ lists every external host (Stripe, OpenAI…), grouped by caller — for
223
+ security review, migration planning, API spend estimation.
224
+ `cs_health({action:'secrets'})` catches server-only env vars
225
+ accidentally used in client bundles.
226
+
227
+ **4. Cleaning up "v2" / dead files.**
228
+ `cs_health({action:'legacy'})` returns confidence-scored cleanup
229
+ candidates across 4 categories (orphan / path / filename / duplicate),
230
+ so you know which version is the real one before deleting.
231
+
232
+ **5. Full-stack route tracing.** codesynapt matches `fetch('/api/x')`
233
+ client calls to `app.get('/api/x', …)` server routes across JS/TS and
234
+ Python (Express, Fastify, Koa, Hono, Flask, FastAPI) — plus Next.js
235
+ file-system API routes (`app/api/*/route.ts`, `pages/api/*`)
236
+ auto-detected. The graph shows client→server lines so the AI can
237
+ answer "which UI calls this endpoint?"
238
+
239
+ **6. Watching the AI think.** Open the desktop app, start a Claude
240
+ Code session in your terminal, ask the agent to do something
241
+ non-trivial. The graph pulses every file the agent inspects + draws
242
+ a trail through its navigation path. The AI trace panel logs each
243
+ tool call live.
244
+
245
+ **7. URL → file in one query.** Designer says "the /billing screen
246
+ looks broken". `cs_intent({action:'url', path:'/billing'})` →
247
+ `src/app/(dashboard)/billing/page.tsx` (Next.js route groups + dynamic
248
+ segments handled).
249
+
250
+ **8. Onboarding a new project.** Open it in codesynapt, hit the 🧭
251
+ **Tour** button. The camera flies through entry points, top hubs, and
252
+ external API integration spots. Or ask Claude: "give me the guided
253
+ tour" → `cs_trace({action:'tour'})`.
254
+
255
+ **7. Watching project evolution.** Hit the ⏱ **Time-lapse** button.
256
+ The slider scrubs through git history — files appear at their first
257
+ commit. Press play to watch the project grow over 25 seconds. Pairs
258
+ well with screen recordings for `r/dataisbeautiful`.
259
+
260
+ **8. Recovering AI-edited files.** Turn on **Auto history** in
261
+ Settings. Every save (yours or the AI's) snapshots the previous
262
+ version. Roll back from the inspector if Claude edits the wrong
263
+ thing.
264
+
265
+ ## Desktop app — visual surface
266
+
267
+ ![screenshot placeholder — add screenshot.png here]
268
+
269
+ Built on Electron + Three.js. Scales to 100k+ files. Features:
270
+
271
+ - **Real-time** — drop a folder, watch the graph form in seconds; live updates as you edit
272
+ - **Scales** — 300k node smoke test runs at 50fps active / 100fps idle
273
+ - **Spherical force-directed layout** with cursor-anchored zoom (zoom-in tracks cursor; zoom-out drifts toward center like Obsidian)
274
+ - **Live AI agent visualization** — pulse + ripple + cyan-to-magenta navigation trail when MCP calls hit the graph
275
+ - **Idle auto-rotate camera** + scene heartbeat for the "alive" feel; instantly stops on user input
276
+ - **Inspector** with full-file editor + auto-save + connection badge + history panel + diff view
277
+ - **Auto file history** — opt-in, max 3 versions per file under `.codesynapt/history/`
278
+ - **Changes panel** (📝) — every file the session has modified, with one-click line-diff
279
+ - **Onboarding tour** (🧭) — auto-generated walkthrough of entry points + hubs + API integration
280
+ - **Time-lapse** (⏱) — slider replays git history; files appear at their first commit
281
+ - **i18n** — Korean ↔ English toggle, persisted
282
+ - **7 themes** — Observatory, Minimal, Terminal, Maximal, Carbon (CRT), Mono (Tokyo Night), Daylight
283
+ - **Extensible** — plugin API for themes, exporters, parsers, layouts, panels, and context actions
284
+ - **Cross-platform** — macOS (Intel + Apple Silicon), Windows, Linux
285
+ - **Private by design** — local-only HTTP control API on 127.0.0.1, no telemetry, code never leaves your machine
286
+
287
+ For OS-specific installation notes, see **[docs/installation.md](./docs/installation.md)**.
288
+
289
+ ## Documentation
290
+
291
+ | Looking for… | Read |
292
+ |---|---|
293
+ | **MCP setup for Claude Code / Cursor / Continue** | [**docs/mcp-setup.md**](./docs/mcp-setup.md) |
294
+ | How to install on your OS | [docs/installation.md](./docs/installation.md) |
295
+ | Features and what it does | [docs/features.md](./docs/features.md) |
296
+ | Keyboard / mouse controls | [docs/controls.md](./docs/controls.md) |
297
+ | How the internals work | [docs/architecture.md](./docs/architecture.md) |
298
+ | Building a plugin or theme | [plugin-api/README.md](./plugin-api/README.md) |
299
+ | What changed in each release | [CHANGELOG.md](./CHANGELOG.md) |
300
+ | Reporting a security issue | [SECURITY.md](./SECURITY.md) |
301
+ | Getting help or asking questions | [.github/SUPPORT.md](./.github/SUPPORT.md) |
302
+ | Contributing code | [CONTRIBUTING.md](./CONTRIBUTING.md) |
303
+ | Community guidelines | [CODE_OF_CONDUCT.md](./CODE_OF_CONDUCT.md) |
304
+ | AI coding agent guide (working ON codesynapt) | [AGENTS.md](./AGENTS.md) |
305
+
306
+ ## License
307
+
308
+ CodeSynapt uses **dual licensing**:
309
+
310
+ - **Main app** ([LICENSE](./LICENSE)): **[AGPL-3.0-or-later](https://www.gnu.org/licenses/agpl-3.0.en.html)**
311
+ - ✅ Free for personal, internal company, academic, and research use
312
+ - ✅ Free to inspect, modify, and build plugins
313
+ - ⚠️ If you modify CodeSynapt and offer it to others as a network service, your modifications must also be open-sourced under AGPL
314
+ - 💼 **Commercial license available** for organizations that can't accept AGPL — see [LICENSES.md](./LICENSES.md)
315
+ - **Plugin API** ([plugin-api/LICENSE](./plugin-api/LICENSE)): **MIT**
316
+ - Build and distribute plugins under any license you choose
317
+
318
+ For commercial licensing inquiries, open a [GitHub Discussion](https://github.com/wing1008/codesynapt/discussions) or DM `@wing1008`.
319
+
320
+ For a plain-language explanation of the licensing model, see **[LICENSES.md](./LICENSES.md)**.
321
+
322
+ ## Support the project
323
+
324
+ CodeSynapt is built by one person ([@wing1008](https://github.com/wing1008)) in their spare time. If it saves you time, consider:
325
+
326
+ - ⭐ **Star the repo** — costs nothing, helps a lot
327
+ - 💚 **[GitHub Sponsors](https://github.com/sponsors/wing1008)** — recurring or one-time
328
+ - ☕ **[Buy me a coffee](https://buymeacoffee.com/wing1008)** — one-time tip
329
+ - 🏢 **[Commercial license](./LICENSES.md)** — if your company needs to ship CodeSynapt without AGPL obligations
330
+
331
+ Contributions in the form of bug reports, PRs, and docs improvements are also very welcome — see **[CONTRIBUTING.md](./CONTRIBUTING.md)**.