Skip to content
This repository was archived by the owner on Sep 21, 2025. It is now read-only.

Commit 0d27e40

Browse files
Merge pull request #4 from chinmay-sawant/website
Website for CodeMapper
2 parents 2788355 + 880a11a commit 0d27e40

File tree

3 files changed

+509
-0
lines changed

3 files changed

+509
-0
lines changed

docs/index.html

Lines changed: 215 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,215 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="UTF-8" />
5+
<title>CodeMapper</title>
6+
<meta name="viewport" content="width=device-width,initial-scale=1" />
7+
<link rel="stylesheet" href="./styles.css" />
8+
</head>
9+
<body>
10+
<button
11+
id="themeToggle"
12+
aria-label="Toggle dark mode"
13+
title="Toggle theme"
14+
></button>
15+
16+
<header class="hero">
17+
<h1>CodeMapper 🗺️</h1>
18+
<p>Analyze large Go codebases and visualize function dependencies.</p>
19+
</header>
20+
21+
<section class="carousel-wrapper">
22+
<div class="carousel" id="carousel">
23+
<div class="slides" id="slides">
24+
<!-- Slides injected by JS -->
25+
</div>
26+
<button class="nav prev" id="prevBtn" aria-label="Previous slide">
27+
28+
</button>
29+
<button class="nav next" id="nextBtn" aria-label="Next slide"></button>
30+
<div class="dots" id="dots"></div>
31+
</div>
32+
</section>
33+
34+
<main class="content">
35+
<section>
36+
<h2>Overview</h2>
37+
<p>
38+
CodeMapper is a tool designed to analyze large Go codebases and
39+
visualize function dependencies in an interactive graph. It helps you
40+
understand how functions and methods are connected across your
41+
project, making onboarding and refactoring easier.
42+
</p>
43+
<p>
44+
<strong>UI Inspiration:</strong> Inspired by n8n.io for intuitive
45+
graph exploration.
46+
</p>
47+
</section>
48+
49+
<section>
50+
<h2>Problem Statement ❓</h2>
51+
<p>
52+
Manually tracing dependencies across 40+ repositories is slow and
53+
error-prone. CodeMapper automates discovery and visualization of
54+
relationships.
55+
</p>
56+
</section>
57+
58+
<section>
59+
<h2>Features ✨</h2>
60+
<ul>
61+
<li>Automatic Go code analysis</li>
62+
<li>Dependency mapping between functions and methods</li>
63+
<li>Interactive visualization (drag nodes to rearrange)</li>
64+
<li>Simple CLI workflow</li>
65+
<li>Front tracking and backtracking of dependencies</li>
66+
<li>Export visualization as PNG</li>
67+
</ul>
68+
</section>
69+
70+
<section>
71+
<h2>How It Works ⚙️</h2>
72+
<ol>
73+
<li>Scans your Go project for definitions and call sites.</li>
74+
<li>Generates a dependency map (JSON).</li>
75+
<li>Serves an interactive visualization.</li>
76+
</ol>
77+
</section>
78+
79+
<section>
80+
<h2>Quick Start 🚦</h2>
81+
<pre><code>go run main.go -path "./proj" -gopath "/user/go/pkg/mod" \
82+
-analyze-deps "example.org/dep1,example.org/dep2" \
83+
-out "full-codemap.json" -serve ":8080"
84+
# Open http://localhost:8080
85+
</code></pre>
86+
</section>
87+
88+
<section>
89+
<h2>Command Line Arguments</h2>
90+
<ul>
91+
<li>-path: project directory</li>
92+
<li>-gopath: Go module cache directory</li>
93+
<li>-analyze-deps: comma-separated dependencies</li>
94+
<li>-out: output JSON filename</li>
95+
<li>-serve: start server address</li>
96+
</ul>
97+
</section>
98+
99+
<section>
100+
<h2>License 📄</h2>
101+
<p>MIT</p>
102+
</section>
103+
</main>
104+
105+
<footer class="footer">
106+
<p>
107+
Made with ❤️ in India •
108+
<a
109+
href="https://github.com/chinmay-sawant/CodeMapper"
110+
target="_blank"
111+
rel="noopener"
112+
>GitHub</a
113+
>
114+
</p>
115+
</footer>
116+
117+
<script>
118+
// Inline JS to avoid CORS restrictions when opened via file://
119+
(function () {
120+
const RAW_BASE =
121+
"https://raw.githubusercontent.com/chinmay-sawant/CodeMapper/master/screenshot";
122+
const images = [1, 2, 3, 4, 5].map((i) => `${RAW_BASE}/image${i}.png`);
123+
124+
const slidesEl = document.getElementById("slides");
125+
const dotsEl = document.getElementById("dots");
126+
const prevBtn = document.getElementById("prevBtn");
127+
const nextBtn = document.getElementById("nextBtn");
128+
const toggleBtn = document.getElementById("themeToggle");
129+
130+
let index = 0;
131+
let timer = null;
132+
const INTERVAL = 5000;
133+
134+
function buildSlides() {
135+
slidesEl.innerHTML = images
136+
.map(
137+
(src) =>
138+
'<div class="slide"><img loading="lazy" src="' +
139+
src +
140+
'" alt="CodeMapper screenshot"></div>'
141+
)
142+
.join("");
143+
dotsEl.innerHTML = images
144+
.map(
145+
(_, i) =>
146+
'<button aria-label="Go to slide ' + (i + 1) + '"></button>'
147+
)
148+
.join("");
149+
}
150+
151+
function setActive(i) {
152+
index = (i + images.length) % images.length;
153+
slidesEl.style.transform = "translateX(-" + index * 100 + "%)";
154+
Array.from(dotsEl.children).forEach((d, di) =>
155+
d.classList.toggle("active", di === index)
156+
);
157+
resetTimer();
158+
}
159+
160+
function next() {
161+
setActive(index + 1);
162+
}
163+
function prev() {
164+
setActive(index - 1);
165+
}
166+
167+
function resetTimer() {
168+
if (timer) clearInterval(timer);
169+
timer = setInterval(next, INTERVAL);
170+
}
171+
172+
nextBtn.addEventListener("click", next);
173+
prevBtn.addEventListener("click", prev);
174+
dotsEl.addEventListener("click", (e) => {
175+
if (e.target.tagName === "BUTTON") {
176+
const i = Array.from(dotsEl.children).indexOf(e.target);
177+
setActive(i);
178+
}
179+
});
180+
181+
function applyTheme(t) {
182+
if (t === "light") {
183+
document.body.classList.add("light");
184+
toggleBtn.textContent = "🌙";
185+
} else {
186+
document.body.classList.remove("light");
187+
toggleBtn.textContent = "☀️";
188+
}
189+
}
190+
191+
const saved = localStorage.getItem("codemapper-theme") || "dark";
192+
applyTheme(saved);
193+
toggleBtn.addEventListener("click", () => {
194+
const nextTheme = document.body.classList.contains("light")
195+
? "dark"
196+
: "light";
197+
localStorage.setItem("codemapper-theme", nextTheme);
198+
applyTheme(nextTheme);
199+
});
200+
201+
buildSlides();
202+
setActive(0);
203+
resetTimer();
204+
205+
document.addEventListener("visibilitychange", () => {
206+
if (document.hidden) {
207+
clearInterval(timer);
208+
} else {
209+
resetTimer();
210+
}
211+
});
212+
})();
213+
</script>
214+
</body>
215+
</html>

docs/script.js

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
const images = [1,2,3,4,5].map(i =>
2+
`https://raw.githubusercontent.com/chinmay-sawant/CodeMapper/master/screenshot/image${i}.png`
3+
);
4+
5+
const slidesEl = document.getElementById('slides');
6+
const dotsEl = document.getElementById('dots');
7+
let index = 0;
8+
let timer = null;
9+
const INTERVAL = 5000;
10+
11+
function buildSlides() {
12+
slidesEl.innerHTML = images.map(src => `<div class="slide"><img loading="lazy" src="${src}" alt="CodeMapper screenshot"></div>`).join('');
13+
dotsEl.innerHTML = images.map((_,i)=>`<button aria-label="Go to slide ${i+1}"></button>`).join('');
14+
}
15+
16+
function setActive(i) {
17+
index = (i + images.length) % images.length;
18+
slidesEl.style.transform = `translateX(-${index * 100}%)`;
19+
[...dotsEl.children].forEach((d,di)=>d.classList.toggle('active', di===index));
20+
resetTimer();
21+
}
22+
23+
function next() { setActive(index+1); }
24+
function prev() { setActive(index-1); }
25+
26+
function resetTimer() {
27+
if (timer) clearInterval(timer);
28+
timer = setInterval(next, INTERVAL);
29+
}
30+
31+
document.getElementById('nextBtn').addEventListener('click', next);
32+
document.getElementById('prevBtn').addEventListener('click', prev);
33+
dotsEl.addEventListener('click', e => {
34+
if (e.target.tagName === 'BUTTON') {
35+
const di = [...dotsEl.children].indexOf(e.target);
36+
setActive(di);
37+
}
38+
});
39+
40+
function applyTheme(t) {
41+
if (t === 'light') {
42+
document.body.classList.add('light');
43+
toggleBtn.textContent = '🌙';
44+
} else {
45+
document.body.classList.remove('light');
46+
toggleBtn.textContent = '☀️';
47+
}
48+
}
49+
50+
const toggleBtn = document.getElementById('themeToggle');
51+
const saved = localStorage.getItem('codemapper-theme') || 'dark';
52+
applyTheme(saved);
53+
54+
toggleBtn.addEventListener('click', () => {
55+
const nextTheme = document.body.classList.contains('light') ? 'dark' : 'light';
56+
localStorage.setItem('codemapper-theme', nextTheme);
57+
applyTheme(nextTheme);
58+
});
59+
60+
buildSlides();
61+
setActive(0);
62+
resetTimer();
63+
64+
// Pause on visibility change to save resources
65+
document.addEventListener('visibilitychange', () => {
66+
if (document.hidden) {
67+
clearInterval(timer);
68+
} else {
69+
resetTimer();
70+
}
71+
});

0 commit comments

Comments
 (0)