@ornexus/neocortex 3.8.0 → 3.8.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/install.ps1 +218 -210
- package/install.sh +166 -225
- package/package.json +2 -2
package/install.ps1
CHANGED
|
@@ -15,7 +15,7 @@ param(
|
|
|
15
15
|
[string]$ServerUrl = "https://api.neocortex.ornexus.com"
|
|
16
16
|
)
|
|
17
17
|
|
|
18
|
-
$VERSION = "3.8.
|
|
18
|
+
$VERSION = "3.8.2"
|
|
19
19
|
|
|
20
20
|
# =============================================================================
|
|
21
21
|
# CONFIGURACOES
|
|
@@ -65,7 +65,7 @@ if ($Help) {
|
|
|
65
65
|
Write-Host " -CreateProject Instalar estrutura no projeto" -ForegroundColor Cyan
|
|
66
66
|
Write-Host " -SkipProject Nao perguntar sobre projeto" -ForegroundColor Cyan
|
|
67
67
|
Write-Host " -Quiet Modo silencioso" -ForegroundColor Cyan
|
|
68
|
-
Write-Host " -CleanupLegacy
|
|
68
|
+
Write-Host " -CleanupLegacy (Redundante) Limpeza agora e automatica" -ForegroundColor Cyan
|
|
69
69
|
Write-Host " -Local Modo local (copia IP para desenvolvimento)" -ForegroundColor Cyan
|
|
70
70
|
Write-Host " -ServerUrl <url> URL do server Neocortex" -ForegroundColor Cyan
|
|
71
71
|
Write-Host " -Debug Modo debug" -ForegroundColor Cyan
|
|
@@ -264,136 +264,178 @@ function Test-ProjectMigrationNeeds {
|
|
|
264
264
|
}
|
|
265
265
|
|
|
266
266
|
# =============================================================================
|
|
267
|
-
#
|
|
267
|
+
# LIMPEZA AUTOMATICA DE ARTEFATOS LEGADOS (Invoke-AutoCleanupLegacy)
|
|
268
|
+
# Unifica: Test-LegacyArtifacts + Invoke-CleanupLegacy + Remove-LegacyIP
|
|
269
|
+
# + Remove-LegacyIPProject + npm globals + cross-platform cleanup
|
|
270
|
+
# Roda AUTOMATICAMENTE a cada instalacao - sem necessidade de -CleanupLegacy
|
|
271
|
+
# Idempotente: rodar multiplas vezes sem efeitos colaterais
|
|
272
|
+
# Seguro: NAO remove dados do usuario (stories, epics, state.json, config.json)
|
|
268
273
|
# =============================================================================
|
|
269
274
|
|
|
270
|
-
function
|
|
271
|
-
$
|
|
272
|
-
$
|
|
275
|
+
function Invoke-AutoCleanupLegacy {
|
|
276
|
+
$removed = 0
|
|
277
|
+
$claudeDir = "$env:USERPROFILE\.claude"
|
|
278
|
+
$neocortexDir = "$claudeDir\agents\neocortex"
|
|
279
|
+
$skillsDir = "$claudeDir\skills\neocortex"
|
|
280
|
+
|
|
281
|
+
Write-Dbg "Executando limpeza automatica de artefatos legados..."
|
|
282
|
+
|
|
283
|
+
# --- Helper: remove e loga ---
|
|
284
|
+
function Remove-LegacyItem {
|
|
285
|
+
param([string]$Target, [string]$Label)
|
|
286
|
+
if (Test-Path $Target) {
|
|
287
|
+
$displayItem = $Target -replace [regex]::Escape($env:USERPROFILE), "~"
|
|
288
|
+
try {
|
|
289
|
+
Remove-Item -Path $Target -Recurse -Force -ErrorAction Stop
|
|
290
|
+
Write-Info "Removido: $displayItem ($Label)"
|
|
291
|
+
$script:autoRemoved++
|
|
292
|
+
} catch {
|
|
293
|
+
Write-Dbg "Falha ao remover: $displayItem"
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
}
|
|
273
297
|
|
|
274
|
-
|
|
298
|
+
$script:autoRemoved = 0
|
|
275
299
|
|
|
276
|
-
|
|
300
|
+
# --- Categoria 1: Pacotes NPM globais legados ---
|
|
301
|
+
$npmCmd = Get-Command npm -ErrorAction SilentlyContinue
|
|
302
|
+
if ($npmCmd) {
|
|
303
|
+
foreach ($pkg in @("@ornexus/neocortex-cli", "@ornexus-ai/neocortex")) {
|
|
304
|
+
$npmList = & npm list -g $pkg --depth=0 2>$null
|
|
305
|
+
if ($npmList -match [regex]::Escape($pkg)) {
|
|
306
|
+
try {
|
|
307
|
+
& npm uninstall -g $pkg 2>$null
|
|
308
|
+
if ($LASTEXITCODE -eq 0) {
|
|
309
|
+
Write-Info "Removido: $pkg (pacote npm global legado)"
|
|
310
|
+
$script:autoRemoved++
|
|
311
|
+
}
|
|
312
|
+
} catch {
|
|
313
|
+
Write-Dbg "Falha ao remover pacote npm: $pkg"
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
}
|
|
277
317
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
318
|
+
# Verificar binario neocortex-cli no PATH
|
|
319
|
+
$ncliCmd = Get-Command neocortex-cli -ErrorAction SilentlyContinue
|
|
320
|
+
if ($ncliCmd -and $ncliCmd.Source -match "node_modules|npm") {
|
|
321
|
+
try {
|
|
322
|
+
Remove-Item -Path $ncliCmd.Source -Force -ErrorAction Stop
|
|
323
|
+
Write-Info "Removido: $($ncliCmd.Source) (binario neocortex-cli legado)"
|
|
324
|
+
$script:autoRemoved++
|
|
325
|
+
} catch {
|
|
326
|
+
Write-Dbg "Falha ao remover binario neocortex-cli"
|
|
327
|
+
}
|
|
328
|
+
}
|
|
285
329
|
}
|
|
286
330
|
|
|
287
|
-
#
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
}
|
|
331
|
+
# --- Categoria 2: Claude Code (~\.claude\) ---
|
|
332
|
+
# IP proprietaria de versoes anteriores
|
|
333
|
+
Remove-LegacyItem "$neocortexDir\core" "IP legada"
|
|
334
|
+
Remove-LegacyItem $skillsDir "skills legadas"
|
|
335
|
+
Remove-LegacyItem "$neocortexDir\workflow.md" "workflow removido no Tier 3"
|
|
336
|
+
Remove-LegacyItem "$neocortexDir\package.json" "arquivo desnecessario"
|
|
337
|
+
Remove-LegacyItem "$neocortexDir\README.md" "arquivo desnecessario"
|
|
295
338
|
|
|
296
|
-
#
|
|
297
|
-
$
|
|
298
|
-
|
|
299
|
-
$looseFiles = Get-ChildItem -Path "$claudeDir\agents" -Filter "*.md" -File -ErrorAction SilentlyContinue
|
|
339
|
+
# Step folders legados
|
|
340
|
+
foreach ($folder in @("steps-c", "steps-e", "steps-p", "steps-r", "steps-u")) {
|
|
341
|
+
Remove-LegacyItem "$neocortexDir\$folder" "steps legados"
|
|
300
342
|
}
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
343
|
+
|
|
344
|
+
# Artefatos de instalacoes anteriores
|
|
345
|
+
Remove-LegacyItem "$claudeDir\agents\.git" "repo git antigo"
|
|
346
|
+
Remove-LegacyItem "$claudeDir\.claude" "diretorio aninhado (erro BMAD)"
|
|
347
|
+
Remove-LegacyItem "$claudeDir\agents-ldtn" "diretorio legado"
|
|
348
|
+
Remove-LegacyItem "$claudeDir\.superclaude-metadata.json" "metadata SuperClaude"
|
|
349
|
+
|
|
350
|
+
# Backups SuperClaude antigos
|
|
351
|
+
if (Test-Path "$claudeDir\backups" -PathType Container) {
|
|
352
|
+
Get-ChildItem -Path "$claudeDir\backups" -Filter "superclaude_backup_*.tar.gz" -File -ErrorAction SilentlyContinue | ForEach-Object {
|
|
353
|
+
Remove-LegacyItem $_.FullName "backup SuperClaude antigo"
|
|
305
354
|
}
|
|
306
|
-
Write-Info "Considere organizar em namespaces (ex: agents\neocortex\)"
|
|
307
|
-
$warnings++
|
|
308
355
|
}
|
|
309
356
|
|
|
310
|
-
#
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
$
|
|
357
|
+
# --- Categoria 3: Cursor ---
|
|
358
|
+
Remove-LegacyItem "$env:USERPROFILE\.cursor\neocortex" "configs Cursor legadas"
|
|
359
|
+
# .cursorrules com referencias neocortex (verificar antes de remover)
|
|
360
|
+
$cursorrules = "$env:USERPROFILE\.cursorrules"
|
|
361
|
+
if (Test-Path $cursorrules -PathType Leaf) {
|
|
362
|
+
$content = Get-Content $cursorrules -Raw -ErrorAction SilentlyContinue
|
|
363
|
+
if ($content -match "(?i)neocortex|ornexus|synapse") {
|
|
364
|
+
Remove-LegacyItem $cursorrules "cursorrules com refs legadas"
|
|
365
|
+
}
|
|
316
366
|
}
|
|
317
367
|
|
|
318
|
-
#
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
$
|
|
368
|
+
# --- Categoria 4: VS Code ---
|
|
369
|
+
Remove-LegacyItem "$env:USERPROFILE\.vscode\neocortex" "configs VS Code legadas"
|
|
370
|
+
# .instructions.md com referencias neocortex antigo
|
|
371
|
+
$instructionsMd = "$env:USERPROFILE\.instructions.md"
|
|
372
|
+
if (Test-Path $instructionsMd -PathType Leaf) {
|
|
373
|
+
$content = Get-Content $instructionsMd -Raw -ErrorAction SilentlyContinue
|
|
374
|
+
if ($content -match "(?i)neocortex|ornexus|synapse") {
|
|
375
|
+
Remove-LegacyItem $instructionsMd "instructions.md com refs legadas"
|
|
376
|
+
}
|
|
324
377
|
}
|
|
325
378
|
|
|
326
|
-
#
|
|
327
|
-
$
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
}
|
|
379
|
+
# --- Categoria 5: Gemini CLI ---
|
|
380
|
+
Remove-LegacyItem "$env:USERPROFILE\.gemini\neocortex" "configs Gemini legadas"
|
|
381
|
+
|
|
382
|
+
# --- Categoria 6: Codex ---
|
|
383
|
+
Remove-LegacyItem "$env:USERPROFILE\.codex\neocortex" "configs Codex legadas"
|
|
384
|
+
|
|
385
|
+
# --- Categoria 7: Antigravity ---
|
|
386
|
+
# Configs legadas de Antigravity sao gerenciadas pelo adapter, sem path fixo global
|
|
335
387
|
|
|
336
|
-
|
|
337
|
-
|
|
388
|
+
# --- Resultado ---
|
|
389
|
+
$removed = $script:autoRemoved
|
|
390
|
+
if ($removed -gt 0) {
|
|
391
|
+
Write-Ok "$removed artefato(s) legado(s) removido(s) automaticamente"
|
|
392
|
+
} else {
|
|
393
|
+
Write-Dbg "Nenhum artefato legado encontrado"
|
|
338
394
|
}
|
|
339
395
|
|
|
340
|
-
|
|
341
|
-
|
|
396
|
+
# Resetar contadores legados (compatibilidade)
|
|
397
|
+
$script:LegacyItems = @()
|
|
398
|
+
$script:LegacyWarnings = 0
|
|
342
399
|
}
|
|
343
400
|
|
|
344
|
-
|
|
345
|
-
|
|
401
|
+
# Cleanup de IP legada em projetos individuais (project-level)
|
|
402
|
+
function Invoke-AutoCleanupLegacyProject {
|
|
403
|
+
param([string]$ProjectDir)
|
|
346
404
|
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
}
|
|
405
|
+
$neocortexDir = "$ProjectDir\.claude\agents\neocortex"
|
|
406
|
+
$skillsDir = "$ProjectDir\.claude\skills\neocortex"
|
|
407
|
+
$cleaned = $false
|
|
351
408
|
|
|
352
|
-
#
|
|
353
|
-
if ($
|
|
354
|
-
|
|
355
|
-
|
|
409
|
+
# Remover core/ e seus subdiretorios
|
|
410
|
+
if (Test-Path "$neocortexDir\core") {
|
|
411
|
+
Remove-Item -Path "$neocortexDir\core" -Recurse -Force -ErrorAction SilentlyContinue
|
|
412
|
+
$cleaned = $true
|
|
356
413
|
}
|
|
357
414
|
|
|
358
|
-
#
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
if (Test-Path $item -PathType Container) {
|
|
364
|
-
Write-Info " - $displayItem\ (diretorio)"
|
|
365
|
-
} else {
|
|
366
|
-
Write-Info " - $displayItem (arquivo)"
|
|
415
|
+
# Remover step folders
|
|
416
|
+
foreach ($folder in @("steps-c", "steps-e", "steps-p", "steps-r", "steps-u")) {
|
|
417
|
+
if (Test-Path "$neocortexDir\$folder") {
|
|
418
|
+
Remove-Item -Path "$neocortexDir\$folder" -Recurse -Force -ErrorAction SilentlyContinue
|
|
419
|
+
$cleaned = $true
|
|
367
420
|
}
|
|
368
421
|
}
|
|
369
422
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
Write-Info "Cleanup cancelado"
|
|
375
|
-
return
|
|
423
|
+
# Remover skills
|
|
424
|
+
if (Test-Path $skillsDir) {
|
|
425
|
+
Remove-Item -Path $skillsDir -Recurse -Force -ErrorAction SilentlyContinue
|
|
426
|
+
$cleaned = $true
|
|
376
427
|
}
|
|
377
428
|
|
|
378
|
-
#
|
|
379
|
-
$
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
try {
|
|
384
|
-
Remove-Item -Path $item -Recurse -Force -ErrorAction Stop
|
|
385
|
-
Write-Ok "Removido: $displayItem"
|
|
386
|
-
$removed++
|
|
387
|
-
} catch {
|
|
388
|
-
Write-Fail "Falha ao remover: $displayItem"
|
|
389
|
-
$failed++
|
|
429
|
+
# Remover arquivos desnecessarios
|
|
430
|
+
foreach ($file in @("package.json", "README.md", "workflow.md")) {
|
|
431
|
+
if (Test-Path "$neocortexDir\$file") {
|
|
432
|
+
Remove-Item -Path "$neocortexDir\$file" -Force -ErrorAction SilentlyContinue
|
|
433
|
+
$cleaned = $true
|
|
390
434
|
}
|
|
391
435
|
}
|
|
392
436
|
|
|
393
|
-
if ($
|
|
394
|
-
Write-
|
|
395
|
-
} else {
|
|
396
|
-
Write-Warn "$removed removido(s), $failed falha(s)"
|
|
437
|
+
if ($cleaned) {
|
|
438
|
+
Write-Info "IP proprietaria removida do projeto (agora servida via server remoto)"
|
|
397
439
|
}
|
|
398
440
|
}
|
|
399
441
|
|
|
@@ -450,30 +492,54 @@ function Verify-Installation {
|
|
|
450
492
|
}
|
|
451
493
|
}
|
|
452
494
|
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
$
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
$mdCount = (Get-ChildItem -Path $dirPath -Filter "*.md" -File -ErrorAction SilentlyContinue).Count
|
|
461
|
-
if ($mdCount -eq 0) {
|
|
462
|
-
$report += @{ Status = "WARN"; Detail = "$dir/ (vazio - nenhum arquivo .md)" }
|
|
463
|
-
$warns++
|
|
495
|
+
if ($LOCAL_MODE) {
|
|
496
|
+
# --- Layer 3: Step directories (local mode only) ---
|
|
497
|
+
foreach ($dir in @("steps-c", "steps-e", "steps-p", "steps-r", "steps-u")) {
|
|
498
|
+
$dirPath = Join-Path $script:DestDir $dir
|
|
499
|
+
if (-not (Test-Path $dirPath -PathType Container)) {
|
|
500
|
+
$report += @{ Status = "FAIL"; Detail = "$dir/ (diretorio nao encontrado)" }
|
|
501
|
+
$fails++
|
|
464
502
|
} else {
|
|
465
|
-
$
|
|
503
|
+
$mdCount = (Get-ChildItem -Path $dirPath -Filter "*.md" -File -ErrorAction SilentlyContinue).Count
|
|
504
|
+
if ($mdCount -eq 0) {
|
|
505
|
+
$report += @{ Status = "WARN"; Detail = "$dir/ (vazio - nenhum arquivo .md)" }
|
|
506
|
+
$warns++
|
|
507
|
+
} else {
|
|
508
|
+
$report += @{ Status = "OK"; Detail = "$dir/ ($mdCount arquivos)" }
|
|
509
|
+
}
|
|
466
510
|
}
|
|
467
511
|
}
|
|
468
|
-
}
|
|
469
512
|
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
513
|
+
# --- Layer 3b: Core directory (local mode only) ---
|
|
514
|
+
$corePath = Join-Path $script:DestDir "core"
|
|
515
|
+
if (-not (Test-Path $corePath -PathType Container)) {
|
|
516
|
+
$report += @{ Status = "FAIL"; Detail = "core/ (diretorio nao encontrado)" }
|
|
517
|
+
$fails++
|
|
518
|
+
} else {
|
|
519
|
+
$report += @{ Status = "OK"; Detail = "core/" }
|
|
520
|
+
}
|
|
475
521
|
} else {
|
|
476
|
-
|
|
522
|
+
# --- Layer 3: Thin client config (remote mode) ---
|
|
523
|
+
$configFile = "$env:USERPROFILE\.neocortex\config.json"
|
|
524
|
+
if (Test-Path $configFile -PathType Leaf) {
|
|
525
|
+
$report += @{ Status = "OK"; Detail = "~\.neocortex\config.json (thin client configurado)" }
|
|
526
|
+
} else {
|
|
527
|
+
$report += @{ Status = "WARN"; Detail = "~\.neocortex\config.json (nao encontrado)" }
|
|
528
|
+
$warns++
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
# Verify NO IP directories exist
|
|
532
|
+
$ipFound = $false
|
|
533
|
+
foreach ($dir in @("core", "steps-c", "steps-e", "steps-p", "steps-r", "steps-u")) {
|
|
534
|
+
if (Test-Path (Join-Path $script:DestDir $dir) -PathType Container) {
|
|
535
|
+
$report += @{ Status = "WARN"; Detail = "$dir/ ainda existe (deveria ter sido removido)" }
|
|
536
|
+
$warns++
|
|
537
|
+
$ipFound = $true
|
|
538
|
+
}
|
|
539
|
+
}
|
|
540
|
+
if (-not $ipFound) {
|
|
541
|
+
$report += @{ Status = "OK"; Detail = "Zero IP no filesystem (modo remoto)" }
|
|
542
|
+
}
|
|
477
543
|
}
|
|
478
544
|
|
|
479
545
|
# --- Display report ---
|
|
@@ -503,47 +569,9 @@ function Verify-Installation {
|
|
|
503
569
|
}
|
|
504
570
|
|
|
505
571
|
# =============================================================================
|
|
506
|
-
# TIER 3:
|
|
572
|
+
# TIER 3: CONFIG DO THIN CLIENT
|
|
507
573
|
# =============================================================================
|
|
508
574
|
|
|
509
|
-
function Remove-LegacyIP {
|
|
510
|
-
$neocortexDir = "$env:USERPROFILE\.claude\agents\neocortex"
|
|
511
|
-
$skillsDir = "$env:USERPROFILE\.claude\skills\neocortex"
|
|
512
|
-
$cleaned = $false
|
|
513
|
-
|
|
514
|
-
# Remover core/ e seus subdiretorios
|
|
515
|
-
if (Test-Path "$neocortexDir\core") {
|
|
516
|
-
Remove-Item -Path "$neocortexDir\core" -Recurse -Force -ErrorAction SilentlyContinue
|
|
517
|
-
$cleaned = $true
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
# Remover step folders
|
|
521
|
-
foreach ($folder in @("steps-c", "steps-e", "steps-p", "steps-r", "steps-u")) {
|
|
522
|
-
if (Test-Path "$neocortexDir\$folder") {
|
|
523
|
-
Remove-Item -Path "$neocortexDir\$folder" -Recurse -Force -ErrorAction SilentlyContinue
|
|
524
|
-
$cleaned = $true
|
|
525
|
-
}
|
|
526
|
-
}
|
|
527
|
-
|
|
528
|
-
# Remover skills
|
|
529
|
-
if (Test-Path $skillsDir) {
|
|
530
|
-
Remove-Item -Path $skillsDir -Recurse -Force -ErrorAction SilentlyContinue
|
|
531
|
-
$cleaned = $true
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
# Remover arquivos desnecessarios
|
|
535
|
-
foreach ($file in @("package.json", "README.md")) {
|
|
536
|
-
if (Test-Path "$neocortexDir\$file") {
|
|
537
|
-
Remove-Item -Path "$neocortexDir\$file" -Force -ErrorAction SilentlyContinue
|
|
538
|
-
$cleaned = $true
|
|
539
|
-
}
|
|
540
|
-
}
|
|
541
|
-
|
|
542
|
-
if ($cleaned) {
|
|
543
|
-
Write-Info "IP proprietaria removida de versao anterior (agora servida via server remoto)"
|
|
544
|
-
}
|
|
545
|
-
}
|
|
546
|
-
|
|
547
575
|
function Set-ThinClientConfig {
|
|
548
576
|
$configDir = "$env:USERPROFILE\.neocortex"
|
|
549
577
|
$configFile = "$configDir\config.json"
|
|
@@ -584,41 +612,8 @@ function Set-ThinClientConfig {
|
|
|
584
612
|
Write-Dbg "Thin client config criada: $configFile"
|
|
585
613
|
}
|
|
586
614
|
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
$neocortexDir = "$ProjectDir\.claude\agents\neocortex"
|
|
591
|
-
$skillsDir = "$ProjectDir\.claude\skills\neocortex"
|
|
592
|
-
$cleaned = $false
|
|
593
|
-
|
|
594
|
-
if (Test-Path "$neocortexDir\core") {
|
|
595
|
-
Remove-Item -Path "$neocortexDir\core" -Recurse -Force -ErrorAction SilentlyContinue
|
|
596
|
-
$cleaned = $true
|
|
597
|
-
}
|
|
598
|
-
|
|
599
|
-
foreach ($folder in @("steps-c", "steps-e", "steps-p", "steps-r", "steps-u")) {
|
|
600
|
-
if (Test-Path "$neocortexDir\$folder") {
|
|
601
|
-
Remove-Item -Path "$neocortexDir\$folder" -Recurse -Force -ErrorAction SilentlyContinue
|
|
602
|
-
$cleaned = $true
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
|
|
606
|
-
if (Test-Path $skillsDir) {
|
|
607
|
-
Remove-Item -Path $skillsDir -Recurse -Force -ErrorAction SilentlyContinue
|
|
608
|
-
$cleaned = $true
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
foreach ($file in @("package.json", "README.md")) {
|
|
612
|
-
if (Test-Path "$neocortexDir\$file") {
|
|
613
|
-
Remove-Item -Path "$neocortexDir\$file" -Force -ErrorAction SilentlyContinue
|
|
614
|
-
$cleaned = $true
|
|
615
|
-
}
|
|
616
|
-
}
|
|
617
|
-
|
|
618
|
-
if ($cleaned) {
|
|
619
|
-
Write-Info "IP proprietaria removida do projeto (agora servida via server remoto)"
|
|
620
|
-
}
|
|
621
|
-
}
|
|
615
|
+
# Remove-LegacyIPProject substituida por Invoke-AutoCleanupLegacyProject
|
|
616
|
+
# (definida na secao de limpeza automatica acima)
|
|
622
617
|
|
|
623
618
|
# =============================================================================
|
|
624
619
|
# INSTALACAO CORE
|
|
@@ -654,7 +649,7 @@ function Install-Core {
|
|
|
654
649
|
Copy-Silent "$($script:SourceDir)\README.md" "$script:DestDir\" | Out-Null
|
|
655
650
|
} else {
|
|
656
651
|
# Tier 3 Remote Mode: NAO copiar IP
|
|
657
|
-
|
|
652
|
+
# Nota: Invoke-AutoCleanupLegacy ja rodou no inicio - aqui apenas config
|
|
658
653
|
Set-ThinClientConfig
|
|
659
654
|
}
|
|
660
655
|
|
|
@@ -1239,7 +1234,7 @@ function New-ProjectDirectories {
|
|
|
1239
1234
|
}
|
|
1240
1235
|
} else {
|
|
1241
1236
|
# Tier 3 Remote Mode: limpar IP de versoes anteriores no projeto
|
|
1242
|
-
|
|
1237
|
+
Invoke-AutoCleanupLegacyProject -ProjectDir $projectDir
|
|
1243
1238
|
}
|
|
1244
1239
|
$targetSummary += "claude-code"
|
|
1245
1240
|
}
|
|
@@ -1379,9 +1374,20 @@ function Show-Result {
|
|
|
1379
1374
|
Write-Host ""
|
|
1380
1375
|
Write-Host " Instalacao concluida!" -ForegroundColor Green
|
|
1381
1376
|
Write-Host ""
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1377
|
+
if ($LOCAL_MODE) {
|
|
1378
|
+
Write-Host " Modo: Local (IP completa copiada)" -ForegroundColor DarkGray
|
|
1379
|
+
Write-Host " Locais:" -ForegroundColor DarkGray
|
|
1380
|
+
Write-Host " Agente: ~\.claude\agents\neocortex\" -ForegroundColor DarkGray
|
|
1381
|
+
Write-Host " Skills: ~\.claude\skills\neocortex\" -ForegroundColor DarkGray
|
|
1382
|
+
} else {
|
|
1383
|
+
Write-Host " Modo: Remoto (Tier 3 - thin client)" -ForegroundColor DarkGray
|
|
1384
|
+
Write-Host " Locais:" -ForegroundColor DarkGray
|
|
1385
|
+
Write-Host " Agente: ~\.claude\agents\neocortex\ (3 arquivos)" -ForegroundColor DarkGray
|
|
1386
|
+
Write-Host " Config: ~\.neocortex\config.json" -ForegroundColor DarkGray
|
|
1387
|
+
Write-Host ""
|
|
1388
|
+
Write-Host " Ative sua licenca:" -ForegroundColor DarkGray
|
|
1389
|
+
Write-Host " npx @ornexus/neocortex-client activate NX-PRO-xxx" -ForegroundColor Cyan
|
|
1390
|
+
}
|
|
1385
1391
|
Write-Host ""
|
|
1386
1392
|
Write-Host " Proximo passo:" -ForegroundColor DarkGray
|
|
1387
1393
|
Write-Host " @neocortex *init @docs/epics.md" -ForegroundColor Cyan
|
|
@@ -1407,8 +1413,6 @@ function Show-Result {
|
|
|
1407
1413
|
Show-Banner
|
|
1408
1414
|
Get-SourceDirectory
|
|
1409
1415
|
Test-OldInstallation
|
|
1410
|
-
Test-LegacyArtifacts | Out-Null
|
|
1411
|
-
Invoke-CleanupLegacy
|
|
1412
1416
|
|
|
1413
1417
|
# Determine targets
|
|
1414
1418
|
if ($Targets) {
|
|
@@ -1427,11 +1431,15 @@ if ($Targets) {
|
|
|
1427
1431
|
|
|
1428
1432
|
Write-Dbg "Targets: $($script:SelectedTargets -join ', ')"
|
|
1429
1433
|
|
|
1430
|
-
$totalSteps =
|
|
1431
|
-
if ($script:SelectedTargets -contains "claude-code") { $totalSteps =
|
|
1434
|
+
$totalSteps = 4
|
|
1435
|
+
if ($script:SelectedTargets -contains "claude-code") { $totalSteps = 6 }
|
|
1436
|
+
|
|
1437
|
+
# Step 1: Limpeza automatica de versoes anteriores
|
|
1438
|
+
Write-Step 1 $totalSteps "Limpeza de versoes anteriores"
|
|
1439
|
+
Invoke-AutoCleanupLegacy
|
|
1432
1440
|
|
|
1433
|
-
# Step
|
|
1434
|
-
Write-Step
|
|
1441
|
+
# Step 2: Core
|
|
1442
|
+
Write-Step 2 $totalSteps "Instalando core"
|
|
1435
1443
|
$coreSuccess = Install-Core
|
|
1436
1444
|
|
|
1437
1445
|
if (-not $coreSuccess) {
|
|
@@ -1439,23 +1447,23 @@ if (-not $coreSuccess) {
|
|
|
1439
1447
|
exit 1
|
|
1440
1448
|
}
|
|
1441
1449
|
|
|
1442
|
-
# Step
|
|
1443
|
-
Write-Step
|
|
1450
|
+
# Step 3: Skills
|
|
1451
|
+
Write-Step 3 $totalSteps "Instalando skills"
|
|
1444
1452
|
Install-Skills | Out-Null
|
|
1445
1453
|
|
|
1446
|
-
# Step
|
|
1447
|
-
Write-Step
|
|
1454
|
+
# Step 4: Targets
|
|
1455
|
+
Write-Step 4 $totalSteps "Instalando $($script:SelectedTargets.Count) plataforma(s)"
|
|
1448
1456
|
Install-Targets -TargetList $script:SelectedTargets
|
|
1449
1457
|
|
|
1450
|
-
# Step
|
|
1458
|
+
# Step 5-6: Claude Code extras
|
|
1451
1459
|
if ($script:SelectedTargets -contains "claude-code") {
|
|
1452
1460
|
Import-EnvFile | Out-Null
|
|
1453
1461
|
Request-Tokens
|
|
1454
1462
|
|
|
1455
|
-
Write-Step
|
|
1463
|
+
Write-Step 5 $totalSteps "Configurando MCPs"
|
|
1456
1464
|
Install-MCPs
|
|
1457
1465
|
|
|
1458
|
-
Write-Step
|
|
1466
|
+
Write-Step 6 $totalSteps "Verificando ferramentas"
|
|
1459
1467
|
Install-CodeRabbit
|
|
1460
1468
|
}
|
|
1461
1469
|
|
package/install.sh
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
# Epic & Story Development Orchestrator
|
|
5
5
|
|
|
6
6
|
# Versao do instalador
|
|
7
|
-
VERSION="3.8.
|
|
7
|
+
VERSION="3.8.2"
|
|
8
8
|
|
|
9
9
|
# Flags
|
|
10
10
|
MIGRATION_DETECTED=false
|
|
@@ -74,7 +74,7 @@ while [[ $# -gt 0 ]]; do
|
|
|
74
74
|
echo " --create-project Instalar estrutura no projeto"
|
|
75
75
|
echo " -s, --skip-project Nao perguntar sobre projeto"
|
|
76
76
|
echo " -q, --quiet Modo silencioso"
|
|
77
|
-
echo " --cleanup-legacy
|
|
77
|
+
echo " --cleanup-legacy (Redundante) Limpeza agora e automatica"
|
|
78
78
|
echo " --local Modo local (copia IP para desenvolvimento)"
|
|
79
79
|
echo " --server-url=<url> URL do server Neocortex (padrao: api.neocortex.ornexus.com)"
|
|
80
80
|
echo " -d, --debug Modo debug"
|
|
@@ -240,165 +240,172 @@ detect_old_installation() {
|
|
|
240
240
|
fi
|
|
241
241
|
}
|
|
242
242
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
243
|
+
# =============================================================================
|
|
244
|
+
# LIMPEZA AUTOMATICA DE ARTEFATOS LEGADOS (auto_cleanup_legacy)
|
|
245
|
+
# Unifica: detect_legacy_artifacts + cleanup_legacy_artifacts + cleanup_legacy_ip
|
|
246
|
+
# + cleanup_legacy_ip_project + npm globals + cross-platform cleanup
|
|
247
|
+
# Roda AUTOMATICAMENTE a cada instalacao - sem necessidade de --cleanup-legacy
|
|
248
|
+
# Idempotente: rodar multiplas vezes sem efeitos colaterais
|
|
249
|
+
# Seguro: NAO remove dados do usuario (stories, epics, state.json, config.json)
|
|
250
|
+
# =============================================================================
|
|
247
251
|
|
|
248
|
-
|
|
252
|
+
auto_cleanup_legacy() {
|
|
253
|
+
local removed=0
|
|
254
|
+
local claude_dir="$HOME/.claude"
|
|
255
|
+
local neocortex_dir="$claude_dir/agents/neocortex"
|
|
256
|
+
local skills_dir="$claude_dir/skills/neocortex"
|
|
257
|
+
|
|
258
|
+
debug "Executando limpeza automatica de artefatos legados..."
|
|
259
|
+
|
|
260
|
+
# ─── Helper: remove e loga ───────────────────────────────────────────
|
|
261
|
+
_remove_legacy() {
|
|
262
|
+
local target="$1"
|
|
263
|
+
local label="$2"
|
|
264
|
+
if [ -e "$target" ]; then
|
|
265
|
+
local display="${target/#$HOME/~}"
|
|
266
|
+
if rm -rf "$target" 2>/dev/null; then
|
|
267
|
+
info "Removido: $display ($label)"
|
|
268
|
+
removed=$((removed + 1))
|
|
269
|
+
else
|
|
270
|
+
debug "Falha ao remover: $display"
|
|
271
|
+
fi
|
|
272
|
+
fi
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
# ─── Categoria 1: Pacotes NPM globais legados ────────────────────────
|
|
276
|
+
if command -v npm >/dev/null 2>&1; then
|
|
277
|
+
# Verificar e remover pacotes npm globais legados
|
|
278
|
+
for pkg in "@ornexus/neocortex-cli" "@ornexus-ai/neocortex"; do
|
|
279
|
+
if npm list -g "$pkg" --depth=0 2>/dev/null | grep -q "$pkg"; then
|
|
280
|
+
if npm uninstall -g "$pkg" 2>/dev/null; then
|
|
281
|
+
info "Removido: $pkg (pacote npm global legado)"
|
|
282
|
+
removed=$((removed + 1))
|
|
283
|
+
else
|
|
284
|
+
debug "Falha ao remover pacote npm: $pkg"
|
|
285
|
+
fi
|
|
286
|
+
fi
|
|
287
|
+
done
|
|
249
288
|
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
"
|
|
257
|
-
|
|
289
|
+
# Verificar binario neocortex-cli no PATH
|
|
290
|
+
local ncli_path
|
|
291
|
+
ncli_path=$(command -v neocortex-cli 2>/dev/null || true)
|
|
292
|
+
if [ -n "$ncli_path" ]; then
|
|
293
|
+
# Verificar se e um link/binario npm (nao remover se for outro tool)
|
|
294
|
+
if [[ "$ncli_path" == *"node_modules"* ]] || [[ "$ncli_path" == *"npm"* ]]; then
|
|
295
|
+
rm -f "$ncli_path" 2>/dev/null && {
|
|
296
|
+
info "Removido: $ncli_path (binario neocortex-cli legado)"
|
|
297
|
+
removed=$((removed + 1))
|
|
298
|
+
}
|
|
299
|
+
fi
|
|
300
|
+
fi
|
|
258
301
|
fi
|
|
259
302
|
|
|
260
|
-
#
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
"
|
|
267
|
-
warnings=$((warnings + 1))
|
|
268
|
-
fi
|
|
303
|
+
# ─── Categoria 2: Claude Code (~/.claude/) ────────────────────────────
|
|
304
|
+
# IP proprietaria de versoes anteriores
|
|
305
|
+
_remove_legacy "$neocortex_dir/core" "IP legada"
|
|
306
|
+
_remove_legacy "$skills_dir" "skills legadas"
|
|
307
|
+
_remove_legacy "$neocortex_dir/workflow.md" "workflow removido no Tier 3"
|
|
308
|
+
_remove_legacy "$neocortex_dir/package.json" "arquivo desnecessario"
|
|
309
|
+
_remove_legacy "$neocortex_dir/README.md" "arquivo desnecessario"
|
|
269
310
|
|
|
270
|
-
#
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
[ -f "$f" ] || continue
|
|
275
|
-
loose_count=$((loose_count + 1))
|
|
276
|
-
debug " Solto: $(basename "$f")"
|
|
277
|
-
done
|
|
278
|
-
fi
|
|
279
|
-
if [ $loose_count -gt 0 ]; then
|
|
280
|
-
info "$loose_count arquivo(s) .md solto(s) em ~/.claude/agents/"
|
|
281
|
-
info "Considere organizar em namespaces (ex: agents/neocortex/)"
|
|
282
|
-
warnings=$((warnings + 1))
|
|
283
|
-
fi
|
|
284
|
-
|
|
285
|
-
# Check 4: Legacy agents-ldtn/ directory
|
|
286
|
-
if [ -d "$claude_dir/agents-ldtn" ]; then
|
|
287
|
-
warn "Diretorio legado detectado: ~/.claude/agents-ldtn/"
|
|
288
|
-
info "Execute com --cleanup-legacy para remover"
|
|
289
|
-
legacy_items="${legacy_items}${claude_dir}/agents-ldtn
|
|
290
|
-
"
|
|
291
|
-
warnings=$((warnings + 1))
|
|
292
|
-
fi
|
|
311
|
+
# Step folders legados
|
|
312
|
+
for folder in steps-c steps-e steps-p steps-r steps-u; do
|
|
313
|
+
_remove_legacy "$neocortex_dir/$folder" "steps legados"
|
|
314
|
+
done
|
|
293
315
|
|
|
294
|
-
#
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
"
|
|
300
|
-
warnings=$((warnings + 1))
|
|
301
|
-
fi
|
|
316
|
+
# Artefatos de instalacoes anteriores
|
|
317
|
+
_remove_legacy "$claude_dir/agents/.git" "repo git antigo"
|
|
318
|
+
_remove_legacy "$claude_dir/.claude" "diretorio aninhado (erro BMAD)"
|
|
319
|
+
_remove_legacy "$claude_dir/agents-ldtn" "diretorio legado"
|
|
320
|
+
_remove_legacy "$claude_dir/.superclaude-metadata.json" "metadata SuperClaude"
|
|
302
321
|
|
|
303
|
-
#
|
|
304
|
-
local backup_count=0
|
|
322
|
+
# Backups SuperClaude antigos
|
|
305
323
|
if [ -d "$claude_dir/backups" ]; then
|
|
306
324
|
for f in "$claude_dir/backups"/superclaude_backup_*.tar.gz; do
|
|
307
325
|
[ -f "$f" ] || continue
|
|
308
|
-
|
|
326
|
+
_remove_legacy "$f" "backup SuperClaude antigo"
|
|
309
327
|
done
|
|
310
328
|
fi
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
329
|
+
|
|
330
|
+
# ─── Categoria 3: Cursor ──────────────────────────────────────────────
|
|
331
|
+
_remove_legacy "$HOME/.cursor/neocortex" "configs Cursor legadas"
|
|
332
|
+
# .cursorrules com referencias neocortex (verificar antes de remover)
|
|
333
|
+
if [ -f "$HOME/.cursorrules" ]; then
|
|
334
|
+
if grep -qi "neocortex\|ornexus\|synapse" "$HOME/.cursorrules" 2>/dev/null; then
|
|
335
|
+
_remove_legacy "$HOME/.cursorrules" "cursorrules com refs legadas"
|
|
336
|
+
fi
|
|
314
337
|
fi
|
|
315
338
|
|
|
316
|
-
|
|
317
|
-
|
|
339
|
+
# ─── Categoria 4: VS Code ─────────────────────────────────────────────
|
|
340
|
+
_remove_legacy "$HOME/.vscode/neocortex" "configs VS Code legadas"
|
|
341
|
+
# .instructions.md com referencias neocortex antigo
|
|
342
|
+
if [ -f "$HOME/.instructions.md" ]; then
|
|
343
|
+
if grep -qi "neocortex\|ornexus\|synapse" "$HOME/.instructions.md" 2>/dev/null; then
|
|
344
|
+
_remove_legacy "$HOME/.instructions.md" "instructions.md com refs legadas"
|
|
345
|
+
fi
|
|
318
346
|
fi
|
|
319
347
|
|
|
320
|
-
#
|
|
321
|
-
|
|
322
|
-
LEGACY_WARNINGS=$warnings
|
|
348
|
+
# ─── Categoria 5: Gemini CLI ──────────────────────────────────────────
|
|
349
|
+
_remove_legacy "$HOME/.gemini/neocortex" "configs Gemini legadas"
|
|
323
350
|
|
|
324
|
-
|
|
325
|
-
|
|
351
|
+
# ─── Categoria 6: Codex ───────────────────────────────────────────────
|
|
352
|
+
_remove_legacy "$HOME/.codex/neocortex" "configs Codex legadas"
|
|
326
353
|
|
|
327
|
-
|
|
328
|
-
#
|
|
329
|
-
if [ "$CLEANUP_LEGACY" != true ]; then
|
|
330
|
-
return 0
|
|
331
|
-
fi
|
|
354
|
+
# ─── Categoria 7: Antigravity ─────────────────────────────────────────
|
|
355
|
+
# Configs legadas de Antigravity sao gerenciadas pelo adapter, sem path fixo global
|
|
332
356
|
|
|
333
|
-
#
|
|
334
|
-
if [ $
|
|
335
|
-
|
|
336
|
-
|
|
357
|
+
# ─── Resultado ────────────────────────────────────────────────────────
|
|
358
|
+
if [ $removed -gt 0 ]; then
|
|
359
|
+
ok "$removed artefato(s) legado(s) removido(s) automaticamente"
|
|
360
|
+
else
|
|
361
|
+
debug "Nenhum artefato legado encontrado"
|
|
337
362
|
fi
|
|
338
363
|
|
|
339
|
-
#
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
return 0
|
|
343
|
-
fi
|
|
364
|
+
# Resetar contadores legados (compatibilidade)
|
|
365
|
+
LEGACY_ITEMS=""
|
|
366
|
+
LEGACY_WARNINGS=0
|
|
344
367
|
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
warn "Os seguintes artefatos serao removidos:"
|
|
348
|
-
local item_count=0
|
|
349
|
-
while IFS= read -r item; do
|
|
350
|
-
[ -z "$item" ] && continue
|
|
351
|
-
local display_item="${item/#$HOME/~}"
|
|
352
|
-
if [ -d "$item" ]; then
|
|
353
|
-
info " - ${display_item}/ (diretorio)"
|
|
354
|
-
else
|
|
355
|
-
info " - ${display_item} (arquivo)"
|
|
356
|
-
fi
|
|
357
|
-
item_count=$((item_count + 1))
|
|
358
|
-
done <<EOF
|
|
359
|
-
$LEGACY_ITEMS
|
|
360
|
-
EOF
|
|
368
|
+
return 0
|
|
369
|
+
}
|
|
361
370
|
|
|
362
|
-
|
|
371
|
+
# Cleanup de IP legada em projetos individuais (project-level)
|
|
372
|
+
auto_cleanup_legacy_project() {
|
|
373
|
+
local project_dir="$1"
|
|
374
|
+
local neocortex_dir="$project_dir/.claude/agents/neocortex"
|
|
375
|
+
local skills_dir="$project_dir/.claude/skills/neocortex"
|
|
376
|
+
local cleaned=false
|
|
363
377
|
|
|
364
|
-
|
|
365
|
-
if
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
echo ""
|
|
369
|
-
info "Timeout - cleanup cancelado"
|
|
370
|
-
return 0
|
|
378
|
+
# Remover core/ e seus subdiretorios
|
|
379
|
+
if [ -d "$neocortex_dir/core" ]; then
|
|
380
|
+
rm -rf "$neocortex_dir/core"
|
|
381
|
+
cleaned=true
|
|
371
382
|
fi
|
|
372
383
|
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
384
|
+
# Remover step folders
|
|
385
|
+
for folder in steps-c steps-e steps-p steps-r steps-u; do
|
|
386
|
+
if [ -d "$neocortex_dir/$folder" ]; then
|
|
387
|
+
rm -rf "$neocortex_dir/$folder"
|
|
388
|
+
cleaned=true
|
|
389
|
+
fi
|
|
390
|
+
done
|
|
391
|
+
|
|
392
|
+
# Remover skills
|
|
393
|
+
if [ -d "$skills_dir" ]; then
|
|
394
|
+
rm -rf "$skills_dir"
|
|
395
|
+
cleaned=true
|
|
376
396
|
fi
|
|
377
397
|
|
|
378
|
-
#
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
local display_item="${item/#$HOME/~}"
|
|
384
|
-
if rm -rf "$item" 2>/dev/null; then
|
|
385
|
-
ok "Removido: $display_item"
|
|
386
|
-
removed=$((removed + 1))
|
|
387
|
-
else
|
|
388
|
-
fail "Falha ao remover: $display_item"
|
|
389
|
-
failed=$((failed + 1))
|
|
398
|
+
# Remover arquivos desnecessarios
|
|
399
|
+
for file in package.json README.md workflow.md; do
|
|
400
|
+
if [ -f "$neocortex_dir/$file" ]; then
|
|
401
|
+
rm -f "$neocortex_dir/$file"
|
|
402
|
+
cleaned=true
|
|
390
403
|
fi
|
|
391
|
-
done
|
|
392
|
-
$LEGACY_ITEMS
|
|
393
|
-
EOF
|
|
404
|
+
done
|
|
394
405
|
|
|
395
|
-
if [ $
|
|
396
|
-
|
|
397
|
-
else
|
|
398
|
-
warn "$removed removido(s), $failed falha(s)"
|
|
406
|
+
if [ "$cleaned" = true ]; then
|
|
407
|
+
info "IP proprietaria removida do projeto (agora servida via server remoto)"
|
|
399
408
|
fi
|
|
400
|
-
|
|
401
|
-
return 0
|
|
402
409
|
}
|
|
403
410
|
|
|
404
411
|
detect_project_migration_needs() {
|
|
@@ -491,47 +498,9 @@ detect_source_dir() {
|
|
|
491
498
|
}
|
|
492
499
|
|
|
493
500
|
# =============================================================================
|
|
494
|
-
# TIER 3:
|
|
501
|
+
# TIER 3: CONFIG DO THIN CLIENT
|
|
495
502
|
# =============================================================================
|
|
496
503
|
|
|
497
|
-
cleanup_legacy_ip() {
|
|
498
|
-
local neocortex_dir="${HOME}/.claude/agents/neocortex"
|
|
499
|
-
local skills_dir="${HOME}/.claude/skills/neocortex"
|
|
500
|
-
local cleaned=false
|
|
501
|
-
|
|
502
|
-
# Remover core/ e seus subdiretorios
|
|
503
|
-
if [ -d "$neocortex_dir/core" ]; then
|
|
504
|
-
rm -rf "$neocortex_dir/core"
|
|
505
|
-
cleaned=true
|
|
506
|
-
fi
|
|
507
|
-
|
|
508
|
-
# Remover step folders (steps-c, steps-e, steps-p, steps-r, steps-u)
|
|
509
|
-
for folder in steps-c steps-e steps-p steps-r steps-u; do
|
|
510
|
-
if [ -d "$neocortex_dir/$folder" ]; then
|
|
511
|
-
rm -rf "$neocortex_dir/$folder"
|
|
512
|
-
cleaned=true
|
|
513
|
-
fi
|
|
514
|
-
done
|
|
515
|
-
|
|
516
|
-
# Remover skills
|
|
517
|
-
if [ -d "$skills_dir" ]; then
|
|
518
|
-
rm -rf "$skills_dir"
|
|
519
|
-
cleaned=true
|
|
520
|
-
fi
|
|
521
|
-
|
|
522
|
-
# Remover arquivos desnecessarios
|
|
523
|
-
for file in package.json README.md; do
|
|
524
|
-
if [ -f "$neocortex_dir/$file" ]; then
|
|
525
|
-
rm -f "$neocortex_dir/$file"
|
|
526
|
-
cleaned=true
|
|
527
|
-
fi
|
|
528
|
-
done
|
|
529
|
-
|
|
530
|
-
if [ "$cleaned" = true ]; then
|
|
531
|
-
info "IP proprietaria removida de versao anterior (agora servida via server remoto)"
|
|
532
|
-
fi
|
|
533
|
-
}
|
|
534
|
-
|
|
535
504
|
setup_thin_client_config() {
|
|
536
505
|
local config_dir="${HOME}/.neocortex"
|
|
537
506
|
local config_file="${config_dir}/config.json"
|
|
@@ -575,44 +544,8 @@ EOFCONFIG
|
|
|
575
544
|
debug "Thin client config criada: $config_file"
|
|
576
545
|
}
|
|
577
546
|
|
|
578
|
-
cleanup_legacy_ip_project()
|
|
579
|
-
|
|
580
|
-
local neocortex_dir="$project_dir/.claude/agents/neocortex"
|
|
581
|
-
local skills_dir="$project_dir/.claude/skills/neocortex"
|
|
582
|
-
local cleaned=false
|
|
583
|
-
|
|
584
|
-
# Remover core/ e seus subdiretorios
|
|
585
|
-
if [ -d "$neocortex_dir/core" ]; then
|
|
586
|
-
rm -rf "$neocortex_dir/core"
|
|
587
|
-
cleaned=true
|
|
588
|
-
fi
|
|
589
|
-
|
|
590
|
-
# Remover step folders
|
|
591
|
-
for folder in steps-c steps-e steps-p steps-r steps-u; do
|
|
592
|
-
if [ -d "$neocortex_dir/$folder" ]; then
|
|
593
|
-
rm -rf "$neocortex_dir/$folder"
|
|
594
|
-
cleaned=true
|
|
595
|
-
fi
|
|
596
|
-
done
|
|
597
|
-
|
|
598
|
-
# Remover skills
|
|
599
|
-
if [ -d "$skills_dir" ]; then
|
|
600
|
-
rm -rf "$skills_dir"
|
|
601
|
-
cleaned=true
|
|
602
|
-
fi
|
|
603
|
-
|
|
604
|
-
# Remover arquivos desnecessarios
|
|
605
|
-
for file in package.json README.md; do
|
|
606
|
-
if [ -f "$neocortex_dir/$file" ]; then
|
|
607
|
-
rm -f "$neocortex_dir/$file"
|
|
608
|
-
cleaned=true
|
|
609
|
-
fi
|
|
610
|
-
done
|
|
611
|
-
|
|
612
|
-
if [ "$cleaned" = true ]; then
|
|
613
|
-
info "IP proprietaria removida do projeto (agora servida via server remoto)"
|
|
614
|
-
fi
|
|
615
|
-
}
|
|
547
|
+
# cleanup_legacy_ip_project() substituida por auto_cleanup_legacy_project()
|
|
548
|
+
# (definida na secao de limpeza automatica acima)
|
|
616
549
|
|
|
617
550
|
# =============================================================================
|
|
618
551
|
# INSTALACAO CORE
|
|
@@ -641,14 +574,20 @@ install_core() {
|
|
|
641
574
|
mkdir -p "$DEST_DIR" 2>/dev/null || { fail "Falha ao criar $DEST_DIR"; return 1; }
|
|
642
575
|
|
|
643
576
|
if [ "$LOCAL_MODE" = true ]; then
|
|
644
|
-
|
|
577
|
+
if [ ! -d "$SOURCE_DIR/core" ]; then
|
|
578
|
+
fail "Modo --local indisponível nesta distribuição."
|
|
579
|
+
warn "Os arquivos protegidos não estão incluídos no pacote npm."
|
|
580
|
+
warn "Este modo é restrito a ambientes autorizados."
|
|
581
|
+
info "Use sem --local para operar via servidor licenciado."
|
|
582
|
+
return 1
|
|
583
|
+
fi
|
|
645
584
|
copy_dir "$SOURCE_DIR/core" "$DEST_DIR/" || ((errors++))
|
|
646
585
|
copy_file "$SOURCE_DIR/package.json" "$DEST_DIR/" || ((errors++))
|
|
647
586
|
copy_file "$SOURCE_DIR/README.md" "$DEST_DIR/" || ((errors++))
|
|
648
587
|
else
|
|
649
588
|
# Tier 3 Remote Mode: NÃO copiar IP
|
|
650
589
|
# Apenas setup do thin client - steps/skills/standards vem do server
|
|
651
|
-
|
|
590
|
+
# Nota: auto_cleanup_legacy() ja rodou no inicio - aqui apenas config
|
|
652
591
|
setup_thin_client_config
|
|
653
592
|
fi
|
|
654
593
|
|
|
@@ -1226,8 +1165,8 @@ create_project_dirs() {
|
|
|
1226
1165
|
# Cleanup workflow.md from previous versions
|
|
1227
1166
|
rm -f "$project_dir/.claude/agents/neocortex/workflow.md" 2>/dev/null
|
|
1228
1167
|
|
|
1229
|
-
if [ "$LOCAL_MODE" = true ]; then
|
|
1230
|
-
# Modo local: copiar IP completa (
|
|
1168
|
+
if [ "$LOCAL_MODE" = true ] && [ -d "$SOURCE_DIR/core" ]; then
|
|
1169
|
+
# Modo local: copiar IP completa (restrito a ambientes autorizados)
|
|
1231
1170
|
cp "$SOURCE_DIR/package.json" "$project_dir/.claude/agents/neocortex/" 2>/dev/null
|
|
1232
1171
|
cp "$SOURCE_DIR/README.md" "$project_dir/.claude/agents/neocortex/" 2>/dev/null
|
|
1233
1172
|
mkdir -p "$project_dir/.claude/agents/neocortex/core"
|
|
@@ -1244,7 +1183,7 @@ create_project_dirs() {
|
|
|
1244
1183
|
fi
|
|
1245
1184
|
else
|
|
1246
1185
|
# Tier 3 Remote Mode: limpar IP de versoes anteriores no projeto
|
|
1247
|
-
|
|
1186
|
+
auto_cleanup_legacy_project "$project_dir"
|
|
1248
1187
|
fi
|
|
1249
1188
|
target_summary="${target_summary}claude-code, "
|
|
1250
1189
|
fi
|
|
@@ -1329,14 +1268,12 @@ show_migration_info() {
|
|
|
1329
1268
|
# MAIN
|
|
1330
1269
|
# =============================================================================
|
|
1331
1270
|
|
|
1332
|
-
TOTAL_STEPS=
|
|
1271
|
+
TOTAL_STEPS=4
|
|
1333
1272
|
|
|
1334
1273
|
main() {
|
|
1335
1274
|
show_banner
|
|
1336
1275
|
detect_source_dir
|
|
1337
1276
|
detect_old_installation
|
|
1338
|
-
detect_legacy_artifacts
|
|
1339
|
-
cleanup_legacy_artifacts
|
|
1340
1277
|
|
|
1341
1278
|
# Determine targets
|
|
1342
1279
|
if [ -z "$SELECTED_TARGETS" ]; then
|
|
@@ -1360,11 +1297,15 @@ main() {
|
|
|
1360
1297
|
# Count targets for step total
|
|
1361
1298
|
local target_count=$(echo "$SELECTED_TARGETS" | tr ',' ' ' | wc -w | tr -d ' ')
|
|
1362
1299
|
if echo "$SELECTED_TARGETS" | grep -q "claude-code"; then
|
|
1363
|
-
TOTAL_STEPS=
|
|
1300
|
+
TOTAL_STEPS=6 # cleanup + core + skills + targets + mcps + tools
|
|
1364
1301
|
fi
|
|
1365
1302
|
|
|
1366
|
-
# Step 1:
|
|
1367
|
-
step 1 $TOTAL_STEPS "
|
|
1303
|
+
# Step 1: Limpeza automatica de versoes anteriores
|
|
1304
|
+
step 1 $TOTAL_STEPS "Limpeza de versoes anteriores"
|
|
1305
|
+
auto_cleanup_legacy
|
|
1306
|
+
|
|
1307
|
+
# Step 2: Core
|
|
1308
|
+
step 2 $TOTAL_STEPS "Instalando core"
|
|
1368
1309
|
install_core
|
|
1369
1310
|
local core_result=$?
|
|
1370
1311
|
if [ $core_result -ne 0 ]; then
|
|
@@ -1372,23 +1313,23 @@ main() {
|
|
|
1372
1313
|
exit 1
|
|
1373
1314
|
fi
|
|
1374
1315
|
|
|
1375
|
-
# Step
|
|
1376
|
-
step
|
|
1316
|
+
# Step 3: Skills
|
|
1317
|
+
step 3 $TOTAL_STEPS "Instalando skills"
|
|
1377
1318
|
install_skills
|
|
1378
1319
|
|
|
1379
|
-
# Step
|
|
1380
|
-
step
|
|
1320
|
+
# Step 4: Targets
|
|
1321
|
+
step 4 $TOTAL_STEPS "Instalando ${BOLD}$target_count${NC} plataforma(s)"
|
|
1381
1322
|
install_targets "$SELECTED_TARGETS"
|
|
1382
1323
|
|
|
1383
|
-
# Step
|
|
1324
|
+
# Step 5-6: Claude Code extras
|
|
1384
1325
|
if echo "$SELECTED_TARGETS" | grep -q "claude-code"; then
|
|
1385
1326
|
load_env_file
|
|
1386
1327
|
prompt_tokens
|
|
1387
1328
|
|
|
1388
|
-
step
|
|
1329
|
+
step 5 $TOTAL_STEPS "Configurando MCPs"
|
|
1389
1330
|
install_mcps
|
|
1390
1331
|
|
|
1391
|
-
step
|
|
1332
|
+
step 6 $TOTAL_STEPS "Verificando ferramentas"
|
|
1392
1333
|
install_coderabbit
|
|
1393
1334
|
fi
|
|
1394
1335
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ornexus/neocortex",
|
|
3
|
-
"version": "3.8.
|
|
4
|
-
"description": "Neocortex v3.8.
|
|
3
|
+
"version": "3.8.2",
|
|
4
|
+
"description": "Neocortex v3.8.2 - Orquestrador de Desenvolvimento de Epics & Stories para Claude Code",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude",
|
|
7
7
|
"claude-code",
|