-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathadopt.ps1
More file actions
81 lines (72 loc) · 3.21 KB
/
Copy pathadopt.ps1
File metadata and controls
81 lines (72 loc) · 3.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<#
.SYNOPSIS
Adota o template-claude-code-open em um projeto existente (Windows).
Copia .claude/, CLAUDE.md, AGENTS.md e .gitignore para o diretório atual.
.DESCRIPTION
Script PowerShell puro — sem dependência de WSL, Git Bash ou bash.
Deve ser executado na raiz do projeto destino.
.EXAMPLE
gh repo clone ecodelearn/template-claude-code-open $env:TEMP\cc-template -- --depth=1 --quiet
powershell -ExecutionPolicy Bypass -File "$env:TEMP\cc-template\adopt.ps1"
Remove-Item "$env:TEMP\cc-template" -Recurse -Force
#>
$ErrorActionPreference = "Stop"
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Definition
Write-Host "=== Adopt template-claude-code-open ===" -ForegroundColor Cyan
Write-Host "Target: $(Get-Location)" -ForegroundColor Cyan
Write-Host ""
# .claude/
$targetClaude = Join-Path (Get-Location) ".claude"
if (Test-Path $targetClaude) {
$confirm = Read-Host ".claude/ already exists. Overwrite? (y/N)"
if ($confirm -ne "y") { Write-Host "Skipping .claude/" -ForegroundColor Yellow }
else {
Copy-Item -Path (Join-Path $ScriptDir ".claude") -Destination (Get-Location) -Recurse -Force
Write-Host " .claude/ overwritten" -ForegroundColor Green
}
} else {
Copy-Item -Path (Join-Path $ScriptDir ".claude") -Destination (Get-Location) -Recurse
Write-Host " .claude/ copied" -ForegroundColor Green
}
# CLAUDE.md
$claudeTarget = Join-Path (Get-Location) "CLAUDE.md"
if (Test-Path $claudeTarget) {
$confirm = Read-Host "CLAUDE.md already exists. Overwrite? (y/N)"
if ($confirm -ne "y") { Write-Host "Skipping CLAUDE.md" -ForegroundColor Yellow }
else {
Copy-Item -Path (Join-Path $ScriptDir "CLAUDE.md") -Destination $claudeTarget -Force
Write-Host " CLAUDE.md overwritten" -ForegroundColor Green
}
} else {
Copy-Item -Path (Join-Path $ScriptDir "CLAUDE.md") -Destination (Get-Location)
Write-Host " CLAUDE.md copied" -ForegroundColor Green
}
# AGENTS.md
$agentsTarget = Join-Path (Get-Location) "AGENTS.md"
if (Test-Path $agentsTarget) {
$confirm = Read-Host "AGENTS.md already exists. Overwrite? (y/N)"
if ($confirm -ne "y") { Write-Host "Skipping AGENTS.md" -ForegroundColor Yellow }
else {
Copy-Item -Path (Join-Path $ScriptDir "AGENTS.md") -Destination $agentsTarget -Force
Write-Host " AGENTS.md overwritten" -ForegroundColor Green
}
} else {
Copy-Item -Path (Join-Path $ScriptDir "AGENTS.md") -Destination (Get-Location)
Write-Host " AGENTS.md copied" -ForegroundColor Green
}
# .gitignore
$gitignoreTarget = Join-Path (Get-Location) ".gitignore"
if (Test-Path $gitignoreTarget) {
$confirm = Read-Host ".gitignore already exists. Overwrite? (y/N)"
if ($confirm -ne "y") { Write-Host "Skipping .gitignore" -ForegroundColor Yellow }
else {
Copy-Item -Path (Join-Path $ScriptDir ".gitignore") -Destination $gitignoreTarget -Force
Write-Host " .gitignore overwritten" -ForegroundColor Green
}
} else {
Copy-Item -Path (Join-Path $ScriptDir ".gitignore") -Destination (Get-Location)
Write-Host " .gitignore copied" -ForegroundColor Green
}
Write-Host ""
Write-Host "=== Done! ===" -ForegroundColor Cyan
Write-Host "Run Claude Code and execute: /project-adopt" -ForegroundColor White