Suporte para iniciar estrutura no windows

This commit is contained in:
victor
2026-05-14 11:09:24 -03:00
parent c4085e7e6f
commit adcc4aaf2c
4 changed files with 144 additions and 0 deletions
+1
View File
@@ -23,6 +23,7 @@
!/.vscode/
!/.vscode/automatizadores/
!/.vscode/automatizadores/bootstrap-workspace.sh
!/.vscode/automatizadores/bootstrap-workspace.ps1
!/.vscode/automatizadores/sync_vitruvio_zip.sh
!/.vscode/automatizadores/sync_vitruvio_zip.ps1
!/.vscode/vsix/
+115
View File
@@ -0,0 +1,115 @@
$ErrorActionPreference = 'Stop'
param(
[string]$TargetDir,
[switch]$Force
)
if ([string]::IsNullOrWhiteSpace($TargetDir)) {
Write-Host "Uso: .vscode/automatizadores/bootstrap-workspace.ps1 <pasta_destino> [-Force]"
exit 1
}
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
$sourceDir = [System.IO.Path]::GetFullPath((Join-Path $scriptDir '..\..'))
$targetFullPath = [System.IO.Path]::GetFullPath($TargetDir)
function Fail {
param([string]$Message)
Write-Error $Message
exit 1
}
function Copy-Entry {
param([string]$RelativePath)
$sourcePath = Join-Path $sourceDir $RelativePath
$targetPath = Join-Path $targetFullPath $RelativePath
if (-not (Test-Path -LiteralPath $sourcePath)) {
Fail "Origem nao encontrada: $RelativePath"
}
$parentDir = Split-Path -Parent $targetPath
New-Item -ItemType Directory -Path $parentDir -Force | Out-Null
if (Test-Path -LiteralPath $targetPath) {
if (-not $Force.IsPresent) {
Fail "Destino ja existe: $RelativePath. Use -Force para sobrescrever."
}
Remove-Item -LiteralPath $targetPath -Recurse -Force
}
Copy-Item -LiteralPath $sourcePath -Destination $targetPath -Recurse -Force
Write-Host "Copiado: $RelativePath"
}
function Write-PortableClaudeSettings {
$targetPath = Join-Path $targetFullPath '.claude\settings.local.json'
$targetDir = Split-Path -Parent $targetPath
New-Item -ItemType Directory -Path $targetDir -Force | Out-Null
if ((Test-Path -LiteralPath $targetPath) -and (-not $Force.IsPresent)) {
Fail 'Destino ja existe: .claude/settings.local.json. Use -Force para sobrescrever.'
}
@'
{
"permissions": {
"allow": [
"mcp__oracle-davinti__run_query"
]
},
"enableAllProjectMcpServers": true,
"enabledMcpjsonServers": [
"oracle-davinti"
]
}
'@ | Set-Content -LiteralPath $targetPath -Encoding UTF8
Write-Host 'Gerado: .claude/settings.local.json'
}
function Cleanup-VscodeMcpDir {
$mcpDir = Join-Path $targetFullPath '.vscode\mcp-oracle-davinti'
$nodeModulesDir = Join-Path $mcpDir 'node_modules'
$envFile = Join-Path $mcpDir '.env'
if (Test-Path -LiteralPath $nodeModulesDir) {
Remove-Item -LiteralPath $nodeModulesDir -Recurse -Force
}
if (Test-Path -LiteralPath $envFile) {
Remove-Item -LiteralPath $envFile -Force
}
}
function Create-BaseDirectories {
New-Item -ItemType Directory -Path (Join-Path $targetFullPath 'Andamento') -Force | Out-Null
New-Item -ItemType Directory -Path (Join-Path $targetFullPath 'Concluidos') -Force | Out-Null
New-Item -ItemType Directory -Path (Join-Path $targetFullPath 'Vitruvio\Documentação') -Force | Out-Null
New-Item -ItemType Directory -Path (Join-Path $targetFullPath 'Vitruvio\Documentação\Componentes') -Force | Out-Null
Write-Host 'Criadas pastas base do workspace'
}
New-Item -ItemType Directory -Path $targetFullPath -Force | Out-Null
if ($targetFullPath -eq $sourceDir) {
Fail 'O destino deve ser diferente da pasta do template.'
}
Copy-Entry '.claude\agents'
Write-PortableClaudeSettings
Copy-Entry '.vscode'
Cleanup-VscodeMcpDir
Copy-Entry '.github'
Copy-Entry 'CLAUDE.md'
Copy-Entry '.mcp.json'
Create-BaseDirectories
Write-Host "Workspace base criado em: $targetFullPath"
Write-Host 'Proximo passo: copie .vscode/mcp-oracle-davinti/.env.example para .env e ajuste as credenciais locais.'
+25
View File
@@ -34,6 +34,18 @@
"${workspaceFolder}/.vscode/automatizadores/bootstrap-workspace.sh",
"${input:bootstrapWorkspaceTarget}"
],
"windows": {
"command": "powershell",
"args": [
"-NoLogo",
"-NoProfile",
"-ExecutionPolicy",
"Bypass",
"-File",
"${workspaceFolder}\\.vscode\\automatizadores\\bootstrap-workspace.ps1",
"${input:bootstrapWorkspaceTarget}"
]
},
"group": "build",
"problemMatcher": []
},
@@ -46,6 +58,19 @@
"${input:bootstrapWorkspaceTarget}",
"--force"
],
"windows": {
"command": "powershell",
"args": [
"-NoLogo",
"-NoProfile",
"-ExecutionPolicy",
"Bypass",
"-File",
"${workspaceFolder}\\.vscode\\automatizadores\\bootstrap-workspace.ps1",
"${input:bootstrapWorkspaceTarget}",
"-Force"
]
},
"group": "build",
"problemMatcher": []
}
+3
View File
@@ -12,6 +12,9 @@ bash bootstrap-workspace.sh /caminho/do/novo-workspace
Se preferir rodar pelo VS Code, execute a task `Workspace: Bootstrap Base`.
- No Linux, a task usa `.vscode/automatizadores/bootstrap-workspace.sh`.
- No Windows, a task usa `.vscode/automatizadores/bootstrap-workspace.ps1`.
Esse comando leva para o destino:
- .claude/agents
- .claude/settings.local.json em versao portavel, sem caminhos absolutos da maquina atual