gitmaps 1.0.0 → 1.1.1

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 (145) hide show
  1. package/README.md +265 -122
  2. package/app/[...slug]/page.client.tsx +1 -0
  3. package/app/[...slug]/page.tsx +6 -0
  4. package/app/[owner]/[repo]/page.client.tsx +5 -0
  5. package/app/[slug]/page.client.tsx +5 -0
  6. package/app/analytics.db +0 -0
  7. package/app/api/analytics/route.ts +64 -0
  8. package/app/api/auth/positions/route.ts +95 -33
  9. package/app/api/build-info/route.ts +19 -0
  10. package/app/api/chat/route.ts +13 -2
  11. package/app/api/manifest.json/route.ts +20 -0
  12. package/app/api/og-image/route.ts +14 -0
  13. package/app/api/pwa-icon/route.ts +14 -0
  14. package/app/api/repo/clone-stream/route.ts +20 -12
  15. package/app/api/repo/file-content/route.ts +73 -20
  16. package/app/api/repo/imports/route.ts +21 -3
  17. package/app/api/repo/list/route.ts +30 -0
  18. package/app/api/repo/load/route.test.ts +62 -0
  19. package/app/api/repo/load/route.ts +41 -1
  20. package/app/api/repo/pdf-thumb/route.ts +127 -0
  21. package/app/api/repo/resolve-slug/route.ts +51 -0
  22. package/app/api/repo/tree/route.ts +188 -104
  23. package/app/api/repo/upload/route.ts +6 -9
  24. package/app/api/sw.js/route.ts +70 -0
  25. package/app/api/version/route.ts +26 -0
  26. package/app/galaxy-canvas/page.client.tsx +2 -0
  27. package/app/galaxy-canvas/page.tsx +5 -0
  28. package/app/globals.css +5844 -4694
  29. package/app/icon.png +0 -0
  30. package/app/layout.tsx +1284 -467
  31. package/app/lib/auto-arrange.test.ts +158 -0
  32. package/app/lib/auto-arrange.ts +147 -0
  33. package/app/lib/canvas-export.ts +358 -358
  34. package/app/lib/canvas-text.ts +4 -72
  35. package/app/lib/canvas.ts +625 -564
  36. package/app/lib/card-arrangement.ts +21 -7
  37. package/app/lib/card-context-menu.tsx +2 -2
  38. package/app/lib/card-groups.ts +9 -2
  39. package/app/lib/cards.tsx +1361 -914
  40. package/app/lib/chat.tsx +65 -9
  41. package/app/lib/code-editor.ts +86 -2
  42. package/app/lib/connections.tsx +34 -43
  43. package/app/lib/context.test.ts +32 -0
  44. package/app/lib/context.ts +19 -3
  45. package/app/lib/cursor-sharing.ts +34 -0
  46. package/app/lib/events.tsx +76 -73
  47. package/app/lib/export-canvas.ts +287 -0
  48. package/app/lib/file-card-plugin.ts +148 -134
  49. package/app/lib/file-modal.tsx +49 -0
  50. package/app/lib/file-preview.ts +486 -400
  51. package/app/lib/github-import.test.ts +424 -0
  52. package/app/lib/global-search.ts +48 -27
  53. package/app/lib/initial-route-hydration.test.ts +283 -0
  54. package/app/lib/initial-route-hydration.ts +202 -0
  55. package/app/lib/landing-reset.test.ts +99 -0
  56. package/app/lib/landing-reset.ts +106 -0
  57. package/app/lib/landing-shell.test.ts +75 -0
  58. package/app/lib/large-repo-optimization.ts +37 -0
  59. package/app/lib/layers.tsx +17 -18
  60. package/app/lib/layout-snapshots.ts +320 -0
  61. package/app/lib/loading.test.ts +69 -0
  62. package/app/lib/loading.tsx +160 -45
  63. package/app/lib/mount-cleanup.test.ts +52 -0
  64. package/app/lib/mount-cleanup.ts +34 -0
  65. package/app/lib/mount-init.test.ts +123 -0
  66. package/app/lib/mount-init.ts +107 -0
  67. package/app/lib/mount-lifecycle.test.ts +39 -0
  68. package/app/lib/mount-lifecycle.ts +12 -0
  69. package/app/lib/mount-route-wiring.test.ts +87 -0
  70. package/app/lib/mount-route-wiring.ts +84 -0
  71. package/app/lib/multi-repo.ts +14 -0
  72. package/app/lib/onboarding-tutorial.ts +278 -0
  73. package/app/lib/perf-overlay.ts +78 -0
  74. package/app/lib/positions.ts +191 -122
  75. package/app/lib/recent-commits.test.ts +869 -0
  76. package/app/lib/recent-commits.ts +227 -0
  77. package/app/lib/repo-handoff.test.ts +23 -0
  78. package/app/lib/repo-handoff.ts +16 -0
  79. package/app/lib/repo-progressive.ts +119 -0
  80. package/app/lib/repo-select.test.ts +61 -0
  81. package/app/lib/repo-select.ts +74 -0
  82. package/app/lib/repo.tsx +1383 -977
  83. package/app/lib/role.ts +228 -0
  84. package/app/lib/route-catchall.test.ts +27 -0
  85. package/app/lib/route-repo-entry.test.ts +95 -0
  86. package/app/lib/route-repo-entry.ts +36 -0
  87. package/app/lib/router-contract.test.ts +22 -0
  88. package/app/lib/router-contract.ts +19 -0
  89. package/app/lib/shared-layout.test.ts +86 -0
  90. package/app/lib/shared-layout.ts +82 -0
  91. package/app/lib/shortcuts-panel.ts +2 -0
  92. package/app/lib/status-bar.test.ts +118 -0
  93. package/app/lib/status-bar.ts +365 -128
  94. package/app/lib/sync-controls.test.ts +43 -0
  95. package/app/lib/sync-controls.tsx +303 -0
  96. package/app/lib/test-dom.ts +145 -0
  97. package/app/lib/test-fixtures/router-contract/[...slug]/page.tsx +3 -0
  98. package/app/lib/test-fixtures/router-contract/api/health/route.ts +3 -0
  99. package/app/lib/test-fixtures/router-contract/api/version/route.ts +3 -0
  100. package/app/lib/test-fixtures/router-contract/galaxy-canvas/page.tsx +3 -0
  101. package/app/lib/test-fixtures/router-contract/page.tsx +3 -0
  102. package/app/lib/transclusion-smoke.test.ts +163 -0
  103. package/app/lib/tutorial.ts +301 -0
  104. package/app/lib/version.ts +93 -0
  105. package/app/lib/viewport-culling.ts +740 -728
  106. package/app/lib/virtual-files.ts +456 -0
  107. package/app/lib/webgl-text.ts +189 -0
  108. package/app/lib/{galaxydraw-bridge.ts → xydraw-bridge.ts} +485 -477
  109. package/app/lib/{galaxydraw.test.ts → xydraw.test.ts} +228 -229
  110. package/app/og-image.png +0 -0
  111. package/app/page.client.tsx +70 -215
  112. package/app/page.tsx +27 -92
  113. package/app/state/machine.js +13 -0
  114. package/banner.png +0 -0
  115. package/package.json +17 -8
  116. package/server.ts +11 -1
  117. package/app/api/connections/route.ts +0 -72
  118. package/app/api/positions/route.ts +0 -80
  119. package/app/api/repo/browse/route.ts +0 -55
  120. package/app/lib/pr-review.ts +0 -374
  121. package/packages/galaxydraw/README.md +0 -296
  122. package/packages/galaxydraw/banner.png +0 -0
  123. package/packages/galaxydraw/demo/build-static.ts +0 -100
  124. package/packages/galaxydraw/demo/client.ts +0 -154
  125. package/packages/galaxydraw/demo/dist/client.js +0 -8
  126. package/packages/galaxydraw/demo/index.html +0 -256
  127. package/packages/galaxydraw/demo/server.ts +0 -96
  128. package/packages/galaxydraw/dist/index.js +0 -984
  129. package/packages/galaxydraw/dist/index.js.map +0 -16
  130. package/packages/galaxydraw/node_modules/.bin/tsc.bunx +0 -0
  131. package/packages/galaxydraw/node_modules/.bin/tsc.exe +0 -0
  132. package/packages/galaxydraw/node_modules/.bin/tsserver.bunx +0 -0
  133. package/packages/galaxydraw/node_modules/.bin/tsserver.exe +0 -0
  134. package/packages/galaxydraw/package.json +0 -49
  135. package/packages/galaxydraw/perf.test.ts +0 -284
  136. package/packages/galaxydraw/src/core/cards.ts +0 -435
  137. package/packages/galaxydraw/src/core/engine.ts +0 -339
  138. package/packages/galaxydraw/src/core/events.ts +0 -81
  139. package/packages/galaxydraw/src/core/layout.ts +0 -136
  140. package/packages/galaxydraw/src/core/minimap.ts +0 -216
  141. package/packages/galaxydraw/src/core/state.ts +0 -177
  142. package/packages/galaxydraw/src/core/viewport.ts +0 -106
  143. package/packages/galaxydraw/src/galaxydraw.css +0 -166
  144. package/packages/galaxydraw/src/index.ts +0 -40
  145. package/packages/galaxydraw/tsconfig.json +0 -30
package/README.md CHANGED
@@ -1,167 +1,310 @@
1
- <p align="center">
2
- <img src="banner.png" alt="GitMaps" width="100%" />
3
- </p>
1
+ # 🗺️ GitMaps — Spatial Code Explorer
4
2
 
5
- <p align="center">
6
- <img src="https://img.shields.io/badge/runtime-Bun-f472b6?style=flat-square" alt="Bun">
7
- <img src="https://img.shields.io/badge/framework-Melina-7c3aed?style=flat-square" alt="Melina">
8
- <img src="https://img.shields.io/badge/engine-GalaxyDraw-38bdf8?style=flat-square" alt="GalaxyDraw">
9
- <img src="https://img.shields.io/badge/license-ISC-4ade80?style=flat-square" alt="License">
10
- </p>
3
+ **Explore codebases on an infinite canvas instead of file trees.**
11
4
 
12
- # 🪐 GitMaps
5
+ [![Live Demo](https://img.shields.io/badge/demo-live-7c3aed.svg?style=flat-square)](https://gitmaps.xyz)
6
+ [![npm](https://img.shields.io/npm/v/gitmaps.svg?style=flat-square)](https://npmjs.com/package/gitmaps)
7
+ [![License](https://img.shields.io/badge/license-ISC-blue.svg?style=flat-square)](LICENSE)
13
8
 
14
- **See every file at once.** Pan, zoom, drag — arrange your codebase the way *you* think about it, not the way the file system forces you to.
9
+ ---
10
+
11
+ ## 🎯 What is GitMaps?
12
+
13
+ GitMaps renders your entire repository on an infinite canvas with layers, git time-travel, and a minimap to never lose context.
14
+
15
+ **Traditional file trees are 1-dimensional. GitMaps gives you 5 dimensions:**
15
16
 
16
- 🌐 **Try it now:** [gitmaps.xyz](https://gitmaps.xyz) no install required
17
+ 1. **1D Lines**Individual lines of code
18
+ 2. **2D — Canvas** — Spatial arrangement of files
19
+ 3. **3D — Layers** — Focus areas (Auth, API, UI)
20
+ 4. **4D — Time** — Git history with persistent layout
21
+ 5. **5D — Connections** — Links between related code
17
22
 
18
23
  ---
19
24
 
20
- ## The Problem
25
+ ## 🚀 Quick Start
21
26
 
22
- Traditional code review: Open file → read → close → open next file → forget what you just saw → repeat.
27
+ ### Try Online (No Install)
28
+ Visit **[https://gitmaps.xyz](https://gitmaps.xyz)** and explore popular repos like React, Deno, or Svelte.
23
29
 
24
- **Git on Canvas:**
25
- All changed files laid out on an infinite canvas. Drag them next to each other. Draw connections between related lines. Switch commits with arrow keys. Your spatial layout persists across sessions.
30
+ ### Run Locally
31
+ ```bash
32
+ git clone https://github.com/7flash/gitmaps.git
33
+ cd gitmaps
34
+ bun install
35
+ bun run dev
36
+ # Open http://localhost:3335
37
+ ```
38
+
39
+ ### Install Globally
40
+ ```bash
41
+ bun install -g gitmaps
42
+ gitmaps /path/to/your/repo
43
+ ```
44
+
45
+ ---
26
46
 
27
47
  ## ✨ Features
28
48
 
29
- | Feature | Description |
30
- |---------|-------------|
31
- | 🖼️ **Infinite Canvas** | Pan, zoom, drag files anywhere. Your layout is saved per-commit. |
32
- | 📊 **Inline Diffs** | Green additions, red deletions right inside each card. Scrollbar markers show *where* changes are. |
33
- | **Commit Timeline** | `←` `→` arrow keys through history. Each commit shows exactly which files changed. |
34
- | 📌 **Persistent Layout** | Drag files where they belong in *your* mental model. Switch commits — arrangement stays. |
35
- | 🔍 **Command Palette** | `Ctrl+K` to fuzzy-search files with subsequence-weighted scoring and character-level match highlighting. |
36
- | 🌿 **Branch Comparison** | Side-by-side branch diff viewer with glassmorphism drawer, status badges, and diff cards rendered on canvas. |
37
- | 📦 **Multi-Repo Workspace** | Load 2-3 repos side-by-side. Auto-offset with zone labels. Sidebar tabs switch commit timelines. |
38
- | 👁️ **File Preview on Hover** | Glassmorphism tooltip at low zoom: language badge, path, first 12 lines of code. |
39
- | 🐙 **GitHub Import** | Paste a URL for instant clone, or search by username with live repo filtering. |
40
- | 🔗 **Connections** | `Alt+click` a line → pick target file → click target line. Visual bezier curves link related code. |
41
- | 📁 **Layers** | Group files into focused subsets. Each layer remembers its own viewport position. |
42
- | 🤖 **AI Chat** | Press `I` to open an AI sidebar that understands your current canvas context. |
43
- | ⌨️ **VIM-style Diff Nav** | `j`/`k` to jump between changes across files, `Shift+J`/`K` for file-level navigation. |
44
- | 🔎 **Cross-Card Search** | Press `/` to search across all visible file cards. Results highlighted in-place with match counts. |
45
- | ✏️ **Full Editor** | CodeMirror 6 with syntax highlighting, multi-tab, auto-save, git commit, and code minimap. |
46
- | ⇄ **Tab Diff** | Compare two open tabs side-by-side with LCS diff, change markers, synced scrolling. |
47
- | 🧭 **Symbol Outline** | Side panel showing all functions/classes/types in a file. Click to scroll. |
48
- | 🔀 **Dependency Graph** | `Ctrl+G` to toggle force-directed graph layout based on import relationships. |
49
- | 📝 **PR Review** | Comment threads on any line, stored in localStorage. |
50
- | 📁 **Card Grouping** | Collapse entire directories into compact summary cards to reduce clutter. |
49
+ ### Core Experience
50
+ - 🗺️ **Infinite Canvas** — Pan, zoom, arrange files freely
51
+ - 📄 **File Cards** Interactive cards with code preview and inline diffs
52
+ - 🧭 **Minimap** — Bird's eye view with click-to-navigate
53
+ - 📚 **Layers** Organize files into focus layers
54
+
55
+ ### Git Integration
56
+ - **Commit Timeline** Browse history in sidebar
57
+ - 📊 **Inline Diffs** Green/red markers for changes
58
+ - 🔄 **Time Travel** Navigate commits while layout persists
59
+ - 🔀 **Branch Comparison** Compare branches side-by-side
60
+
61
+ ### Performance
62
+ - **WebGL Renderer** Pixi.js GPU acceleration for 1000+ cards at 60fps
63
+ - 🎯 **Viewport Culling** Only render visible cards
64
+ - 📦 **Progressive Loading** Load large repos in batches
65
+ - ⏱️ **30s Timeout** Large repo support (up from 5s)
66
+
67
+ ### Collaboration
68
+ - 👑 **Leader Mode** Full control when running locally
69
+ - 👁️ **Follower Mode** Read-only view on production
70
+ - 🔄 **Sync Controls** Push/pull canvas state to servers
71
+ - ⚡ **Auto-Sync** — Automatic position sync on changes
72
+
73
+ ### UX Features
74
+ - 📊 **Progress Bar** — Visual feedback during loading
75
+ - 🖼️ **Image/Video Rendering** — Media files display inline
76
+ - 📷 **Canvas Export** — Save layouts as PNG/JPEG/WebP
77
+ - 🎓 **Onboarding Tutorial** — 10-step interactive guide
78
+ - 🔗 **Shareable URLs** — `/owner/repo#commit` format
79
+ - 📑 **Multi-Repo Tabs** — Load multiple repos simultaneously
80
+ - ⌨️ **Keyboard Shortcuts** — Power user shortcuts
51
81
 
52
- ## 🚀 Quick Start
82
+ ---
83
+
84
+ ## 🎯 Use Cases
85
+
86
+ ### AI Code Review
87
+ AI agents generate thousands of lines across dozens of files. GitMaps renders every file simultaneously so you can see the full picture, spot patterns, and review changes spatially instead of one-file-at-a-time.
88
+
89
+ ### Architecture Exploration
90
+ Understand unfamiliar codebases faster by seeing how files relate spatially. Draw connections between related code across layers.
91
+
92
+ ### Onboarding
93
+ New team members explore the codebase spatially. Senior devs create canvas arrangements showing key files and their relationships.
94
+
95
+ ### Pair Programming
96
+ Driver runs locally (leader), navigator visits URL (follower). Both see same spatial arrangement.
97
+
98
+ ### Legacy Code Understanding
99
+ Visualize connections and dependencies in complex legacy systems. Layers help focus on specific concerns.
100
+
101
+ ---
102
+
103
+ ## 📊 Performance
104
+
105
+ | Repo Size | Renderer | Load Time | FPS |
106
+ |-----------|----------|-----------|-----|
107
+ | <100 files | DOM | <1s | 60 |
108
+ | 100-500 files | DOM | 1-3s | 60 |
109
+ | 500-1000 files | WebGL | 3-5s | 60 |
110
+ | 1000+ files | WebGL | 5-10s | 60 |
111
+ | 10000+ files | WebGL | 10-30s | 30-40 |
112
+
113
+ ### Tested Repositories
114
+ - ✅ [7flash/gitmaps](https://gitmaps.xyz/7flash/gitmaps) — 9 files, <1s
115
+ - ✅ [facebook/react](https://gitmaps.xyz/facebook/react) — 100 commits, 2.8s
116
+
117
+ ---
118
+
119
+ ## ⌨️ Keyboard Shortcuts
120
+
121
+ | Shortcut | Action |
122
+ |----------|--------|
123
+ | `Scroll` | Zoom in/out |
124
+ | `Space + Drag` | Pan canvas |
125
+ | `Click` | Select card |
126
+ | `Shift + Click` | Multi-select |
127
+ | `Drag Canvas` | Rect select |
128
+ | `Drag Card` | Move card |
129
+ | `Del` | Hide file |
130
+ | `H` | Arrange in row |
131
+ | `V` | Arrange in column |
132
+ | `G` | Arrange in grid |
133
+ | `W` | Fit to screen |
134
+ | `Ctrl + F` | Search across files |
135
+ | `Ctrl + O` | Find file |
136
+ | `Ctrl + G` | Toggle dependency graph |
137
+ | `Ctrl + +/-` | Text zoom |
138
+ | `Dbl-click` | Open editor |
139
+ | `Alt + Click` | Connect lines |
140
+ | `Arrow Keys` | Prev/next commit |
141
+ | `Ctrl + N` | New file |
142
+ | `Ctrl + S` | Save (in editor) |
143
+ | `?` | Show keyboard shortcuts |
53
144
 
54
- ```sh
55
- # One-liner (requires Bun)
56
- npx gitmaps
57
- # → http://localhost:3335
145
+ ---
146
+
147
+ ## 🏗️ Architecture
148
+
149
+ ### Tech Stack
150
+ - **Runtime:** Bun / Node.js 18+
151
+ - **Framework:** Melina (full-stack TypeScript)
152
+ - **State:** XState for canvas state machine
153
+ - **Rendering:** DOM + Pixi.js (WebGL)
154
+ - **Editor:** CodeMirror 6
155
+ - **Database:** SQLite with Zod ORM
156
+
157
+ ### Project Structure
58
158
  ```
159
+ gitmaps/
160
+ ├── app/ # Main application
161
+ │ ├── api/ # API routes
162
+ │ ├── lib/ # Shared modules
163
+ │ ├── [owner]/[repo]/ # Dynamic routes
164
+ │ └── page.tsx # Main pages
165
+ ├── packages/
166
+ │ └── galaxydraw/ # Rendering engine
167
+ │ ├── src/
168
+ │ │ ├── core/ # Core engine
169
+ │ │ └── webgl-renderer.ts # WebGL renderer
170
+ │ └── demo/ # Performance benchmarks
171
+ └── docs/ # Documentation
172
+ ```
173
+
174
+ ---
175
+
176
+ ## 🚀 Deployment
59
177
 
60
- Or clone for development:
178
+ ### Production Server
179
+ ```bash
180
+ # Clone repo
181
+ git clone https://github.com/7flash/gitmaps.git
182
+ cd gitmaps
61
183
 
62
- ```sh
63
- git clone https://github.com/7flash/git-on-canvas.git
64
- cd galaxy-canvas
184
+ # Install dependencies
65
185
  bun install
66
- bun run dev
67
- ```
68
186
 
69
- Open a repository by entering its path in the sidebar dropdown, or navigate directly:
187
+ # Build
188
+ bun run build
70
189
 
190
+ # Start server
191
+ bun run server.ts
192
+ # Or use bgrun for production
193
+ bgrun start
71
194
  ```
72
- http://localhost:3335/#/path/to/your/repo
195
+
196
+ ### Environment Variables
197
+ ```bash
198
+ # Server configuration
199
+ PORT=3335
200
+ NODE_ENV=production
201
+
202
+ # Database
203
+ DATABASE_PATH=./data/canvas_users.db
204
+
205
+ # GitHub OAuth (optional)
206
+ GITHUB_CLIENT_ID=your_client_id
207
+ GITHUB_CLIENT_SECRET=your_client_secret
73
208
  ```
74
209
 
75
- Or import from GitHub — click the GitHub icon, paste a repo URL, and it clones + opens instantly.
76
-
77
- ## 🖥️ Keyboard Shortcuts
78
-
79
- | Key | Action |
80
- |-----|--------|
81
- | `←` `→` | Previous / next commit |
82
- | `Ctrl+K` | Command palette — fuzzy file search |
83
- | `/` or `Ctrl+F` | Cross-card text search |
84
- | `j` / `k` | Next / previous diff hunk (VIM-style) |
85
- | `Shift+J` / `Shift+K` | Next / previous changed file |
86
- | `W` | Fit selected cards to screen |
87
- | `H` | Arrange selected in a row |
88
- | `V` | Arrange selected in a column |
89
- | `G` | Arrange selected in a grid |
90
- | `Ctrl+A` | Select all cards |
91
- | `Del` / `Backspace` | Hide selected files |
92
- | `Space+Drag` | Pan canvas |
93
- | `Scroll` | Zoom in/out |
94
- | `Ctrl+`/`Ctrl-` | Increase/decrease card font size |
95
- | `I` | Toggle AI chat sidebar |
96
- | `Alt+Click` | Start connection from clicked line |
97
- | `Esc` | Cancel / deselect all |
98
- | Double-click | Zoom to file |
210
+ ---
99
211
 
100
- ## 📦 Multi-Repo Workspace
212
+ ## 🧪 Testing
101
213
 
102
- Load multiple repositories on the same canvas:
214
+ ```bash
215
+ # Run tests
216
+ bun test
103
217
 
104
- 1. Open any repo normally
105
- 2. Use the sidebar dropdown to load a second repo
106
- 3. Repos appear side-by-side with **zone labels** (color-coded floating badges)
107
- 4. **Sidebar tabs** switch commit timelines between repos
108
- 5. Each repo auto-offsets horizontally with an 800px gap
218
+ # Test specific module
219
+ bun test app/lib/
109
220
 
110
- ## 🔗 Connections
221
+ # Performance benchmarks
222
+ open packages/galaxydraw/demo/webgl-demo.html
223
+ ```
224
+
225
+ ---
111
226
 
112
- Draw visual links between related code across files:
227
+ ## 📚 Documentation
113
228
 
114
- 1. **Alt+click** a line number in any file card (source)
115
- 2. A **file picker** appears — search and select the target file
116
- 3. **Click a line** in the target file to complete the connection
229
+ - [Getting Started Guide](../GETTING-STARTED.md)
230
+ - [Deployment Checklist](../DEPLOYMENT-CHECKLIST.md)
231
+ - [Launch Kit](../LAUNCH-KIT.md)
232
+ - [Session Report](../SESSION-FINAL-REPORT.md)
117
233
 
118
- Connection markers appear as colored dots on the left side of each card. Click a marker to jump to the other end.
234
+ ---
119
235
 
120
- ## 📁 Layers
236
+ ## 🤝 Contributing
237
+
238
+ 1. Fork the repo
239
+ 2. Create a feature branch (`git checkout -b feat/amazing-feature`)
240
+ 3. Commit your changes (`git commit -m 'Add amazing feature'`)
241
+ 4. Push to the branch (`git push origin feat/amazing-feature`)
242
+ 5. Open a Pull Request
243
+
244
+ ### Development Setup
245
+ ```bash
246
+ git clone https://github.com/7flash/gitmaps.git
247
+ cd gitmaps
248
+ bun install
249
+ bun run dev
250
+ ```
121
251
 
122
- Layers let you isolate subsets of files for focused review:
252
+ ---
123
253
 
124
- - **Create**: Click `+ New Layer` in the bottom bar
125
- - **Add files**: Right-click a card → "Add to Layer"
126
- - **Switch**: Click any layer tab — canvas shows only that layer's files
127
- - **Default**: "All Files" layer shows everything
254
+ ## 📈 Roadmap
255
+
256
+ ### v1.0.0 (Current)
257
+ - Infinite canvas with pan/zoom
258
+ - ✅ Git integration with timeline
259
+ - ✅ Layers system
260
+ - ✅ WebGL rendering
261
+ - ✅ Leader/Follower mode
262
+ - ✅ Canvas export
263
+ - ✅ Onboarding tutorial
264
+
265
+ ### v1.1.0 (Planned)
266
+ - [ ] Real-time collaboration (WebSocket cursors)
267
+ - [ ] Canvas snapshots (save/restore layouts)
268
+ - [ ] Advanced search with filters
269
+ - [ ] Plugin system
270
+ - [ ] Custom themes
271
+
272
+ ### v2.0.0 (Future)
273
+ - [ ] AI-powered code analysis
274
+ - [ ] Automated architecture diagrams
275
+ - [ ] Integration with VS Code
276
+ - [ ] Team workspaces
277
+ - [ ] Comments and annotations
128
278
 
129
- Each layer remembers its own viewport position, so switching layers is instant context-switching.
279
+ ---
130
280
 
131
- ## 🎮 GalaxyDraw Engine
281
+ ## 🙏 Acknowledgments
132
282
 
133
- The canvas is powered by **GalaxyDraw**a zero-dependency infinite 2D canvas engine built for this project:
283
+ Inspired by **Ted Nelson's vision of intertwingularity** — the idea that everything is connected and hierarchical structures hide more relationships than they reveal.
134
284
 
135
- | Capability | Implementation |
136
- |-----------|----------------|
137
- | **Viewport culling** | Only creates DOM for visible cards. React repo (6833 files): 9 DOM nodes, 6824 deferred. ~35ms vs 14s. |
138
- | **Zoom LOD** | Below 25%, cards render as lightweight pills with vertical file names. Smooth fade transitions. |
139
- | **Throttled materialization** | Max 8 cards per frame with 150ms cooldown no frame drops. |
140
- | **Dual control modes** | Simple (drag=pan, scroll=zoom) or Advanced (space+drag=pan, rect select). |
141
- | **Touch support** | Single-finger pan + pinch-to-zoom on tablets. |
142
- | **Minimap** | Shows all files including deferred cards. Click to navigate. |
285
+ Built with:
286
+ - [Bun](https://bun.sh/) — Fast JavaScript runtime
287
+ - [Melina](https://github.com/7flash/melina) Full-stack framework
288
+ - [Pixi.js](https://pixijs.com/) WebGL rendering
289
+ - [CodeMirror](https://codemirror.net/)Code editor
290
+ - [XState](https://xstate.js.org/) State management
143
291
 
144
- GalaxyDraw is also used by [WARMAPS](https://warmaps.xyz) for its intelligence dashboard canvas.
292
+ ---
145
293
 
146
- ## 🔒 Production Security
294
+ ## 📄 License
147
295
 
148
- When deployed as a SaaS (`NODE_ENV=production`):
296
+ ISC © [7flash](https://github.com/7flash)
149
297
 
150
- - Path traversal protection — only `git-canvas/repos/` and `.data/uploads/` are accessible
151
- - Folder browser endpoint completely blocked
152
- - All 7 repo API routes validate paths via `validateRepoPath()`
298
+ ---
153
299
 
154
- ## ⚙️ Stack
300
+ ## 🔗 Links
155
301
 
156
- | Component | Technology |
157
- |-----------|------------|
158
- | Runtime | [Bun](https://bun.sh) |
159
- | Framework | [Melina](https://github.com/7flash/melina.js) v2.5 (file-based routing, SSR, hot reload) |
160
- | State | [XState](https://statemachine.xyz) v5 |
161
- | Database | [sqlite-zod-orm](https://github.com/7flash/measure-fn) (positions, connections, layers) |
162
- | Git | [simple-git](https://github.com/steveukx/git-js) |
163
- | Profiling | [measure-fn](https://github.com/7flash/measure-fn) |
302
+ - **Live Demo:** https://gitmaps.xyz
303
+ - **GitHub:** https://github.com/7flash/gitmaps
304
+ - **npm:** https://npmjs.com/package/gitmaps
305
+ - **jsx-ai:** https://npmjs.com/package/jsx-ai
306
+ - **Twitter:** https://twitter.com/7flash
164
307
 
165
- ## License
308
+ ---
166
309
 
167
- ISC
310
+ **Built with ❤️ on
@@ -0,0 +1 @@
1
+ export { default } from '../page.client';
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Dynamic catch-all slug route — renders the same canvas page as root.
3
+ * URL: /foo, /owner/repo, /group/subgroup/repo, etc.
4
+ * The full slug is read client-side from window.location.pathname.
5
+ */
6
+ export { default } from '../page';
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Dynamic owner/repo route client — re-exports the root page client.
3
+ * This ensures the client mount script is loaded for /owner/repo URLs.
4
+ */
5
+ export { default } from '../../page.client';
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Dynamic slug route client — re-exports the root page client.
3
+ * This ensures the client mount script is loaded for /slug URLs.
4
+ */
5
+ export { default } from '../page.client';
Binary file
@@ -0,0 +1,64 @@
1
+ import { Database } from 'bun:sqlite';
2
+ import path from 'path';
3
+
4
+ const DB_PATH = path.join(process.cwd(), 'app', 'analytics.db');
5
+ const db = new Database(DB_PATH);
6
+
7
+ db.run(`CREATE TABLE IF NOT EXISTS hits (
8
+ id INTEGER PRIMARY KEY AUTOINCREMENT,
9
+ path TEXT NOT NULL,
10
+ referrer TEXT,
11
+ ua TEXT,
12
+ ts INTEGER NOT NULL DEFAULT (unixepoch())
13
+ )`);
14
+
15
+ db.run(`CREATE INDEX IF NOT EXISTS idx_hits_ts ON hits(ts)`);
16
+ db.run(`CREATE INDEX IF NOT EXISTS idx_hits_path ON hits(path)`);
17
+
18
+ const insertStmt = db.prepare(`INSERT INTO hits (path, referrer, ua) VALUES (?, ?, ?)`);
19
+
20
+ /**
21
+ * POST /api/analytics — log a page hit
22
+ * Body: { path: string }
23
+ */
24
+ export async function POST(req: Request) {
25
+ try {
26
+ const { path: pagePath } = await req.json() as { path: string };
27
+ const referrer = req.headers.get('referer') || '';
28
+ const ua = req.headers.get('user-agent') || '';
29
+ insertStmt.run(pagePath || '/', referrer, ua.slice(0, 200));
30
+ return Response.json({ ok: true });
31
+ } catch {
32
+ return Response.json({ ok: false }, { status: 400 });
33
+ }
34
+ }
35
+
36
+ /**
37
+ * GET /api/analytics — return stats
38
+ * Query: ?hours=24 (default 24)
39
+ */
40
+ export function GET(req: Request) {
41
+ const url = new URL(req.url);
42
+ const hours = parseInt(url.searchParams.get('hours') || '24', 10);
43
+ const since = Math.floor(Date.now() / 1000) - hours * 3600;
44
+
45
+ const total = db.prepare(`SELECT COUNT(*) as count FROM hits WHERE ts > ?`).get(since) as any;
46
+ const byPath = db.prepare(`SELECT path, COUNT(*) as count FROM hits WHERE ts > ? GROUP BY path ORDER BY count DESC LIMIT 20`).all(since);
47
+ const byHour = db.prepare(`
48
+ SELECT strftime('%Y-%m-%d %H:00', ts, 'unixepoch') as hour, COUNT(*) as count
49
+ FROM hits WHERE ts > ? GROUP BY hour ORDER BY hour
50
+ `).all(since);
51
+ const byReferrer = db.prepare(`
52
+ SELECT referrer, COUNT(*) as count FROM hits
53
+ WHERE ts > ? AND referrer != ''
54
+ GROUP BY referrer ORDER BY count DESC LIMIT 10
55
+ `).all(since);
56
+
57
+ return Response.json({
58
+ total: (total as any).count,
59
+ hours,
60
+ byPath,
61
+ byHour,
62
+ byReferrer,
63
+ });
64
+ }