Skip to content

Commit e4b2b44

Browse files
authored
Implement auto-run analysis for GitHub repos
Added functionality to auto-run analysis based on the ?repo= query parameter and update the URL bar with the repo parameter. https://claude.ai/code/session_01TmUV1t7A3Gx5ugjURK4exj
1 parent 2e658d9 commit e4b2b44

File tree

1 file changed

+26
-2
lines changed

1 file changed

+26
-2
lines changed

sloccount.html

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -552,8 +552,26 @@ <h3>Language Breakdown</h3>
552552
analyzeZipBtn.textContent = 'Analyze ZIP';
553553
analyzeZipBtn.disabled = false;
554554

555-
showStatus('Ready to analyze code!', 'success');
556-
setTimeout(hideStatus, 2000);
555+
// Check for ?repo= query parameter and auto-run
556+
const params = new URLSearchParams(window.location.search);
557+
const repoParam = params.get('repo');
558+
if (repoParam) {
559+
// Switch to GitHub tab
560+
tabs.forEach(t => t.classList.remove('active'));
561+
document.querySelector('[data-tab="github"]').classList.add('active');
562+
pasteTab.classList.remove('active');
563+
githubTab.classList.add('active');
564+
zipTab.classList.remove('active');
565+
566+
// Fill in the repo URL
567+
repoInput.value = repoParam;
568+
569+
// Auto-run analysis
570+
analyzeGitHubRepo();
571+
} else {
572+
showStatus('Ready to analyze code!', 'success');
573+
setTimeout(hideStatus, 2000);
574+
}
557575
} catch (error) {
558576
showStatus('Failed to initialize: ' + error.message, 'error');
559577
console.error('Initialization error:', error);
@@ -859,6 +877,12 @@ <h3>Language Breakdown</h3>
859877

860878
try {
861879
analyzeRepoBtn.disabled = true;
880+
881+
// Update URL bar with ?repo= parameter
882+
const url = new URL(window.location);
883+
url.searchParams.set('repo', repoUrl);
884+
history.replaceState(null, '', url);
885+
862886
showStatus('Fetching repository information from GitHub API...', 'info');
863887

864888
// First, get the repository info to determine the default branch

0 commit comments

Comments
 (0)