Skip to content

Commit 6cefebc

Browse files
hlsitechioclaude
andcommitted
feat: add source code clone/pull to interactive installer
- Detects if user is inside the t3code repo (checks git remote) - If inside repo: offers to git pull + bun install - If outside repo: offers to clone hlsitechio/t3code + bun install - Shows git output in real-time Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a52fbe0 commit 6cefebc

1 file changed

Lines changed: 81 additions & 0 deletions

File tree

install.ps1

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -331,6 +331,87 @@ if (Test-Command "npm") {
331331
Write-Host ""
332332
}
333333

334+
# =========================================================================
335+
# SOURCE CODE (git pull / clone)
336+
# =========================================================================
337+
338+
if (Test-Command "git") {
339+
# Check if we're inside the t3code repo already
340+
$inRepo = $false
341+
$repoRoot = $null
342+
try {
343+
$toplevel = git rev-parse --show-toplevel 2>$null
344+
if ($LASTEXITCODE -eq 0 -and $toplevel) {
345+
$remoteUrl = git remote get-url origin 2>$null
346+
if ($remoteUrl -match "t3code") {
347+
$inRepo = $true
348+
$repoRoot = $toplevel
349+
}
350+
}
351+
} catch {}
352+
353+
if ($inRepo) {
354+
Write-Bot "I see you're inside the T3 Code repo ($repoRoot)."
355+
if (Ask-YesNo "Pull latest code from GitHub?") {
356+
Write-Step "Pulling latest changes..."
357+
$branch = git rev-parse --abbrev-ref HEAD 2>$null
358+
git pull origin $branch 2>&1 | ForEach-Object { Write-Host " $_" -ForegroundColor DarkGray }
359+
if ($LASTEXITCODE -eq 0) {
360+
Write-Ok "Code updated (branch: $branch)"
361+
} else {
362+
Write-Warn "Git pull had issues — you may need to resolve conflicts"
363+
}
364+
365+
# Refresh deps if bun is available
366+
if (Test-Command "bun") {
367+
if (Ask-YesNo "Run bun install to refresh dependencies?") {
368+
Write-Step "Installing dependencies..."
369+
bun install 2>&1 | Select-Object -Last 3 | ForEach-Object { Write-Host " $_" -ForegroundColor DarkGray }
370+
if ($LASTEXITCODE -eq 0) {
371+
Write-Ok "Dependencies up to date"
372+
} else {
373+
Write-Warn "bun install had issues"
374+
}
375+
}
376+
}
377+
Write-Host ""
378+
} else {
379+
Write-Skip "Skipping source code update"
380+
Write-Host ""
381+
}
382+
} else {
383+
Write-Bot "Want to clone the T3 Code source code for development?"
384+
if (Ask-YesNo "Clone hlsitechio/t3code to current folder?") {
385+
$cloneDir = Join-Path $PWD.Path "t3code"
386+
if (Test-Path $cloneDir) {
387+
Write-Warn "Folder already exists: $cloneDir"
388+
Write-Skip "Skipping clone"
389+
} else {
390+
Write-Step "Cloning repository..."
391+
git clone "https://github.com/$repo.git" "$cloneDir" 2>&1 | ForEach-Object { Write-Host " $_" -ForegroundColor DarkGray }
392+
if ($LASTEXITCODE -eq 0) {
393+
Write-Ok "Cloned to $cloneDir"
394+
if (Test-Command "bun") {
395+
if (Ask-YesNo "Run bun install in the cloned repo?") {
396+
Push-Location $cloneDir
397+
Write-Step "Installing dependencies..."
398+
bun install 2>&1 | Select-Object -Last 3 | ForEach-Object { Write-Host " $_" -ForegroundColor DarkGray }
399+
Pop-Location
400+
if ($LASTEXITCODE -eq 0) { Write-Ok "Dependencies installed" }
401+
}
402+
}
403+
} else {
404+
Write-Err "Clone failed"
405+
}
406+
}
407+
Write-Host ""
408+
} else {
409+
Write-Skip "Skipping source code"
410+
Write-Host ""
411+
}
412+
}
413+
}
414+
334415
# =========================================================================
335416
# T3 CODE DESKTOP APP
336417
# =========================================================================

0 commit comments

Comments
 (0)